Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 204aedafdb | |||
| e0e9b49bf9 | |||
| f271c7716b | |||
| 0b14d9c2c3 | |||
| 603d1f6bc8 |
@@ -1,6 +1,6 @@
|
|||||||
# proxmox-zfs-postinstall
|
# proxmox-zfs-postinstall
|
||||||
|
|
||||||
This script installs and configures basic tools for running a Proxmox Server.
|
This script installs and configures basic tools for running a new Proxmox Server (Version 8+).
|
||||||
Following settings are made:
|
Following settings are made:
|
||||||
- Install and configure zfs-auto-snapshot
|
- Install and configure zfs-auto-snapshot
|
||||||
- Switch pve-enterprise/pve-no-subscription/pvetest repo
|
- Switch pve-enterprise/pve-no-subscription/pvetest repo
|
||||||
@@ -15,16 +15,16 @@ Following settings are made:
|
|||||||
- SSH server hardening
|
- SSH server hardening
|
||||||
- Install checkzfs
|
- Install checkzfs
|
||||||
- Install bashclub-zsync
|
- Install bashclub-zsync
|
||||||
|
- Install virtio-win ISO
|
||||||
- Create zfspool storage for swap disks if not exists
|
- Create zfspool storage for swap disks if not exists
|
||||||
- Adjust default volblocksize for Proxmox zfspool storage
|
- Adjust default volblocksize for Proxmox zfspool storage
|
||||||
- Configure proxmox mail delivery with postfix
|
- Configure proxmox mail delivery proxmox notifications (pve8)
|
||||||
- Daily check (and download) for new stable virtio-win iso and prune old (unused) versions
|
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
Just download and execute the script, all settings are made interactively.
|
Just download and execute the script, all settings are made interactively.
|
||||||
```
|
```
|
||||||
wget -O ./postinstall --no-cache https://github.com/bashclub/proxmox-zfs-postinstall/raw/dev/postinstall
|
wget -O ./postinstall --no-cache https://github.com/bashclub/proxmox-zfs-postinstall/raw/main/postinstall
|
||||||
bash ./postinstall
|
bash ./postinstall
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+26
-12
@@ -522,22 +522,36 @@ pve_conf_backup(){
|
|||||||
harden_ssh(){
|
harden_ssh(){
|
||||||
if [ $ssh_hardening -gt 0 ]; then
|
if [ $ssh_hardening -gt 0 ]; then
|
||||||
log "Hardening ssh server"
|
log "Hardening ssh server"
|
||||||
rm /etc/ssh/ssh_host_*
|
|
||||||
log "Creating new SSH host keys"
|
log "Creating backup of current SSH config"
|
||||||
ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N "" > /dev/null 2>&1
|
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak.$(date +%F-%H%M%S)
|
||||||
ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N "" > /dev/null 2>&1
|
|
||||||
log "Creating new SSH moduli"
|
rm -f /etc/ssh/ssh_host_*
|
||||||
|
ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N "" > /dev/null
|
||||||
|
ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N "" > /dev/null
|
||||||
|
|
||||||
|
if [ $(awk '$5 >= 3071' /etc/ssh/moduli | wc -l) -gt 0 ]; then
|
||||||
awk '$5 >= 3071' /etc/ssh/moduli > /etc/ssh/moduli.safe
|
awk '$5 >= 3071' /etc/ssh/moduli > /etc/ssh/moduli.safe
|
||||||
mv /etc/ssh/moduli.safe /etc/ssh/moduli
|
mv /etc/ssh/moduli.safe /etc/ssh/moduli
|
||||||
|
|
||||||
log "Writing hardened SSH config"
|
|
||||||
if [[ $VERSION_CODENAME == "bookworm" ]]; then
|
|
||||||
echo -e "\n# Restrict key exchange, cipher, and MAC algorithms, as per sshaudit.com\n# hardening guide.\nKexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,gss-curve25519-sha256-,diffie-hellman-group16-sha512,gss-group16-sha512-,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256\nCiphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr\nMACs hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com\nHostKeyAlgorithms ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-256-cert-v01@openssh.com" > /etc/ssh/sshd_config.d/ssh-audit_hardening.conf
|
|
||||||
elif [[ $VERSION_CODENAME == "bullseye" ]]; then
|
|
||||||
sed -i 's/^\#HostKey \/etc\/ssh\/ssh_host_\(rsa\|ed25519\)_key$/HostKey \/etc\/ssh\/ssh_host_\1_key/g' /etc/ssh/sshd_config
|
|
||||||
echo -e echo -e "\n# Restrict key exchange, cipher, and MAC algorithms, as per sshaudit.com\n# hardening guide.\nKexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256\nCiphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr\nMACs hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com\nHostKeyAlgorithms ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com" > /etc/ssh/sshd_config.d/ssh-audit_hardening.conf
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
INCLUDE_LINE="Include /etc/ssh/sshd_config.d/*.conf"
|
||||||
|
grep -qxF "$INCLUDE_LINE" /etc/ssh/sshd_config || echo "$INCLUDE_LINE" >> /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
cat << EOF > /etc/ssh/sshd_config.d/ssh-audit_hardening.conf
|
||||||
|
# Hardening profile by bashclub.org
|
||||||
|
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
|
||||||
|
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com
|
||||||
|
MACs hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com
|
||||||
|
HostKeyAlgorithms ssh-ed25519,rsa-sha2-512
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if sshd -t; then
|
||||||
systemctl restart ssh.service
|
systemctl restart ssh.service
|
||||||
|
else
|
||||||
|
echo "Fehlerhafte SSH-Konfiguration erkannt. Bitte prüfen: /etc/ssh/sshd_config.d/ssh-audit_hardening.conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user