blob: 1e80152dfe1298b435ddf3dc4d221107f4f87933 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/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
# 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
auto enp1s0
iface enp1s0 inet dhcp
EOF
# Don't suspend on lid close.
cp -p "${target}/etc/elogind/logind.conf" \
"${target}/etc/elogind/logind.conf.dist"
sed 's/^.*\(HandleLidSwitch.*\)=.*$/\1=ignore/' \
"${target}/etc/elogind/logind.conf.dist" \
1>"${target}/etc/elogind/logind.conf"
# Create print queues directory.
mkdir "${target}/var/spool/printq"
chgrp 7 "${target}/var/spool/printq"
chmod g+s "${target}/var/spool/printq"
# Configure NFS.
mv "${target}/etc/exports" "${target}/etc/exports.dist"
cat 1>"${target}/etc/exports" 0<<-EOF
/var/spool/printq 192.168.10.0/255.255.255.0(rw,sync,no_subtree_check,root_squash)
EOF
# Set up printq.
wget -O "${target}/usr/local/bin/printq" \
'http://git.pehjota.net/printq/printq.git/plain/printq'
chmod a+x "${target}/usr/local/bin/printq"
mkdir "${target}/etc/boot.d"
cat 1>"${target}/etc/boot.d/printq" 0<<-EOF
#!/bin/sh
sudo -b -u lp /usr/local/bin/printq /var/spool/printq
EOF
chmod a+x "${target}/etc/boot.d/printq"
# 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
|