#!/usr/bin/env python # -*- coding: iso-8859-1 -*- # The author of this code is Manuel Sabban # # Copyright (c) 2004 Manuel Sabban. # # Permission to use, copy, and modify this software with or without fee # is hereby granted, provided that this entire notice is included in # all source code copies of any software which is or includes a copy or # modification of this software. # # THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR # IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY # REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE # MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR # PURPOSE. """ Firewall de Komaz """ import sys,os import iptools,config from classe_firewall import * from ldap_crans import crans_ldap def usage(): """ Vérifie le contenu et le contenant des arguments de la ligne de commande. En cas d'appel correct, appelle les fonctions de classe_firewall.py """ fw=firewall() db=crans_ldap() if len(sys.argv) < 2: raise ErrorArgument,"Il faut au moins deux arguments." try: i=1 if len(sys.argv) >= 2: if ((sys.argv[1]=="start")or(sys.argv[1]=="restart"))\ and(len(sys.argv)==2): fw.stop() try: fw.start() except KeyboardInterrupt: fw.stop() print "Firewall arrêté." elif ((sys.argv[1]=="stop")and(len(sys.argv)==2)): fw.stop() else: while (i