From c530d4c8974ff9befd1c61d6122c74e244e6811f Mon Sep 17 00:00:00 2001 From: sean Date: Tue, 16 Jul 2019 12:40:07 -0700 Subject: [PATCH] tweaks --- setup.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/setup.sh b/setup.sh index 6ff870f..7e84e8b 100644 --- a/setup.sh +++ b/setup.sh @@ -268,7 +268,7 @@ echo "echo \"Done.\"" >> /mnt/setup-chroot.sh # network configuration should have optional static configuration - not just DHCP, it's very important -echo "systemctl unmask networking && systemctl enable networking 2>&1 1>/dev/null" >> /mnt/setup-chroot.sh +echo "systemctl unmask networking 2>&1 1>/dev/null && systemctl enable networking 2>&1 1>/dev/null" >> /mnt/setup-chroot.sh # configure docker storage to use zfs @@ -387,9 +387,9 @@ echo 'echo ""' >> /mnt/setup-chroot.sh echo 'echo "Enabling SSH..."'>> /mnt/setup-chroot.sh echo "sed -ir 's/^ *#? *ChallengeResponseAuthentication.*/ChallengeResponseAuthentication no/g' /etc/ssh/sshd_config" >> /mnt/setup-chroot.sh -echo "sed -ir 's/^ *#? *PasswordAuthentication.*/PasswordAuthentication no/g' /etc/ssh/sshd_config" >> /mnt/setup-chroot.sh -echo "sed -ir 's/^ *#? *UsePAM.*/UsePAM no/g' /etc/ssh/sshd_config" >> /mnt/setup-chroot.sh -echo "sed -ir 's/^ *#? *PermitRootLogin.*/PermitRootLogin no/g' /etc/ssh/sshd_config" >> /mnt/setup-chroot.sh +echo "sed -ir 's/^#PasswordAuthentication.*/PasswordAuthentication no/g' /etc/ssh/sshd_config" >> /mnt/setup-chroot.sh +echo "sed -ir 's/^UsePAM.*/UsePAM no/g' /etc/ssh/sshd_config" >> /mnt/setup-chroot.sh +echo "sed -ir 's/^#PermitRootLogin.*/PermitRootLogin no/g' /etc/ssh/sshd_config" >> /mnt/setup-chroot.sh echo "errors=\$(systemctl enable ssh 2>&1 1>/dev/null)">> /mnt/setup-chroot.sh #&& ufw allow in on any from any to any port 22 proto tcp 2>&1 1>/dev/null @@ -481,11 +481,10 @@ echo "echo \"Done.\"" >> /mnt/setup-chroot.sh # add the firewall rule for SSH, but there may already be an exception for this, test the network in the live environment -sed -ir 's/### RULES ###/### RULES ###\n-A ufw-user-input -i br0 -p tcp --dport 22 -j ACCEPT/g' /mnt/etc/ufw/user.rules - -exit 0 - - +echo "" +echo "Opening SSH port on firewall..." +sed -ir 's/### RULES ###/### RULES ###\n-A ufw-user-input -i br0 -p tcp --dport 22 -j ACCEPT/g' /mnt/etc/ufw/user.rules 2>&1 1>/dev/null +echo "Done." # commented out for debugging echo ""