diff --git a/images_yaml/almalinux.yaml b/images_yaml/almalinux.yaml index 472e34e..3990a71 100644 --- a/images_yaml/almalinux.yaml +++ b/images_yaml/almalinux.yaml @@ -495,31 +495,35 @@ actions: systemctl enable sshd || true systemctl enable ssh || true # sshd_config - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config || true # cloud-init - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true # other config sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux || true sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/alpine.yaml b/images_yaml/alpine.yaml index 1e83d6b..cd55d97 100644 --- a/images_yaml/alpine.yaml +++ b/images_yaml/alpine.yaml @@ -440,12 +440,13 @@ actions: cd /etc/ssh || true ssh-keygen -A || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true sed -i '/^#PermitRootLogin\|PermitRootLogin/c PermitRootLogin yes' /etc/ssh/sshd_config || true sed -i "s/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g" /etc/ssh/sshd_config || true sed -i '/^#ListenAddress\|ListenAddress/c ListenAddress 0.0.0.0' /etc/ssh/sshd_config || true sed -i '/^#AddressFamily\|AddressFamily/c AddressFamily any' /etc/ssh/sshd_config || true - sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true - sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -E -i 's/preserve_hostname:[[:space:]]*false/preserve_hostname: true/g' /etc/cloud/cloud.cfg || true sed -E -i 's/disable_root:[[:space:]]*true/disable_root: false/g' /etc/cloud/cloud.cfg || true @@ -455,9 +456,9 @@ actions: rc-update add sshd default || true /etc/init.d/cron enable || true /etc/init.d/cron start || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/archlinux.yaml b/images_yaml/archlinux.yaml index 9ac3c80..4a4fc00 100644 --- a/images_yaml/archlinux.yaml +++ b/images_yaml/archlinux.yaml @@ -843,31 +843,35 @@ actions: systemctl enable sshd || true systemctl enable ssh || true # sshd_config - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config || true # cloud-init - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true # other config sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux || true sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/centos.yaml b/images_yaml/centos.yaml index 486c6fc..8b1c14d 100644 --- a/images_yaml/centos.yaml +++ b/images_yaml/centos.yaml @@ -969,31 +969,35 @@ actions: systemctl enable sshd || true systemctl enable ssh || true # sshd_config - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config || true # cloud-init - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true # other config sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux || true sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/debian.yaml b/images_yaml/debian.yaml index 0d804a5..79f8f9f 100644 --- a/images_yaml/debian.yaml +++ b/images_yaml/debian.yaml @@ -1540,31 +1540,35 @@ actions: systemctl enable sshd || true systemctl enable ssh || true # sshd_config - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config || true # cloud-init - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true # other config sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux || true sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/fedora.yaml b/images_yaml/fedora.yaml index aa5b949..282bea6 100644 --- a/images_yaml/fedora.yaml +++ b/images_yaml/fedora.yaml @@ -402,31 +402,35 @@ actions: systemctl enable sshd || true systemctl enable ssh || true # sshd_config - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config || true # cloud-init - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true # other config sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux || true sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/gentoo.yaml b/images_yaml/gentoo.yaml index af68827..b5edbda 100644 --- a/images_yaml/gentoo.yaml +++ b/images_yaml/gentoo.yaml @@ -703,31 +703,35 @@ actions: systemctl enable sshd || true systemctl enable ssh || true # sshd_config - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config || true # cloud-init - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true # other config sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux || true sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/kali.yaml b/images_yaml/kali.yaml index 15d03bc..952dfaa 100644 --- a/images_yaml/kali.yaml +++ b/images_yaml/kali.yaml @@ -1796,31 +1796,35 @@ actions: systemctl enable sshd || true systemctl enable ssh || true # sshd_config - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config || true # cloud-init - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true # other config sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux || true sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/openeuler.yaml b/images_yaml/openeuler.yaml index 26fcba7..a6b4fba 100644 --- a/images_yaml/openeuler.yaml +++ b/images_yaml/openeuler.yaml @@ -396,31 +396,35 @@ actions: systemctl enable sshd || true systemctl enable ssh || true # sshd_config - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config || true # cloud-init - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true # other config sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux || true sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/opensuse.yaml b/images_yaml/opensuse.yaml index c451c7a..a0e990a 100644 --- a/images_yaml/opensuse.yaml +++ b/images_yaml/opensuse.yaml @@ -460,31 +460,35 @@ actions: systemctl enable sshd || true systemctl enable ssh || true # sshd_config - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config || true # cloud-init - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true # other config sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux || true sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/openwrt.yaml b/images_yaml/openwrt.yaml index a441b6d..28d15dc 100644 --- a/images_yaml/openwrt.yaml +++ b/images_yaml/openwrt.yaml @@ -372,12 +372,13 @@ actions: cd /etc/ssh || true ssh-keygen -A || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true sed -i '/^#PermitRootLogin\|PermitRootLogin/c PermitRootLogin yes' /etc/ssh/sshd_config || true sed -i "s/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g" /etc/ssh/sshd_config || true sed -i '/^#ListenAddress\|ListenAddress/c ListenAddress 0.0.0.0' /etc/ssh/sshd_config || true sed -i '/^#AddressFamily\|AddressFamily/c AddressFamily any' /etc/ssh/sshd_config || true - sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true - sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -E -i 's/preserve_hostname:[[:space:]]*false/preserve_hostname: true/g' /etc/cloud/cloud.cfg || true sed -E -i 's/disable_root:[[:space:]]*true/disable_root: false/g' /etc/cloud/cloud.cfg || true @@ -387,9 +388,9 @@ actions: rc-update add sshd default || true /etc/init.d/cron enable || true /etc/init.d/cron start || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/oracle.yaml b/images_yaml/oracle.yaml index 2f47960..eed6d01 100644 --- a/images_yaml/oracle.yaml +++ b/images_yaml/oracle.yaml @@ -270,31 +270,35 @@ actions: systemctl enable sshd || true systemctl enable ssh || true # sshd_config - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config || true # cloud-init - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true # other config sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux || true sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/rockylinux.yaml b/images_yaml/rockylinux.yaml index 1eb6403..003bff8 100644 --- a/images_yaml/rockylinux.yaml +++ b/images_yaml/rockylinux.yaml @@ -441,31 +441,35 @@ actions: systemctl enable sshd || true systemctl enable ssh || true # sshd_config - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config || true # cloud-init - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true # other config sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux || true sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container diff --git a/images_yaml/ubuntu.yaml b/images_yaml/ubuntu.yaml index 24f76ce..4f96db2 100644 --- a/images_yaml/ubuntu.yaml +++ b/images_yaml/ubuntu.yaml @@ -830,31 +830,35 @@ actions: systemctl enable sshd || true systemctl enable ssh || true # sshd_config - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config || true # cloud-init - sed -i \"s/^#\\?Port.*/Port 22/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i "s/^#\?\(Port\).*/\1 22/" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i -E 's/^#?(Port).*/\1 22/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?Port.*/Port 22/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#ListenAddress ::/ListenAddress ::/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i 's/#AddressFamily any/AddressFamily any/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true - sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/g\" /etc/ssh/sshd_config.d/50-cloud-init.conf || true + sed -i 's/^#\?PubkeyAuthentication.*/PubkeyAuthentication no/g' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^#UsePAM\\|UsePAM/c #UsePAM no' /etc/ssh/sshd_config.d/50-cloud-init.conf || true sed -i '/^AuthorizedKeysFile/s/^/#/' /etc/ssh/sshd_config.d/50-cloud-init.conf || true # other config sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux || true sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config || true - echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/motd || true - echo "Related repo https://github.com/oneclickvirt/incus\n--by https://t.me/spiritlhl" >> /etc/banner || true + grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/motd || true + echo "Related repo https://github.com/oneclickvirt/lxc_amd64_images\n--by https://t.me/spiritlhl" >> /etc/banner || true types: - container