summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authormakkalot <makkalot@gmail.com>2008-06-15 18:25:53 +0300
committermakkalot <makkalot@gmail.com>2008-06-15 18:25:53 +0300
commit9419566c1968db33b1d9d50ba02921c5bbe98c16 (patch)
tree772180c82ea2bb64d92f5e4acb8790d4af8e7290 /func
parent3cf6b38bfcfef04d6c537df79be2d8d90a5fc80b (diff)
downloadthird_party-func-9419566c1968db33b1d9d50ba02921c5bbe98c16.tar.gz
third_party-func-9419566c1968db33b1d9d50ba02921c5bbe98c16.tar.xz
third_party-func-9419566c1968db33b1d9d50ba02921c5bbe98c16.zip
export iptables method arguments
Diffstat (limited to 'func')
-rw-r--r--func/minion/modules/iptables/port.py85
1 files changed, 85 insertions, 0 deletions
diff --git a/func/minion/modules/iptables/port.py b/func/minion/modules/iptables/port.py
index 370123b..3d3902b 100644
--- a/func/minion/modules/iptables/port.py
+++ b/func/minion/modules/iptables/port.py
@@ -128,6 +128,91 @@ class Port(func_module.FuncModule):
clear_all("-D OUTPUT -p %s --%sport %s -d %s -j REJECT" % (prot, dir, port, ip) )
return call_if_policy("OUTPUT", "DROP", "-I OUTPUT -p %s --%sport %s -d %s -j ACCEPT" % (prot, dir, port, ip) )
+ def register_method_args(self):
+ """
+ Export the methods and their definitons
+ """
+ #they are all same so just declare here
+ port={
+ 'type':'string',
+ 'optional':False,
+
+ }
+ ip={
+ 'type':'string',
+ 'optional':False,
+ 'default':'0.0.0.0'
+ }
+ prot={
+ 'type':'string',
+ 'options':['tcp','udp','icmp','sctp'],
+ 'default':'tcp',
+ 'optional':False
+ }
+ dir={
+ 'type':'string',
+ 'default':'dst',
+ 'options':['src','dst'],
+ 'optional':False
+ }
+
+ return {
+ 'drop_from':{'args':
+ {
+ 'ip':ip,
+ 'prot':prot,
+ 'dir':dir,
+ 'port':port
+ }
+ },
+ 'reject_from':{'args':
+ {
+ 'ip':ip,
+ 'prot':prot,
+ 'dir':dir,
+ 'port':port
+
+ }
+ },
+ 'accept_from':{'args':
+ {
+ 'ip':ip,
+ 'prot':prot,
+ 'dir':dir,
+ 'port':port
+
+ }
+ },
+ 'drop_to':{'args':
+ {
+ 'ip':ip,
+ 'prot':prot,
+ 'dir':dir,
+ 'port':port
+
+ }
+ },
+ 'reject_to':{'args':
+ {
+ 'ip':ip,
+ 'prot':prot,
+ 'dir':dir,
+ 'port':port
+
+ }
+ },
+ 'accept_to':{'args':
+ {
+ 'ip':ip,
+ 'prot':prot,
+ 'dir':dir,
+ 'port':port
+
+ }
+ },
+
+ }
+
def parse_dir(dir):
if (dir == "dst"):
return "d"