Archived
Minor
This commit is contained in:
1 parent
92fe8b221f
commit
de823946b9
2 files changed
+8
-5
No files matched your search
@@ -55,13 +55,13 @@ def format_krb5_date(date):
|
||||
return formatted_date
|
||||
|
||||
|
||||
def kerberos_create_principal(user):
|
||||
principal = "{}@{}".format(user['username'], settings.KERBEROS_REALM)
|
||||
def kerberos_create_principal(username, password):
|
||||
principal = "{}@{}".format(username, settings.KERBEROS_REALM)
|
||||
kadmin_query = " -p '{}' -w {} -q 'add_principal {} -pw {}'".format(
|
||||
settings.KERBEROS_PASSWORD_CHANGING_PRINCIPAL,
|
||||
settings.KERBEROS_PASSWORD,
|
||||
principal,
|
||||
user['password'])
|
||||
password)
|
||||
p = Popen('kadmin' + kadmin_query, shell=True, stdout=PIPE, stderr=PIPE)
|
||||
output, error = p.communicate()
|
||||
if error:
|
||||
|
||||
@@ -14,6 +14,7 @@ from django.utils.http import urlsafe_base64_decode
|
||||
from django.views.decorators.cache import never_cache
|
||||
from django.views.decorators.debug import sensitive_post_parameters
|
||||
from django.views.generic import View
|
||||
import logging
|
||||
|
||||
from inside.models import InsideUser
|
||||
from neuf_kerberos.utils import kerberos_create_principal
|
||||
@@ -23,6 +24,8 @@ from neuf_radius.utils import radius_create_user
|
||||
from neuf_userinfo.forms import NewUserForm
|
||||
from neuf_userinfo.ssh import create_home_dir
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def index(request):
|
||||
if request.method == "POST":
|
||||
@@ -155,10 +158,10 @@ class AddNewUserView(View):
|
||||
'ldap_user': ldap_create_user(user),
|
||||
'homedir': create_home_dir(user['username']),
|
||||
'ldap_automount': ldap_create_automount(user['username']),
|
||||
'kerberos_principal': kerberos_create_principal(user),
|
||||
'kerberos_principal': kerberos_create_principal(user['username'], user['password']),
|
||||
'radius': radius_create_user(user['username'], user['password'])
|
||||
}
|
||||
import pprint; pprint.pprint(results)
|
||||
logger.debug(results)
|
||||
|
||||
return JsonResponse({'results': 'success'})
|
||||
|
||||
|
||||
Reference in new issue
Block a user