auth.py: ajout de tests pour le filaire
This commit is contained in:
parent
526e57788a
commit
4a0bdcc42e
2 changed files with 37 additions and 1 deletions
|
@ -294,7 +294,7 @@ def post_auth_wifi(data):
|
||||||
@radius_event
|
@radius_event
|
||||||
def post_auth_fil(data):
|
def post_auth_fil(data):
|
||||||
"""Idem, mais en filaire.
|
"""Idem, mais en filaire.
|
||||||
Pas testé."""
|
"""
|
||||||
|
|
||||||
port, vlan_name, reason = decide_vlan(data, False)
|
port, vlan_name, reason = decide_vlan(data, False)
|
||||||
mac = data.get('Calling-Station-Id', None)
|
mac = data.get('Calling-Station-Id', None)
|
||||||
|
|
36
freeradius/test_fil.py
Executable file
36
freeradius/test_fil.py
Executable file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/bash /usr/scripts/python.sh
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import auth
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
delattr(sys, 'argv')
|
||||||
|
|
||||||
|
#if len(sys.argv) < 2 and False:
|
||||||
|
# print "Give me a mac !"
|
||||||
|
# sys.exit(1)
|
||||||
|
|
||||||
|
# Machine à s'authentifier (cerveaulent)
|
||||||
|
#p=(('Calling-Station-Id', sys.argv[1]),)
|
||||||
|
|
||||||
|
auth.instantiate(())
|
||||||
|
|
||||||
|
p=(
|
||||||
|
# Mac qui existe:
|
||||||
|
#('Calling-Station-Id', '1c:75:08:16:dc:03'),
|
||||||
|
# Mac qui n'existe pas, mais en se mettant sur la chambre d'un adhérent
|
||||||
|
# possédant une machine en mac=<automatique>
|
||||||
|
('Calling-Station-Id', '1c:75:08:16:dc:04'),
|
||||||
|
#('User-Name', 'moo-torola'),
|
||||||
|
('NAS-Identifier', 'batg-0'),
|
||||||
|
('NAS-Port', '20'),
|
||||||
|
)
|
||||||
|
|
||||||
|
print repr(auth.authorize_fil(p))
|
||||||
|
print "wait for 3s, tu peux aller crasher le serveur pg ou ldap"
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
print repr(auth.post_auth_fil(p))
|
Loading…
Add table
Add a link
Reference in a new issue