freeradius: déplace tous les tests dans subdir
This commit is contained in:
parent
d36ceb7e3d
commit
132636e7f9
4 changed files with 14 additions and 0 deletions
58
freeradius/testing/radiusd.py
Normal file
58
freeradius/testing/radiusd.py
Normal file
|
@ -0,0 +1,58 @@
|
|||
#! /usr/bin/env python
|
||||
#
|
||||
# Definitions for RADIUS programs
|
||||
#
|
||||
# Copyright 2002 Miguel A.L. Paraz <mparaz@mparaz.com>
|
||||
#
|
||||
# This should only be used when testing modules.
|
||||
# Inside freeradius, the 'radiusd' Python module is created by the C module
|
||||
# and the definitions are automatically created.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
# from modules.h
|
||||
|
||||
RLM_MODULE_REJECT = 0
|
||||
RLM_MODULE_FAIL = 1
|
||||
RLM_MODULE_OK = 2
|
||||
RLM_MODULE_HANDLED = 3
|
||||
RLM_MODULE_INVALID = 4
|
||||
RLM_MODULE_USERLOCK = 5
|
||||
RLM_MODULE_NOTFOUND = 6
|
||||
RLM_MODULE_NOOP = 7
|
||||
RLM_MODULE_UPDATED = 8
|
||||
RLM_MODULE_NUMCODES = 9
|
||||
|
||||
|
||||
# from radiusd.h
|
||||
L_DBG = 1
|
||||
L_AUTH = 2
|
||||
L_INFO = 3
|
||||
L_ERR = 4
|
||||
L_PROXY = 5
|
||||
L_CONS = 128
|
||||
|
||||
OP={ '{':2, '}':3, '(':4, ')':5, ',':6, ';':7, '+=':8, '-=':9, ':=':10,
|
||||
'=':11, '!=':12, '>=':13, '>':14, '<=':15, '<':16, '=~':17, '!~':18, '=*':19, '!*':20,
|
||||
'==':21 , '#':22 }
|
||||
|
||||
OP_TRY = (':=', '+=', '-=', '=' )
|
||||
|
||||
def resolve(*lines):
|
||||
tuples = []
|
||||
for line in lines:
|
||||
for op in OP_TRY:
|
||||
arr = line.rsplit(op)
|
||||
if len(arr)==2:
|
||||
tuples.append((str(arr[0].strip()),OP[op],str(arr[1].strip())))
|
||||
break
|
||||
return tuple(tuples)
|
||||
|
||||
# log function
|
||||
def radlog(level, msg):
|
||||
import sys
|
||||
sys.stdout.write(msg + '\n')
|
||||
|
||||
level = level
|
||||
|
||||
|
31
freeradius/testing/test.py
Executable file
31
freeradius/testing/test.py
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/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(())
|
||||
|
||||
# Test avec l'interface wifi d'apprentis
|
||||
p=(
|
||||
('Calling-Station-Id', '02:69:75:42:24:03'),
|
||||
('User-Name', 'apprentis-wifi'),
|
||||
)
|
||||
|
||||
print repr(auth.authorize_wifi(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_wifi(p))
|
36
freeradius/testing/test_fil.py
Executable file
36
freeradius/testing/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))
|
14
freeradius/testing/test_inner
Executable file
14
freeradius/testing/test_inner
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Teste le inner-tunnel en se connectant directement au serveur
|
||||
|
||||
MAC=apprentis-wifi
|
||||
PASSWORD=p74dj3ipwd
|
||||
SECRET=`PYTHONPATH=/etc/crans/secrets/ python -c \
|
||||
"import secrets; print secrets.radius_eap_key"`
|
||||
NAS_NAME=atree.wifi.crans.org
|
||||
#SERVER=127.0.0.1
|
||||
SERVER=pea.v6.wifi.crans.org
|
||||
SERVER=138.231.136.35
|
||||
SERVER=[2a01:240:fe3d:c04:0:70ff:fe65:6103]
|
||||
radtest -t mschap -x -6 $MAC $PASSWORD $SERVER 18 $SECRET $SECRET $NAS_NAME
|
Loading…
Add table
Add a link
Reference in a new issue