OpenVZ Container - Allow access from only one IP and disable all outbound traffic
Edit the container configuration and add the config
1
vi /etc/vz/conf/1123.conf
1
IPTABLES="iptable_filter iptable_mangle ipt_limit ipt_multiport ipt_tos ipt_TOS ipt_REJECT ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_LOG ipt_length ip_conntrack ip_conntrack_ftp ip_conntrack_irc ipt_conntrack ipt_state ipt_helper iptable_nat ip_nat_ftp ip_nat_irc ipt_REDIRECT"
Login to container and add IPtable rules for allow access from only one IP
1
2
3
4
iptables -A INPUT -s 192.168.160.1 -j ACCEPT
iptables -A OUTPUT -d 192.168.160.1 -j ACCEPT
iptables -P INPUT DROP
iptables -P OUTPUT DROP
This post is licensed under CC BY 4.0 by the author.