While trying to clone a production stack for development I got a little paranoid and added some firewall rules to avoid some accidental communication between the stacks. Mainly my concern was about the poorly documented process for cloning as well as the poor use of VLAN”s in the client”s environment. Below is a quick and dirty way to add some IPF rules to Solaris 11.
Check current rules:
# ipfstat -ioempty list for ipfilter(out)empty list for ipfilter(in)Enable a custom policy:
# svccfg -s ipfilter:default setprop firewall_config_default/policy = astring: "custom"# svccfg -s ipfilter:default listprop firewall_config_default/policyfirewall_config_default/policy astring customCustom policy file:
# svccfg -s ipfilter:default setprop firewall_config_default/custom_policy_file = astring: "/etc/ipf/ipf.conf"# svccfg -s ipfilter:default listprop firewall_config_default/custom_policy_filefirewall_config_default/custom_policy_file astring /etc/ipf/ipf.confRun the firewall service:
# svcadm refresh ipfilter:default# svcs -a | grep ipfilterdisabled Sep_20 svc:/network/ipfilter:default
# svcs -xv svc:/network/ipfilter:defaultsvc:/network/ipfilter:default (IP Filter) State: disabled since September 20, 2013 12:21:20 PM PDTReason: Disabled by an administrator. See: http://support.oracle.com/msg/SMF-8000-05 See: man -M /usr/share/man -s 5 ipfilterImpact: This service is not running.
# svcadm enable svc:/network/ipfilter:default
# svcs -xv svc:/network/ipfilter:defaultsvc:/network/ipfilter:default (IP Filter) State: online since September 23, 2013 05:46:51 AM PDT See: man -M /usr/share/man -s 5 ipfilter See: /var/svc/log/network-ipfilter:default.logImpact: None.Some commands to check with:
# ipfstat |grep blocked input packets: blocked 0 passed 176 nomatch 176 counted 0 short 0output packets: blocked 0 passed 161 nomatch 161 counted 0 short 0 input packets logged: blocked 0 passed 0output packets logged: blocked 0 passed 0
# ipfstat -io |headempty list for ipfilter(out)empty list for ipfilter(in)Try adding a rule:
# echo "block in on ipmp1 proto tcp from 10.200.0.0/32 to any" | ipf -f -
# ipfstat -ioempty list for ipfilter(out)block in on ipmp1 proto tcp from 10.200.0.0/32 to anyOk that did nothing. Lets try a better mask.
# echo "block in on ipmp1 proto tcp from 10.200.0.0/16 to any" | ipf -f -# Timeout, server usli-dsdb-ag11.dev.asg.ad not responding.Hmm that worked. I dropped myself out. Nice.
Get in through the LDOM console and flush the rules:
# ipfstat -ioempty list for ipfilter(out)empty list for ipfilter(in)Trying a more realistic rule:
# echo "block in quick from 10.200.53.110/31 to any" | ipf -f -# ipfstat -ioblock in quick from 10.200.43.70/31 to anyYep that worked as my ping failed…
# ping 10.200.53.110Persistency:
# ipf -f /etc/ipf/ipf.conf
# tail /etc/ipf/ipf.conf## ipf.conf## IP Filter rules to be loaded during startup## See ipf(4) manpage for more information on# IP Filter rules syntax.I thought ipf -f should add it to the file but it did not. So I added manually and that worked after a reboot.
# tail -2 /etc/ipf/ipf.confblock in quick from 10.200.43.70/31 to anyblock in quick from 10.200.53.110/31 to anyReferences:
http://docs.oracle.com/cd/E23824\_01/html/821-1453/eubbd.html
http://docs.oracle.com/cd/E19253-01/816-4554/ezecx/index.html
http://docs.oracle.com/cd/E23824\_01/html/821-1453/ipfilter-admin-2.html#scrolltoc