|
|
|
|
@ -236,7 +236,7 @@ echo "cp /usr/share/zoneinfo/$timezone /etc/localtime" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"Done.\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
|
|
echo "echo \"\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"Installing linux image, bash, screen, tmux, zfs, vim, sharutils, docker, dosfstools, sendmail, mailutils, openssh, ufw...\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"Installing linux image, bash, screen, tmux, zfs, vim, sharutils, docker, dosfstools, mailutils, openssh, ufw...\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
|
|
# preconfigure postfix for no configuration
|
|
|
|
|
echo "debconf-set-selections <<< \"postfix postfix/main_mailer_type string 'No configuration'\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
@ -326,6 +326,7 @@ echo "errors=\$(sed -ir 's/GRUB_CMDLINE_LINUX=\".*\"/GRUB_CMDLINE_LINUX=\"root=Z
|
|
|
|
|
echo "if ! [ \"\$?\" = \"0\" ]; then echo \"Failed to set grub ZFS root - \$errors\"; exit 104; fi" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo 'echo "Done."' >> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo 'echo ""' >> /mnt/setup-chroot.sh
|
|
|
|
|
echo 'echo "Updating grub..."' >> /mnt/setup-chroot.sh
|
|
|
|
|
echo 'errors=$(update-grub 2>&1 1>/dev/null)'>> /mnt/setup-chroot.sh
|
|
|
|
|
@ -353,8 +354,16 @@ echo "echo \"rpool/var/tmp /var/tmp zfs nodev,relatime 0 0\" >> /etc/fstab" >> /
|
|
|
|
|
echo "zfs set mountpoint=legacy rpool/tmp" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"rpool/tmp /tmp zfs nodev,relatime 0 0\" >> /etc/fstab" >> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 "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
|
|
|
|
|
echo 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh
|
|
|
|
|
@ -381,10 +390,10 @@ echo "ssh-keygen -b 4096 -t rsa -q -f \"/home/${admin}/.ssh/id_rsa.pub\" -N '$ro
|
|
|
|
|
#echo "chmod 600 \"/home/${admin}/.ssh/id_rsa\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "chown -R ${admin}:${admin} \"/home/${admin}\"" >> /mnt/setup-chroot.sh
|
|
|
|
|
|
|
|
|
|
echo "echo \"admin: ${admins}\" >> /etc/mail/aliases" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "echo \"admin: ${admins}\" >> /etc/aliases" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "newaliases" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "systemctl enable sendmail" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "service sendmail start" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "systemctl enable postfix" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "service postfix start" >> /mnt/setup-chroot.sh
|
|
|
|
|
echo "cat \"/home/${admin}/.ssh/id_rsa.pub\" | mail -s \"$hostname SSH key\" -A \"/home/${admin}/.ssh/id_rsa.pub\" admin" >> /mnt/setup-chroot.sh
|
|
|
|
|
# uuencode test.csv test.csv | mail -v -s "Subject test" -r no-reply@mydomain.co.uk recepient@mydomain.co.uk
|
|
|
|
|
|
|
|
|
|
|