# 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
# 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=static --device=eth0 --gateway=62.44.98.3 --ip=62.44.98.6 --nameserver=62.44.96.143,62.44.96.142 --netmask=255.255.254.0 --ethtool="autoneg on" --ipv6=auto --activate
network --hostname=localhost.localdomain

# Root password
rootpw --iscrypted $6$aw9PyRtbligMIQnI$HM4.l48YyjlQadu3RCU4q9kuLXP0It8Mn/OFMc8susSbMxFSMaPMdYwQ1sNYZwAWGfHvhKYawllPXyXkzfJEt1
# System services
services --disabled="chronyd"
# System timezone
timezone Europe/Sofia --isUtc --nontp
# System bootloader configuration
bootloader --append="crashkernel=auto net.ifnames=0 biosdevname=0"

# Partition clearing information
zerombr
ignoredisk --only-use=sda,sdb
clearpart --all --initlabel
# Disk partitioning information
part biosboot --fstype="biosboot" --ondisk=sdb --size=1 
part biosboot --fstype="biosboot" --ondisk=sda --size=1
#part biosboot --fstype="biosboot" --noformat --onpart=sda1
#part biosboot --fstype="biosboot" --noformat --onpart=sdb1
part raid.01 --fstype="mdmember" --ondisk=sdb --size=513
part raid.03 --fstype="mdmember" --ondisk=sdb --size=513
part raid.05 --fstype="mdmember" --ondisk=sdb --size=4100
part raid.07 --fstype="mdmember" --ondisk=sdb --size=51232
part raid.09 --fstype="mdmember" --ondisk=sdb --size=1 --grow
part raid.02 --fstype="mdmember" --ondisk=sda --size=513
part raid.04 --fstype="mdmember" --ondisk=sda --size=513
part raid.06 --fstype="mdmember" --ondisk=sda --size=4100
part raid.08 --fstype="mdmember" --ondisk=sda --size=51232
part raid.10 --fstype="mdmember" --ondisk=sda --size=1 --grow
raid swap --device=md2 --fstype="swap" --level=RAID1 raid.05 raid.06
raid /boot/efi --device=md0 --fstype="efi" --level=RAID1 raid.01 raid.02
raid /boot --device=md1 --fstype="ext2" --level=RAID1 raid.03 raid.04
raid / --device=md3 --fstype="xfs" --level=RAID1 raid.07 raid.08
raid pv.01 --device=md4 --level=RAID1 raid.09 raid.10

volgroup MAILPHYS pv.01
logvol /storage --vgname="MAILPHYS" --size=1 --grow --name="storage" --fstype="xfs"

%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
