Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Benjamin Graillot
scripts
Commits
9130adee
Commit
9130adee
authored
Dec 17, 2017
by
Hamza Dely
Browse files
L'accounting peut être désactivé via une variable d'environnement
parent
18b63786
Changes
1
Hide whitespace changes
Inline
Side-by-side
freeradius/3.0/auth.py
View file @
9130adee
...
...
@@ -30,6 +30,9 @@ from gestion.annuaires_pg import reverse, lieux_public
#: Serveur radius de test
TEST_SERVER
=
bool
(
os
.
getenv
(
'DBG_FREERADIUS'
,
False
))
#: Sur certains serveurs, on veut désactiver l'accounting
NO_ACCOUNTING
=
bool
(
os
.
getenv
(
'NO_ACCOUNTING'
,
False
))
#: Nombre maximal de tentatives lors de la connexion à un annuaire LDAP
LDAP_CONN_MAX_TRY
=
2
...
...
@@ -432,6 +435,9 @@ class RadiusEventHandler(object):
if
TEST_SERVER
:
logger
.
info
(
'[instantiate] DBG_FREERADIUS is enabled'
)
if
NO_ACCOUNTING
:
logger
.
info
(
'[instantiate] Accounting is disabled'
)
self
.
__is_running
=
True
self
.
__cache_cleaner
=
threading
.
Thread
(
target
=
self
.
__cleaner
)
logger
.
info
(
"[instantiate] Starting cleaner thread"
)
...
...
@@ -537,6 +543,10 @@ class RadiusEventHandler(object):
nas
=
request
.
get
(
'NAS-IP-Address'
,
request
.
get
(
'NAS-IPv6-Address'
,
None
))
mac
=
request
.
get
(
'Calling-Station-Id'
,
None
)
if
NO_ACCOUNTING
:
# On ne traite pas les requêtes d'accounting
return
radiusd
.
RLM_MODULE_OK
if
acct_status_type
==
ACCT_STATUS_TYPE_START
:
# Le NAS indique juste après avoir reçu un Access-Accept le début
# de la session : on garde une trace du couple MAC/Acct-Session-Id
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment