Changeset 0608d96
- Timestamp:
- Feb 21, 2014 11:04:53 AM (11 years ago)
- Branches:
- master
- Children:
- ea0e8cb
- Parents:
- f1f9aec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/desktop_access.py
rf1f9aec r0608d96 75 75 if self.ospfd is None: 76 76 self.ospfd = '/usr/local/sbin/ospfd' 77 78 # If this is a linux box that will be NATing, the iptables value 79 # must be the path of the iptables command and the nat_interface must 80 # be the nat interface. 81 self.iptables = config.get('access', 'iptables') 82 self.nat_interface = config.get('access', 'nat_interface') 77 83 78 84 self.ssh_identity = None … … 407 413 print >>f, 'ifconfig tap0 %s netmask 255.255.255.0 up' % \ 408 414 my_addr 409 # self.set_route('10.0.0.0/8', f, exp_peer)410 415 print >>f, '%s -d -f %s' % (self.zebra, zebra_conf) 411 416 print >>f, '%s -d -f %s' % (self.ospfd, ospfd_conf) 417 if self.iptables is not None and self.nat_interface is not None: 418 print >>f, '%s -t nat -A POSTROUTING -o %s -j MASQUERADE' %\ 419 (self.iptables, self.nat_interface) 420 print >>f, ('%s -A FORWARD -i %s -o tap0 -m state ' + 421 '--state RELATED,ESTABLISHED -j ACCEPT') % \ 422 (self.iptables, self.nat_interface) 423 print >>f, '%s -A FORWARD -i tap0 -o %s -j ACCEPT' % \ 424 (self.iptables, self.nat_interface) 412 425 f.close() 413 426 os.chmod(cscript, 0755) 414 427 f = open(dscript, 'w') 415 428 print >>f, '#!/bin/sh' 429 if self.iptables is not None and self.nat_interface is not None: 430 print >>f, '%s -t nat -D POSTROUTING -o %s -j MASQUERADE' %\ 431 (self.iptables, self.nat_interface) 432 print >>f, ('%s -D FORWARD -i %s -o tap0 -m state ' + 433 '--state RELATED,ESTABLISHED -j ACCEPT') % \ 434 (self.iptables, self.nat_interface) 435 print >>f, '%s -D FORWARD -i tap0 -o %s -j ACCEPT' % \ 436 (self.iptables, self.nat_interface) 437 # Linux ? 416 438 print >>f, 'ifconfig tap0 destroy' 417 439 self.unset_route(peer, f) 418 #self.unset_route('10.0.0.0/8', f)419 440 print >>f, 'mv /etc/hosts.DETER.fedd.hold /etc/hosts' 420 441 print >>f, 'kill `cat /var/run/quagga/ospfd.pid`' 421 442 print >>f, 'kill `cat /var/run/quagga/zebra.pid`' 443 if self.iptables is not None and self.nat_interface is not None: 444 print >>f, '%s -t nat -D POSTROUTING -o %s -j MASQUERADE' %\ 445 (self.iptables, self.nat_interface) 446 print >>f, ('%s -D FORWARD -i %s -o tap0 -m state ' + 447 '--state RELATED,ESTABLISHED -j ACCEPT') % \ 448 (self.iptables, self.nat_interface) 449 print >>f, '%s -D FORWARD -i tap0 -o %s -j ACCEPT' % \ 450 (self.iptables, self.nat_interface) 422 451 f.close() 423 452 os.chmod(dscript, 0755)
Note: See TracChangeset
for help on using the changeset viewer.