diff options
author | P. J. McDermott <pj@pehjota.net> | 2020-10-20 09:49:47 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2020-10-20 09:49:47 (EDT) |
commit | 1fd35668169484c6eb780bc199fd010518efa8b4 (patch) | |
tree | ef142a6610973afad092b7ade63bd0eb15ba4ae2 /hosts/nas1/postinst | |
parent | de8b0d62782a8474f822e8a255861fa53ad829b4 (diff) | |
download | pc-inst-1fd35668169484c6eb780bc199fd010518efa8b4.zip pc-inst-1fd35668169484c6eb780bc199fd010518efa8b4.tar.gz pc-inst-1fd35668169484c6eb780bc199fd010518efa8b4.tar.bz2 |
nas1: New host
Diffstat (limited to 'hosts/nas1/postinst')
-rw-r--r-- | hosts/nas1/postinst | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/hosts/nas1/postinst b/hosts/nas1/postinst new file mode 100644 index 0000000..82d4d26 --- /dev/null +++ b/hosts/nas1/postinst @@ -0,0 +1,41 @@ +#!/bin/sh + +# Purge systemd. +in_target apt-get -q -y purge libpam-systemd systemd || return 1 +in_target apt-get -q -y --purge autoremove || return 1 + +# Remove packages from APT cache. +in_target apt-get clean || return 1 + +# Install GRUB. +in_target update-grub +in_target grub-install "${dev}" + +# Update initramfs. +in_target update-initramfs -u + +# Configure network interfaces. +mv "${target}/etc/network/interfaces" "${target}/etc/network/interfaces.dist" +cat 1>"${target}/etc/network/interfaces" 0<<-EOF + auto lo + iface lo inet loopback + + # FIXME + auto eth0 + iface eth0 inet dhcp + EOF + +# Configure NFS. +mv "${target}/etc/exports" "${target}/etc/exports.dist" +cat 1>"${target}/etc/exports" 0<<-EOF + /media/5tb 192.168.10.0/255.255.255.0(rw,sync,no_subtree_check,no_root_squash,mountpoint) + EOF + +# Harden SSH server. +mv "${target}/etc/ssh/sshd_config" "${target}/etc/ssh/sshd_config.dist" +sed \ + -e 's/^PermitRootLogin .*$/PermitRootLogin no/' \ + -e 's/^#PasswordAuthentication .*$/#PasswordAuthentication no/' \ + "${target}/etc/ssh/sshd_config.dist" 1>"${target}/etc/ssh/sshd_config" + +return 0 |