Below is the file 'client/plugins/iptables.py' from this revision. You can also download the file.


import os
from phonehome import urgency
from config import install_path

def run():
    # for now, just check that there are rules
    iptables_command = '/sbin/iptables -L INPUT -n'

    if os.access(os.path.join(install_path, 'etc', 'no_iptables_ok'), os.R_OK):
        return [(urgency['info'], 'skipped iptables check, no_firewall_ok found.')]

    fd = os.popen(iptables_command)
    result = fd.read()
    fd.close()

    line_count = len(result.split('\n'))
    if line_count > 3:
	return []
    else:
	return [(urgency['warning'], 'no iptables rules in chain "INPUT"')]