mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 06:25:34 +00:00
Move usermgr from "trunk/tools/" to "trunk/src/bin" according Jeremy's suggestion. usermgr can be installed now.
git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1272 e5f2f494-b856-4b98-b285-d166d9295462
This commit is contained in:
@@ -206,6 +206,7 @@ AC_CONFIG_FILES([Makefile
|
|||||||
src/bin/msgq/Makefile
|
src/bin/msgq/Makefile
|
||||||
src/bin/auth/Makefile
|
src/bin/auth/Makefile
|
||||||
src/bin/xfrin/Makefile
|
src/bin/xfrin/Makefile
|
||||||
|
src/bin/usermgr/Makefile
|
||||||
src/lib/Makefile
|
src/lib/Makefile
|
||||||
src/lib/cc/Makefile
|
src/lib/cc/Makefile
|
||||||
src/lib/python/Makefile
|
src/lib/python/Makefile
|
||||||
@@ -235,6 +236,8 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
|
|||||||
src/bin/bindctl/unittest/bindctl_test
|
src/bin/bindctl/unittest/bindctl_test
|
||||||
src/bin/loadzone/run_loadzone
|
src/bin/loadzone/run_loadzone
|
||||||
src/bin/loadzone/b10-loadzone.py
|
src/bin/loadzone/b10-loadzone.py
|
||||||
|
src/bin/usermgr/run_b10-cmdctl-usermgr.sh
|
||||||
|
src/bin/usermgr/b10-cmdctl-usermgr.py
|
||||||
src/bin/msgq/msgq.py
|
src/bin/msgq/msgq.py
|
||||||
src/bin/msgq/msgq_test
|
src/bin/msgq/msgq_test
|
||||||
src/bin/msgq/run_msgq.sh
|
src/bin/msgq/run_msgq.sh
|
||||||
@@ -252,9 +255,10 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
|
|||||||
chmod +x src/bin/bindctl/unittest/bindctl_test
|
chmod +x src/bin/bindctl/unittest/bindctl_test
|
||||||
chmod +x src/bin/bindctl/bindctl
|
chmod +x src/bin/bindctl/bindctl
|
||||||
chmod +x src/bin/loadzone/run_loadzone
|
chmod +x src/bin/loadzone/run_loadzone
|
||||||
|
chmod +x src/bin/usermgr/run_b10-cmdctl-usermgr.sh
|
||||||
chmod +x src/bin/msgq/run_msgq.sh
|
chmod +x src/bin/msgq/run_msgq.sh
|
||||||
chmod +x src/bin/msgq/msgq_test
|
chmod +x src/bin/msgq/msgq_test
|
||||||
chmod +x src/lib/dns/gen-rdatacode.py
|
chmod +x src/lib/dns/gen-rdatacode.py
|
||||||
chmod +x src/lib/dns/tests/testdata/gen-wiredata.py
|
chmod +x src/lib/dns/tests/testdata/gen-wiredata.py
|
||||||
])
|
])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
@@ -1 +1 @@
|
|||||||
SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin
|
SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin usermgr
|
||||||
|
13
src/bin/usermgr/Makefile.am
Normal file
13
src/bin/usermgr/Makefile.am
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||||
|
|
||||||
|
pkglibexec_SCRIPTS = b10-cmdctl-usermgr
|
||||||
|
|
||||||
|
b10_cmdctl_usermgrdir = $(DESTDIR)$(pkgdatadir)
|
||||||
|
|
||||||
|
CLEANFILES= b10-cmdctl-usermgr
|
||||||
|
|
||||||
|
# TODO: does this need $$(DESTDIR) also?
|
||||||
|
# this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix
|
||||||
|
b10-cmdctl-usermgr: b10-cmdctl-usermgr.py
|
||||||
|
$(SED) "s|@@PYTHONPATH@@|@pyexecdir@|" b10-cmdctl-usermgr.py >$@
|
||||||
|
chmod a+x $@
|
6
src/bin/usermgr/README
Normal file
6
src/bin/usermgr/README
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Create new account by running the following command:
|
||||||
|
|
||||||
|
b10-cmdctl-usermgr -f filename
|
||||||
|
|
||||||
|
If parameter '-f' is specified, new accounts will be appended to that file if it exists, or else the accounts will be saved in default file 'cmdctl-accounts.csv'.
|
||||||
|
|
@@ -1,3 +1,5 @@
|
|||||||
|
#!@PYTHON@
|
||||||
|
|
||||||
# Copyright (C) 2010 Internet Systems Consortium.
|
# Copyright (C) 2010 Internet Systems Consortium.
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, and distribute this software for any
|
# Permission to use, copy, modify, and distribute this software for any
|
||||||
@@ -15,7 +17,7 @@
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
This file implements user management program. The user name and
|
This file implements user management program. The user name and
|
||||||
its password is appended in csv file.
|
its password is appended to csv file.
|
||||||
'''
|
'''
|
||||||
import random
|
import random
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
@@ -25,7 +27,7 @@ import getopt
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION_NUMBER = 'bind10'
|
VERSION_NUMBER = 'bind10'
|
||||||
DEFAULT_FILE = 'passwd.csv'
|
DEFAULT_FILE = 'cmdctl-accounts.csv'
|
||||||
|
|
||||||
def gen_password_hash(password):
|
def gen_password_hash(password):
|
||||||
salt = "".join(chr(random.randint(33, 127)) for x in range(64))
|
salt = "".join(chr(random.randint(33, 127)) for x in range(64))
|
||||||
@@ -55,7 +57,7 @@ def save_userinfo(username, pw, salt, filename):
|
|||||||
writer = csv.writer(csvfile)
|
writer = csv.writer(csvfile)
|
||||||
writer.writerow([username, pw, salt])
|
writer.writerow([username, pw, salt])
|
||||||
csvfile.close()
|
csvfile.close()
|
||||||
print("add user success!")
|
print("\n create new account successfully! \n")
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print('''Usage: usermgr [options]
|
print('''Usage: usermgr [options]
|
||||||
@@ -103,7 +105,7 @@ def main():
|
|||||||
|
|
||||||
salt, pw = gen_password_hash(pwd1)
|
salt, pw = gen_password_hash(pwd1)
|
||||||
save_userinfo(name, pw, salt, filename)
|
save_userinfo(name, pw, salt, filename)
|
||||||
inputdata = input('continue by input \'y\' or \'Y\':')
|
inputdata = input('continue to create new account by input \'y\' or \'Y\':')
|
||||||
if inputdata not in ['y', 'Y']:
|
if inputdata not in ['y', 'Y']:
|
||||||
break
|
break
|
||||||
|
|
10
src/bin/usermgr/run_b10-cmdctl-usermgr.sh.in
Normal file
10
src/bin/usermgr/run_b10-cmdctl-usermgr.sh.in
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
PYTHON_EXEC=${PYTHON_EXEC:-@PYTHON@}
|
||||||
|
export PYTHON_EXEC
|
||||||
|
|
||||||
|
MYPATH_PATH=@abs_top_builddir@/src/bin/usermgr
|
||||||
|
|
||||||
|
cd ${MYPATH_PATH}
|
||||||
|
${PYTHON_EXEC} b10-cmdctl-usermgr
|
||||||
|
|
@@ -1,6 +0,0 @@
|
|||||||
Create user and its password by running the following command:
|
|
||||||
|
|
||||||
python3 usermgr.py [-f filename]
|
|
||||||
|
|
||||||
If no filename is specified in command line, the user and its password are saved in default file 'passwd.csv'.
|
|
||||||
|
|
Reference in New Issue
Block a user