Archived
Radius dry run
This commit is contained in:
1 parent
1cefe1ebef
commit
a5b84c62a3
2 files changed
+12
-3
No files matched your search
+11
-2
@@ -1,7 +1,12 @@
|
||||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
import logging
|
||||
from passlib.hash import nthash
|
||||
|
||||
from neuf_radius.models import Radcheck
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def radius_create(raw_password):
|
||||
return nthash.encrypt(raw_password)
|
||||
@@ -26,6 +31,10 @@ def set_radius_password(username, raw_password):
|
||||
radius_user.save()
|
||||
|
||||
|
||||
def radius_create_user(username, password):
|
||||
set_radius_password(username, password)
|
||||
def radius_create_user(username, password, dry_run=False):
|
||||
if not dry_run:
|
||||
set_radius_password(username, password)
|
||||
else:
|
||||
logger.debug('Setting radius password for \'{}\''.format(username))
|
||||
|
||||
return True
|
||||
@@ -30,7 +30,7 @@ def add_new_user(user, dry_run=False):
|
||||
# Needs raw password
|
||||
if user.get('password'):
|
||||
# kerberos_create_principal(user['username'], user['password']), # FIXME disabled
|
||||
radius_create_user(user['username'], user['password'])
|
||||
radius_create_user(user['username'], user['password'], dry_run=dry_run)
|
||||
|
||||
"""
|
||||
Rijndael stuff, thank you SO!
|
||||
|
||||
Reference in new issue
Block a user