mirror of
https://github.com/dkmstr/openuds.git
synced 2024-12-22 13:34:04 +03:00
Added to linux actor capability to change passwords.. Unchecked anyway
This commit is contained in:
parent
c76d24c0f2
commit
4b58ec4345
@ -34,7 +34,7 @@ class MyDaemon(Daemon):
|
||||
time.sleep(4)
|
||||
|
||||
# We can get 'rename:newname', ''. Anything else is an error
|
||||
data = todo.split(':')
|
||||
data = todo.split('\r')
|
||||
|
||||
if data[0] == 'rename':
|
||||
logger.info('Renaming to {0}'.format(data[1]))
|
||||
@ -71,12 +71,12 @@ class MyDaemon(Daemon):
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) == 3:
|
||||
if 'login' == sys.argv[1]:
|
||||
logger.debug('Notifiyin login')
|
||||
logger.debug('Notify login')
|
||||
Rpc.initialize()
|
||||
Rpc.login(sys.argv[2])
|
||||
sys.exit(0)
|
||||
elif 'logout' == sys.argv[1]:
|
||||
logger.debug('Notifiyin logout')
|
||||
logger.debug('Notify logout')
|
||||
Rpc.initialize()
|
||||
Rpc.logout(sys.argv[2])
|
||||
sys.exit(0)
|
||||
|
@ -11,12 +11,22 @@ import logging, os
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def rename(newName):
|
||||
# If new name has "'\t'
|
||||
if '\t' in newName:
|
||||
newName, account, password = newName.split('\t')
|
||||
else:
|
||||
account = password = None
|
||||
|
||||
logger.debug('Debian renamer')
|
||||
|
||||
if account is not None:
|
||||
os.system('echo "{1}\n{1}" | /usr/bin/passwd {0} 2> /dev/null'.format(account, password))
|
||||
|
||||
f = open('/etc/hostname', 'w')
|
||||
f.write(newName)
|
||||
f.close()
|
||||
os.system('/bin/hostname %s' % newName)
|
||||
|
||||
|
||||
# add name to "hosts"
|
||||
f = open('/etc/hosts', 'r')
|
||||
lines = f.readlines()
|
||||
@ -28,8 +38,8 @@ def rename(newName):
|
||||
continue
|
||||
f.write(l)
|
||||
f.close()
|
||||
|
||||
|
||||
return True
|
||||
# All names in lower case
|
||||
renamers['debian'] = rename
|
||||
renamers['ubuntu'] = rename
|
||||
renamers['ubuntu'] = rename
|
||||
|
@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
|
||||
LOGIN_MSG = 'login'
|
||||
LOGOUT_MSG = 'logout'
|
||||
READY_MSG = 'ready'
|
||||
INFO_MSG = 'info'
|
||||
INFO_MSG = 'information'
|
||||
IP_MSG = 'ip'
|
||||
|
||||
class Rpc(object):
|
||||
|
Loading…
Reference in New Issue
Block a user