(self, port)
| 799 | self.rules = [] |
| 800 | |
| 801 | def allowPort(self, port): |
| 802 | status = False |
| 803 | try: |
| 804 | status = bash("iptables-save|grep INPUT|grep -w %s"%port).isSuccess() |
| 805 | except: |
| 806 | pass |
| 807 | |
| 808 | if not status: |
| 809 | redo = False |
| 810 | result = True |
| 811 | try: |
| 812 | result = bash("iptables -I INPUT -p tcp -m tcp --dport %s -j ACCEPT"%port).isSuccess() |
| 813 | except: |
| 814 | redo = True |
| 815 | |
| 816 | if not result or redo: |
| 817 | bash("sleep 30") |
| 818 | bash("iptables -I INPUT -p tcp -m tcp --dport %s -j ACCEPT"%port) |
| 819 | |
| 820 | def config(self): |
| 821 | try: |