diff options
author | Christian Pointner <equinox@spreadspace.org> | 2024-02-25 01:28:18 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2024-02-25 01:28:18 +0100 |
commit | 4e3053749991a09fbdf17ad93ee6654f4fbbf7a7 (patch) | |
tree | c1511e7a0a6db02510e51295b70e3c44063e1bc4 /roles/installer/debian | |
parent | apt-repo/backports: fix for bookworm; ch-installsmb increase samba share for ... (diff) |
installer/* improve regexp to set ssh port and fix ssh port config for newer ubuntu releases
Diffstat (limited to 'roles/installer/debian')
9 files changed, 9 insertions, 9 deletions
diff --git a/roles/installer/debian/preseed/templates/preseed_debian-bookworm.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-bookworm.cfg.j2 index 6b8e70f9..3e86b048 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-bookworm.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-bookworm.cfg.j2 @@ -96,7 +96,7 @@ d-i preseed/late_command string \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ {% if ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ + in-target bash -c "sed -e 's/^\s*#*\s*Port\s\s*[0-9][0-9]*$/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j2 index fdc65ff7..0649b18f 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j2 @@ -90,7 +90,7 @@ d-i preseed/late_command string \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ {% if ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ + in-target bash -c "sed -e 's/^\s*#*\s*Port\s\s*[0-9][0-9]*$/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 index 575f44a9..209cd1b7 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 @@ -90,7 +90,7 @@ d-i preseed/late_command string \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ {% if ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ + in-target bash -c "sed -e 's/^\s*#*\s*Port\s\s*[0-9][0-9]*$/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 index 3ad35d5a..87a90060 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 @@ -87,7 +87,7 @@ d-i preseed/late_command string \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ {% if ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ + in-target bash -c "sed -e 's/^\s*#*\s*Port\s\s*[0-9][0-9]*$/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 index 7d6137e4..3c682d81 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -87,7 +87,7 @@ d-i preseed/late_command string \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ {% if ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ + in-target bash -c "sed -e 's/^\s*#*\s*Port\s\s*[0-9][0-9]*$/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_kali-kali-rolling.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_kali-kali-rolling.cfg.j2 index fc9a84a5..7e2fe535 100644 --- a/roles/installer/debian/preseed/templates/preseed_kali-kali-rolling.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_kali-kali-rolling.cfg.j2 @@ -88,7 +88,7 @@ d-i preseed/late_command string \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ {% if ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ + in-target bash -c "sed -e 's/^\s*#*\s*Port\s\s*[0-9][0-9]*$/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} in-target bash -c "systemctl enable ssh"; \ mkdir -p -m 0700 /target/root/.ssh; \ diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 index 9d644e4d..1446ab2c 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -107,7 +107,7 @@ d-i preseed/late_command string \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ {% if ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ + in-target bash -c "sed -e 's/^\s*#*\s*Port\s\s*[0-9][0-9]*$/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 index 48cc16bb..c2689623 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 @@ -110,7 +110,7 @@ d-i preseed/late_command string \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ {% if ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ + in-target bash -c "sed -e 's/^\s*#*\s*Port\s\s*[0-9][0-9]*$/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 index 8bfbe61a..b8fd1110 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -100,7 +100,7 @@ d-i preseed/late_command string \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ {% if ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ + in-target bash -c "sed -e 's/^\s*#*\s*Port\s\s*[0-9][0-9]*$/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ |