示例#1
0
 def openByPort(self, port):
     return ExecUtil.execCommandList(["iptables -A INPUT -p tcp --dport " + port + " -j ACCEPT",
                                      "iptables -A OUTPUT -p tcp --sport " + port + " -j ACCEPT"])
示例#2
0
 def limitIp(self, ip, port):
     return ExecUtil.execCommandList(["iptables -A INPUT -s " + ip + " -p tcp --dport " + port + " -j DROP"])
示例#3
0
 def dropAll(self):
     ExecUtil.execCommandList(
         ["iptables -P INPUT DROP", "iptables -P FORWARD DROP", "iptables -P OUTPUT DROP", "service iptables save "])
示例#4
0
 def openWeb(self):
     return ExecUtil.execCommandList(["iptables -A INPUT -p tcp --dport 80 -j ACCEPT",
                                      "iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT"])
示例#5
0
 def limitIp(self, ip, port):
     return ExecUtil.execCommandList([
         "iptables -A INPUT -s " + ip + " -p tcp --dport " + port +
         " -j DROP"
     ])
示例#6
0
 def openByPort(self, port):
     return ExecUtil.execCommandList([
         "iptables -A INPUT -p tcp --dport " + port + " -j ACCEPT",
         "iptables -A OUTPUT -p tcp --sport " + port + " -j ACCEPT"
     ])
示例#7
0
 def openWeb(self):
     return ExecUtil.execCommandList([
         "iptables -A INPUT -p tcp --dport 80 -j ACCEPT",
         "iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT"
     ])
示例#8
0
 def dropAll(self):
     ExecUtil.execCommandList([
         "iptables -P INPUT DROP", "iptables -P FORWARD DROP",
         "iptables -P OUTPUT DROP", "service iptables save "
     ])
示例#9
0
 def updateYumToAli(self):
     return ExecUtil.execCommandList(
         ["mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup",
          "wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo",
          "yum makecache"])