| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,122 @@ |
| 1 |
+# System authorization information |
|
| 2 |
+auth --enableshadow --passalgo=sha512 |
|
| 3 |
+# Use graphical install |
|
| 4 |
+text |
|
| 5 |
+repo --name="AppStream" --mirrorlist="http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream" |
|
| 6 |
+repo --name="EPEL" --mirrorlist="https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64" |
|
| 7 |
+# Use network installation |
|
| 8 |
+url --mirrorlist="http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=BaseOS" |
|
| 9 |
+# Run the Setup Agent on first boot |
|
| 10 |
+firstboot --disable |
|
| 11 |
+ignoredisk --only-use=vda |
|
| 12 |
+# Keyboard layouts |
|
| 13 |
+keyboard --vckeymap=us --xlayouts='us' |
|
| 14 |
+# System language |
|
| 15 |
+lang en_US.UTF-8 |
|
| 16 |
+# Agree to EULA |
|
| 17 |
+eula --agreed |
|
| 18 |
+# Reboot after completing the installation |
|
| 19 |
+reboot |
|
| 20 |
+ |
|
| 21 |
+# Network information |
|
| 22 |
+network --bootproto=dhcp --device=eth0 --ethtool="autoneg on" --ipv6=auto --activate |
|
| 23 |
+network --hostname=localhost.localdomain |
|
| 24 |
+ |
|
| 25 |
+# Root password |
|
| 26 |
+rootpw --iscrypted $6$Vd3UMG690KCv5IUg$bcB520DHXxf97qVax8lCxJ09f9S1VqE2/CH7t//yUQ74ch2WTPu4LMhew8LUDZKKgnpD.lOOABDO7ZxROvHN1. |
|
| 27 |
+# System timezone |
|
| 28 |
+timezone Europe/Sofia --isUtc --nontp |
|
| 29 |
+# System bootloader configuration |
|
| 30 |
+bootloader --append="crashkernel=auto net.ifnames=0 biosdevname=0" --location=mbr --boot-drive=vda |
|
| 31 |
+ |
|
| 32 |
+# Partition clearing information |
|
| 33 |
+zerombr |
|
| 34 |
+clearpart --all --initlabel --drives=vda |
|
| 35 |
+# Disk partitioning information |
|
| 36 |
+part /boot --fstype="ext2" --ondisk=vda --size=512 |
|
| 37 |
+part swap --fstype="swap" --ondisk=vda --size=2048 |
|
| 38 |
+part / --fstype="xfs" --ondisk=vda --size=21264 |
|
| 39 |
+ |
|
| 40 |
+%packages |
|
| 41 |
+@^minimal-environment |
|
| 42 |
+kexec-tools |
|
| 43 |
+bind |
|
| 44 |
+bind-chroot |
|
| 45 |
+bind-utils |
|
| 46 |
+tcpdump |
|
| 47 |
+traceroute |
|
| 48 |
+mc |
|
| 49 |
+telnet |
|
| 50 |
+vim |
|
| 51 |
+dnf-automatic |
|
| 52 |
+nmap |
|
| 53 |
+rpcbind |
|
| 54 |
+wget |
|
| 55 |
+ftp |
|
| 56 |
+lftp |
|
| 57 |
+rsync |
|
| 58 |
+policycoreutils-python-utils |
|
| 59 |
+unzip |
|
| 60 |
+zip |
|
| 61 |
+iptraf-ng |
|
| 62 |
+epel-release |
|
| 63 |
+bird |
|
| 64 |
+fail2ban |
|
| 65 |
+fail2ban-systemd |
|
| 66 |
+chrony |
|
| 67 |
+%end |
|
| 68 |
+ |
|
| 69 |
+%addon com_redhat_kdump --enable --reserve-mb='auto' |
|
| 70 |
+ |
|
| 71 |
+%end |
|
| 72 |
+ |
|
| 73 |
+%anaconda |
|
| 74 |
+pwpolicy root --minlen=10 --minquality=1 --notstrict --nochanges --notempty |
|
| 75 |
+pwpolicy user --minlen=10 --minquality=1 --notstrict --nochanges --emptyok |
|
| 76 |
+pwpolicy luks --minlen=10 --minquality=1 --notstrict --nochanges --notempty |
|
| 77 |
+%end |
|
| 78 |
+ |
|
| 79 |
+%post |
|
| 80 |
+ |
|
| 81 |
+echo "CRYPTO_POLICY='-oCiphers=chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr -oMACs=hmac-sha2-512-etm@openssh.com,hmac-sha2-512,hmac-sha2-256-etm@openssh.com,hmac-sha2-256 -oGSSAPIKexAlgorithms=gss-gex-sha1-,gss-group14-sha1- -oKexAlgorithms=curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp384,ecdh-sha2-nistp521 -oHostKeyAlgorithms=ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519 -oPubkeyAcceptedKeyTypes=rsa-sha2-256,ecdsa-sha2-nistp256,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384,ecdsa-sha2-nistp384-cert-v01@openssh.com,rsa-sha2-512,ecdsa-sha2-nistp521,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,ssh-rsa,ssh-rsa-cert-v01@openssh.com'" > /etc/crypto-policies/back-ends/opensshserver.config |
|
| 82 |
+ |
|
| 83 |
+rm -f /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub && ssh-keygen -t ecdsa -b 384 -f /etc/ssh/ssh_host_ecdsa_key -C '' -N '' >&/dev/null |
|
| 84 |
+ |
|
| 85 |
+sed -i "s/apply_updates = no/apply_updates = yes/g" /etc/dnf/automatic.conf |
|
| 86 |
+ |
|
| 87 |
+systemctl enable --now dnf-automatic.timer |
|
| 88 |
+ |
|
| 89 |
+systemctl enable named-chroot |
|
| 90 |
+ |
|
| 91 |
+systemctl enable --now fail2ban |
|
| 92 |
+ |
|
| 93 |
+cat << EOF >> /etc/fail2ban/jail.d/01-sshd.conf |
|
| 94 |
+[DEFAULT] |
|
| 95 |
+# Ban hosts for one hour: |
|
| 96 |
+bantime = 3600 |
|
| 97 |
+ |
|
| 98 |
+[sshd] |
|
| 99 |
+enabled = true |
|
| 100 |
+EOF |
|
| 101 |
+ |
|
| 102 |
+echo "net.ipv4.tcp_timestamps = 0" > /etc/sysctl.d/01-tcp-timestamp.conf |
|
| 103 |
+ |
|
| 104 |
+sed -i 's/\#compress/compress/g' /etc/logrotate.conf |
|
| 105 |
+ |
|
| 106 |
+firewall-offline-cmd --zone=public --add-service=ospf |
|
| 107 |
+firewall-offline-cmd --zone=public --add-port=1025/tcp |
|
| 108 |
+firewall-offline-cmd --zone=public --add-icmp-block={timestamp-request,timestamp-reply}
|
|
| 109 |
+ |
|
| 110 |
+semanage port -a -t ssh_port_t -p tcp 1025 |
|
| 111 |
+ |
|
| 112 |
+sed -i "s/^#Port 22/Port 1025/g" /etc/ssh/sshd_config |
|
| 113 |
+sed -i "s/^PermitRootLogin yes/PermitRootLogin without-password/g" /etc/ssh/sshd_config |
|
| 114 |
+sed -i "s/^PasswordAuthentication yes/PasswordAuthentication no/g" /etc/ssh/sshd_config |
|
| 115 |
+ |
|
| 116 |
+sed -i 's/^#allow 192.168.0.0\/16/allow 62.44.96.0\/19\nallow 2001:67c:20d0::\/47/g' /etc/chrony.conf |
|
| 117 |
+sed -i "s/^pool 2.centos.pool.ntp.org iburst/server ntp0.nl.net iburst\nserver ntp1.nl.net iburst\nserver ntp2.nl.net iburst\nserver ntp0.ipv6.fau.de iburst\nserver ntp1.ipv6.fau.de iburst\nserver ntp2.ipv6.fau.de iburst\nserver ntp3.ipv6.fau.de iburst\nserver ntps1-0.uni-erlangen.de iburst\nserver ntps1-1.uni-erlangen.de iburst\nserver ntps1-2.uni-erlangen.de iburst/" /etc/chrony.conf |
|
| 118 |
+ |
|
| 119 |
+systemctl enable chronyd |
|
| 120 |
+ |
|
| 121 |
+%end |
|
| 122 |
+ |