/usr/sbin/iptables -t filter -F
+/usr/sbin/iptables -t filter -P INPUT ACCEPT
+/usr/sbin/iptables -t filter -P OUTPUT ACCEPT
+/usr/sbin/iptables -t filter -P FORWARD ACCEPT
+
% for (index, rule) in enumerate(rules):
/usr/sbin/iptables -t filter \
-I ${rule.chain|s} ${index+1|s} \
# vim: set encoding=utf-8 et sw=4 sts=4 :
+import os
from os import path
+from signal import SIGTERM
from pymin.seqtools import Sequence
from pymin.dispatcher import Handler, handler, HandlerError
for name in names:
if name in self.conns:
if not self.conns[name]._running:
- call(('pon', name))
+ call(('pppd', 'call', name))
self.conns[name]._running = True
self._dump_attr('conns')
else:
if name in self.conns:
if self.conns[name]._running:
call(('poff', name))
+ if path.exists('/var/run/ppp-' + name + '.pid'):
+ pid = file('/var/run/ppp-' + name + '.pid').readline()
+ try:
+ os.kill(int(pid.strip()), SIGTERM)
+ except OSError:
+ pass # XXX report error?
self.conns[name]._running = False
self._dump_attr('conns')
else:
p.commit()
print p.conn.list()
print p.conn.show()
+
+updetach
% if conn.type != 'TUNNEL':
name ${conn.username}
file /etc/ppp/options.${conn.name}
ipparam ${conn.name}
+# pppoe has a lower mtu/mru
+mtu 1492
+mru 1492
+# switch off all compressions (this is a must)
+nopcomp
+# this is recommended
+novjccomp
+noccp
% else:
pty "pptp ${conn.server} --nolaunchpppd"
name ${conn.username}
+linkname ${conn.name}
% if conn.type == 'PPP':
lock ${conn.device}
% elif conn.type == 'OE':
__ALL__ = ('VrrpHandler',)
-pid_filename = 'vrrp.pid'
-
class VrrpHandler(Restorable, ParametersHandler, ReloadHandler, RestartHandler,
ServiceHandler, TransactionalHandler):
def _service_stop(self):
try:
+ pid_filename = 'vrrpd_%(dev)s_%(id)s.pid' % self.params
pid = file(path.join(self._pid_dir, pid_filename )).read().strip()
os.kill(int(pid), SIGTERM)
except (IOError, OSError):
if __name__ == '__main__':
v = VrrpHandler()
v.set('prio','10')
- v.commit()
\ No newline at end of file
+ v.commit()
+