lc_ldap.shortcuts
This commit is contained in:
parent
dc01a371dc
commit
0922e3c63b
8 changed files with 30 additions and 27 deletions
|
@ -5,13 +5,15 @@
|
|||
import os
|
||||
import sys
|
||||
sys.path.append('/usr/scripts/gestion')
|
||||
sys.path.append('/usr/scripts/lc_ldap')
|
||||
sys.path.append('/usr/scripts/')
|
||||
|
||||
from config import NETs, blacklist_sanctions, blacklist_sanctions_soft, blacklist_bridage_upload, mac_komaz, mac_titanic, adm_users, accueil_route
|
||||
|
||||
import pwd
|
||||
import config.firewall
|
||||
import lc_ldap
|
||||
import lc_ldap.shortcuts
|
||||
import lc_ldap.objets
|
||||
import lc_ldap.attributs
|
||||
import socket
|
||||
from ipset import IpsetError, Ipset
|
||||
from iptools import AddrInNet, NetSubnets, IpSubnet, NetInNets
|
||||
|
@ -87,9 +89,9 @@ class firewall_base(object) :
|
|||
blacklisted = [ machine for machine in conn.search("blacklist=*",sizelimit=4096) if machine.blacklist_actif() ]
|
||||
self._blacklisted_machines = set()
|
||||
for item in blacklisted:
|
||||
if isinstance(item, lc_ldap.proprio):
|
||||
if isinstance(item, lc_ldap.objets.proprio):
|
||||
self._blacklisted_machines = self._blacklisted_machines.union(item.machines())
|
||||
elif isinstance(item, lc_ldap.machine):
|
||||
elif isinstance(item, lc_ldap.objets.machine):
|
||||
self._blacklisted_machines.add(item)
|
||||
else:
|
||||
print >> sys.stderr, 'Objet %s inconnu blacklisté' % a.__class__.__name__
|
||||
|
@ -206,7 +208,7 @@ class firewall_base(object) :
|
|||
sys.exit(1)
|
||||
|
||||
# Connection à la base ldap
|
||||
conn = lc_ldap.lc_ldap_admin()
|
||||
conn = lc_ldap.shortcuts.lc_ldap_admin()
|
||||
|
||||
self.reloadable = {
|
||||
'blacklist_hard' : self.blacklist_hard,
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
import sys
|
||||
sys.path.append('/usr/scripts/')
|
||||
sys.path.append('/usr/scripts/gestion')
|
||||
sys.path.append('/usr/scripts/lc_ldap')
|
||||
sys.path.append('/usr/scripts/')
|
||||
|
||||
import cranslib.deprecated
|
||||
cranslib.deprecated.module()
|
||||
|
@ -44,13 +44,11 @@ from iptools import AddrInNet, NetSubnets, IpSubnet
|
|||
from config import NETs, mac_komaz, mac_wifi, mac_titanic, p2p, vlans, debit_max_radin, adm_users, accueil_route, blacklist_sanctions, blacklist_sanctions_soft, periode_transitoire
|
||||
import config.firewall
|
||||
from ipset import IpsetError, Ipset
|
||||
from lc_ldap import lc_ldap
|
||||
from ipt import gethostbyname
|
||||
syslog.openlog('firewall')
|
||||
|
||||
debug = 1
|
||||
db = crans_ldap()
|
||||
QUERY=lc_ldap(uri='ldap://ldap.adm.crans.org/')
|
||||
|
||||
class IptablesError(Exception):
|
||||
""" Gestion des erreurs d'iptables """
|
||||
|
|
|
@ -9,14 +9,14 @@ import hashlib
|
|||
from socket import gethostname
|
||||
from netifaces import interfaces, ifaddresses, AF_INET
|
||||
|
||||
sys.path.append('/usr/scripts/lc_ldap')
|
||||
sys.path.append('/usr/scripts/')
|
||||
sys.path.append('/usr/scripts/gestion')
|
||||
sys.path.append('/etc/crans/secrets/')
|
||||
|
||||
import lc_ldap
|
||||
import lc_ldap.shortcuts
|
||||
import config
|
||||
|
||||
conn=lc_ldap.lc_ldap_admin()
|
||||
conn = lc_ldap.shortcuts.lc_ldap_admin()
|
||||
|
||||
ssh_algo = config.sshfp_algo.keys()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue