Hello, I made a half paranoid (but easy to implement ) configuration for PVE on public IP.
disable NFS:
disable IPv6:
fail2ban
basic firewall rules
access to server with ssh root login
conclusion
With this configuration you only have SSH with brute force protection (fail2ban) running public. To administer your server you need an open SSH root session.
Don't disable NFS or IPv6 if you need it.
tips for more paranoid configuration:
- disable password login for SSH
- use VPN
- use port knocking
- change SSH port
- extend firewall rules
esco
disable NFS:
Code:
#vi "/etc/default/nfs-common"
NEED_STATD=no
Code:
#update-rc.d rpcbind disable
disable IPv6:
Code:
#vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="nomodeset ipv6.disable=1 quiet"
#vi /etc/postfix/main.cf
inet_protocols = ipv4
fail2ban
Code:
#aptitude install fail2ban
basic firewall rules
Code:
#vi /etc/network/if-up.d/firewall
#!/bin/bash
# local
iptables -C INPUT -i lo -j ACCEPT 2> /dev/null || iptables -A INPUT -i lo -j ACCEPT
# established
iptables -C INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT 2> /dev/null || iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# icmp
iptables -C INPUT -p icmp --icmp-type echo-request -j ACCEPT 2> /dev/null || iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
# ssh
iptables -C INPUT -p tcp --dport 22 -m state --state NEW -j ACCEPT 2> /dev/null || iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j ACCEPT
# block
iptables -C INPUT -j DROP 2> /dev/null || iptables -A INPUT -j DROP
access to server with ssh root login
Code:
cat .bash_profile |tail -n5
#############################################################################
#firewall exclude
iptables -C INPUT -s ${SSH_CLIENT%% *}/32 -j ACCEPT 2> /dev/null || iptables -I INPUT -s ${SSH_CLIENT%% *}/32 -j ACCEPT
#############################################################################
cat .bash_logout
########################################################
# delete firewall exclude
test $(netstat -an|grep ":22 " | grep ${SSH_CLIENT%% *} | wc -l) -le 1 && iptables -D INPUT -s ${SSH_CLIENT%% *}/32 -j ACCEPT
########################################################
conclusion
With this configuration you only have SSH with brute force protection (fail2ban) running public. To administer your server you need an open SSH root session.
Don't disable NFS or IPv6 if you need it.
tips for more paranoid configuration:
- disable password login for SSH
- use VPN
- use port knocking
- change SSH port
- extend firewall rules
esco