2021-11-04 07:35:44

This commit is contained in:
gbaconni
2021-11-04 07:35:44 +01:00
parent 5bf72c5dae
commit f12fddabb0

View File

@@ -125,8 +125,8 @@ d-i passwd/make-user boolean true
d-i passwd/user-fullname string gbaconni
d-i passwd/username string gbaconni
# Normal user's password, either in clear text
d-i passwd/user-password password Born+2+be+Root
d-i passwd/user-password-again password Born+2+be+Root
d-i passwd/user-password password Born2beRoot
d-i passwd/user-password-again password Born2beRoot
# or encrypted using a crypt(3) hash.
#d-i passwd/user-password-crypted password [crypt(3) hash]
# Create the first user with the specified UID instead of the default.
@@ -168,8 +168,8 @@ d-i clock-setup/ntp-server string ntp.metas.ch
# - crypto: use LVM within an encrypted partition
d-i partman-auto/method string crypto
d-i partman-crypto/confirm boolean false
d-i partman-crypto/passphrase password Born+2+be+Root
d-i partman-crypto/passphrase-again password Born+2+be+Root
d-i partman-crypto/passphrase password Born2beRoot
d-i partman-crypto/passphrase-again password Born2beRoot
d-i partman-crypto/warn_erase boolean true
d-i partman-crypto/weak_passphrase boolean false
d-i partman-auto/purge_lvm_from_device boolean true
@@ -199,59 +199,54 @@ d-i partman-auto/choose_recipe select boot-crypto
d-i partman-auto-lvm/new_vg_name string LVMGroup
d-i partman-auto/expert_recipe string \
boot-crypto :: \
500 10 512 ext2 \
512 10 512 ext2 \
$primary{ } $bootable{ } \
$defaultignore{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext2 } \
mountpoint{ /boot } \
. \
1 20 1 free \
$primary{ } \
$defaultignore{ } \
method{ biosgrub } \
. \
10000 30 10240 ext4 \
10240 20 10240 ext4 \
$lvmok{ } \
lv_name{ root } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
. \
2300 40 2356 linux-swap \
2356 30 -1 linux-swap \
$lvmok{ } \
lv_name{ swap } \
method{ swap } format{ } \
. \
5000 50 5120 ext4 \
5120 40 5120 ext4 \
$lvmok{ } \
lv_name{ home } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /home } \
. \
3000 60 3072 ext4 \
3072 50 3072 ext4 \
$lvmok{ } \
lv_name{ var } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /var } \
. \
3000 70 3072 ext4 \
3072 60 3072 ext4 \
$lvmok{ } \
lv_name{ srv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /srv } \
. \
3000 80 3072 ext4 \
3072 70 3072 ext4 \
$lvmok{ } \
lv_name{ tmp } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /tmp } \
. \
4000 90 4096 ext4 \
4096 80 4096 ext4 \
$lvmok{ } \
lv_name{ var-log } \
method{ format } format{ } \
@@ -311,9 +306,12 @@ d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-efi/non_efi_system boolean false
d-i partman-partitioning/choose_label string msdos
d-i partman-partitioning/default_label string msdos
# Force UEFI booting ('BIOS compatibility' will be lost). Default: false.
#d-i partman-efi/non_efi_system boolean true
d-i partman-efi/non_efi_system boolean false
# Ensure the partition table is GPT - this is required for EFI
#d-i partman-partitioning/choose_label string gpt
#d-i partman-partitioning/default_label string gpt
@@ -526,20 +524,31 @@ d-i debian-installer/exit/poweroff boolean true
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
d-i preseed/late_command \
in-target update-alternatives --set editor /usr/bin/vim.basic; \
in-target sed -i'.orig' -r 's/^#?(Port) .*/\1 4242/; s/^#?(PermitRootLogin) .*/\1 no/;' /etc/ssh/sshd_config; \
in-target systemctl enable ufw; \
in-target systemctl start ufw; \
in-target ufw enable; \
in-target ufw allow proto tcp from any to any port 4242; \
in-target ufw status; \
in-target groupadd -f -r sudo; \
in-target groupadd -f user42; \
in-target usermod -a -G sudo,user42 gbaconni; \
in-target sed -i'.orig' -r 's/^#?(PASS_MAX_DAYS).*/\1\t30/; s/^#?(PASS_MIN_DAYS).*/\1\t2/; s/^#?(PASS_WARN_AGE).*/\1\t7/; s/^#?(PASS_MIN_LEN).*/\1\t10/;' /etc/login.defs; \
in-target sed -i'.orig' -r 's/^[# ]*(minlen =)/\1 10/; s/^[# ]*([ud]credit =)/\1 -1/; s/^[# ]*(maxrepeat =)/\1 3/; s/^[# ]*(usercheck =)/\1 1/; s/^[# ]*(difok =)/\1 7/;' /etc/security/pwquality.conf; \
in-target mkdir -p /var/log/sudo; \
in-target printf 'passwd_tries=3\nbadpass_message="I am sorry. I am afraid you cannot do that."\nlog_input\nlog_output\niolog_dir="/var/log/sudo"\nrequiretty\nsecure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"\n' | sed 's/^/Defaults\t/' > /etc/sudoers.d/sudo; \
in-target apt-get clean
d-i preseed/late_command string \
echo '#!/bin/sh -e' > /target/etc/rc.local; \
echo '' >> /target/etc/rc.local; \
echo 'exit 0' >> /target/etc/rc.local; \
chmod +x /target/etc/rc.local; \
cp /target/etc/rc.local /target/etc/rc.local.orig; \
echo '#!/bin/sh' > /target/etc/rc.local; \
echo '/usr/sbin/ufw enable' >> /target/etc/rc.local; \
echo '/usr/sbin/ufw allow ssh' >> /target/etc/rc.local; \
echo '/usr/sbin/ufw allow proto tcp from any to any port 4242 >> /target/etc/rc.local; \
echo 'mv -f /etc/rc.local /etc/rc.local.baco' >> /target/etc/rc.local; \
echo 'mv -f /etc/rc.local.orig /etc/rc.local' >> /target/etc/rc.local; \
echo 'test -x /etc/rc.local && /etc/rc.local' >> /target/etc/rc.local; \
echo 'exit 0' >> /target/etc/rc.local; \
in-target /usr/bin/systemctl enable rc-local.service >>/tmp/.42 2>&1; \
in-target /usr/bin/update-alternatives --set editor /usr/bin/vim.basic >>/tmp/.42 2>&1; \
in-target /usr/bin/ln -snf /usr/bin/vim.basic /etc/alternatives/editor >>/tmp/.42 2>&1; \
in-target /usr/bin/sed -i'.orig' -r 's/^#?(Port) .*/\1 4242/; s/^#?(PermitRootLogin) .*/\1 no/;' /etc/ssh/sshd_config >>/tmp/.42 2>&1; \
in-target /usr/sbin/groupadd -f -r sudo >>/tmp/.42 2>&1; \
in-target /usr/sbin/groupadd -f user42 >>/tmp/.42 2>&1; \
in-target /usr/sbin/usermod -a -G sudo,user42 gbaconni >>/tmp/.42 2>&1; \
in-target /usr/bin/sed -i'.orig' -r 's/^#?(PASS_MAX_DAYS).*/\1\t30/; s/^#?(PASS_MIN_DAYS).*/\1\t2/; s/^#?(PASS_WARN_AGE).*/\1\t7/; s/^#?(PASS_MIN_LEN).*/\1\t10/;' /etc/login.defs >>/tmp/.42 2>&1; \
in-target /usr/bin/sed -i'.orig' -r 's/^[# ]*(minlen =)/\1 10/; s/^[# ]*([ud]credit =)/\1 -1/; s/^[# ]*(maxrepeat =)/\1 3/; s/^[# ]*(usercheck =)/\1 1/; s/^[# ]*(difok =)/\1 7/;' /etc/security/pwquality.conf >>/tmp/.42 2>&1; \
in-target /usr/bin/install -D -d /var/log/sudo >>/tmp/.42 2>&1; \
in-target /usr/bin/printf 'passwd_tries=3\nbadpass_message="I am sorry. I am afraid you cannot do that."\nlog_input\nlog_output\niolog_dir="/var/log/sudo"\nrequiretty\nsecure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"\n' | sed 's/^/Defaults\t/' >/etc/sudoers.d/sudo 2>>/tmp/.42; \
in-target /usr/bin/apt-get clean >>/tmp/.42 2>&1; \
in-target echo "That's All Folks!" >>/tmp/.42 2>&1