# System authorization information
auth --enableshadow --passalgo=sha512
# Use graphical install
text
repo --name="AppStream" --mirrorlist="http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream"
repo --name="EPEL" --mirrorlist="https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64"
# Use network installation
url --mirrorlist="http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=BaseOS"
# Run the Setup Agent on first boot
firstboot --disable
ignoredisk --only-use=vda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
# Agree to EULA
eula --agreed
# Reboot after completing the installation
reboot

# Network information
network  --bootproto=dhcp --device=eth0 --ethtool="autoneg on" --ipv6=auto --activate
network  --hostname=localhost.localdomain

# Root password
rootpw --iscrypted $6$kJIeWX4dyBYrrYOL$iMmUIn7dsZkqBs8Bi0orwQbghjJtk1N7z7BRkq9aUYhY1QN3oWAMuvhf3mgq/wanoqJ9Qcev4J5W3mDcRGK0L0
# System services
services --disabled="chronyd"
# System timezone
timezone Europe/Sofia --isUtc --nontp
# System bootloader configuration
bootloader --append="crashkernel=auto net.ifnames=0 biosdevname=0" --location=mbr --boot-drive=vda

# Partition clearing information
zerombr
clearpart --all --initlabel --drives=vda
# Disk partitioning information
part /boot --fstype="ext2" --ondisk=vda --size=512
part swap --fstype="swap" --ondisk=vda --size=2048
part / --fstype="xfs" --ondisk=vda --size=21264

%packages
@^minimal-environment
kexec-tools
bind
bind-chroot
bind-utils
tcpdump
traceroute
mc
telnet
vim
dnf-automatic
nmap
rpcbind
wget
ftp
lftp
rsync
unzip
zip
iptraf-ng
epel-release
bird
fail2ban
fail2ban-systemd
chrony
%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=10 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=10 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=10 --minquality=1 --notstrict --nochanges --notempty
%end

%post

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

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

sed -i "s/apply_updates = no/apply_updates = yes/g" /etc/dnf/automatic.conf

systemctl enable --now dnf-automatic.timer

systemctl enable named-chroot

systemctl enable --now fail2ban

cat << EOF >> /etc/fail2ban/jail.d/01-sshd.conf
[DEFAULT]
# Ban hosts for one hour:
bantime = 3600

[sshd]
enabled = true
EOF

echo "net.ipv4.tcp_timestamps = 0" > /etc/sysctl.d/01-tcp-timestamp.conf

sed -i 's/\#compress/compress/g' /etc/logrotate.conf

%end
