示例#1
0
def enabled():
    # amazon linux doesn't have iptables service installed by default,
    # which makes "chkconfig --list iptables" fail
    # update: amzn >= 6.4 doesn't allow installing iptables-services;
    # however, the latest version of iptables itself suits all our needs
    if linux.os["name"] == "Amazon":
        if linux.os["release"] == "6.3":
            pkgmgr.installed("iptables-services")
        else:  # 6.4 and higher
            # Upgrading iptables-1.4.18-1.16 to iptables-1.4.18-1.19 did
            # the job

            # Reverted: cannot reproduce the error
            # # We need to remove iptables first because it can be i686 version
            # # installed and installing x86_64 over it causes error
            # pkgmgr.remove("iptables")

            pkgmgr.latest("iptables")

    if linux.os['family'] in ('RedHat', 'Oracle'):
        try:
            out = redhat.chkconfig(list="iptables")[0]
            return bool(re.search(r"iptables.*?\s\d:on", out))
        except linux.LinuxError, e:
            if 'not referenced in any runlevel' in str(e):
                return False
            else:
                raise
示例#2
0
def enabled():
    # amazon linux doesn't have iptables service installed by default,
    # which makes "chkconfig --list iptables" fail
    # update: amzn >= 6.4 doesn't allow installing iptables-services;
    # however, the latest version of iptables itself suits all our needs
    if linux.os["name"] == "Amazon":
        if linux.os["release"] == "6.3":
            pkgmgr.installed("iptables-services")
        else:  # 6.4 and higher
            # Upgrading iptables-1.4.18-1.16 to iptables-1.4.18-1.19 did
            # the job

            # Reverted: cannot reproduce the error
            # # We need to remove iptables first because it can be i686 version
            # # installed and installing x86_64 over it causes error
            # pkgmgr.remove("iptables")

            pkgmgr.latest("iptables")

    if linux.os['family'] in ('RedHat', 'Oracle'):
        try:
            out = redhat.chkconfig(list="iptables")[0]
            return bool(re.search(r"iptables.*?\s\d:on", out))
        except linux.LinuxError, e:
            if 'not referenced in any runlevel' in str(e):
                return False
            else:
                raise
示例#3
0
def enabled():
    # amazon linux doesn't have iptables service installed by default,
    # which makes "chkconfig --list iptables" fail
    # update: amzn >= 6.4 doesn't allow installing iptables-services;
    # however, the latest version of iptables itself suits all or needs
    if linux.os["name"] == "Amazon":
        if linux.os["release"] == "6.3":
            pkgmgr.installed("iptables-services")
        else:  # 6.4 and higher
            # Upgrading iptables-1.4.18-1.16 to iptables-1.4.18-1.19 did
            # the job
            pkgmgr.latest("iptables")

    if linux.os['family'] in ('RedHat', 'Oracle'):
        out = redhat.chkconfig(list="iptables")[0]
        return bool(re.search(r"iptables.*?\s\d:on", out))
    else:
        return os.access(IPTABLES_BIN, os.X_OK)
示例#4
0
def enabled():
    # amazon linux doesn't have iptables service installed by default,
    # which makes "chkconfig --list iptables" fail
    # update: amzn >= 6.4 doesn't allow installing iptables-services;
    # however, the latest version of iptables itself suits all or needs
    if linux.os["name"] == "Amazon":
        if linux.os["release"] == "6.3":
            pkgmgr.installed("iptables-services")
        else:  # 6.4 and higher
            # Upgrading iptables-1.4.18-1.16 to iptables-1.4.18-1.19 did
            # the job
            pkgmgr.latest("iptables")

    if linux.os['family'] in ('RedHat', 'Oracle'):
        out = redhat.chkconfig(list="iptables")[0]
        return bool(re.search(r"iptables.*?\s\d:on", out))
    else:
        return os.access(IPTABLES_BIN, os.X_OK)
示例#5
0
def enabled():
	if linux.os['family'] in ('RedHat', 'Oracle'):
		out = redhat.chkconfig(list="iptables")[0]
		return bool(re.search(r"iptables.*?\s\d:on", out))
	else:
		return os.access(IPTABLES_BIN, os.X_OK)