mirror of
https://github.com/dkmstr/openuds.git
synced 2025-02-08 05:57:39 +03:00
fixed actor logout persistent & x2go authorize script
This commit is contained in:
parent
43fbfdab3d
commit
359857b9b3
@ -398,7 +398,9 @@ class Logout(ActorV3Action):
|
|||||||
if osManager:
|
if osManager:
|
||||||
if osManager.isRemovableOnLogout(userService):
|
if osManager.isRemovableOnLogout(userService):
|
||||||
logger.debug('Removable on logout: %s', osManager)
|
logger.debug('Removable on logout: %s', osManager)
|
||||||
userService.remove()
|
userService.remove()
|
||||||
|
else:
|
||||||
|
userService.remove()
|
||||||
|
|
||||||
return ActorV3Action.actorResult('ok')
|
return ActorV3Action.actorResult('ok')
|
||||||
|
|
||||||
|
@ -42,17 +42,17 @@ def updateAuthorizedKeys(user, pubKey):
|
|||||||
|
|
||||||
authorizedKeys = '{}/authorized_keys'.format(sshFolder)
|
authorizedKeys = '{}/authorized_keys'.format(sshFolder)
|
||||||
try:
|
try:
|
||||||
with open(authorizedKeys, 'r') as f:
|
with open(authorizedKeys, 'rb') as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
except Exception:
|
except Exception:
|
||||||
lines = []
|
lines = []
|
||||||
|
|
||||||
with open(authorizedKeys, 'w') as f:
|
with open(authorizedKeys, 'wb') as f:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if 'UDS@X2GOCLIENT' not in line and line.strip():
|
if 'UDS@X2GOCLIENT' not in line and line.strip():
|
||||||
f.write(line)
|
f.write(line)
|
||||||
# Append pubkey
|
# Append pubkey
|
||||||
f.write(six.binary_type('ssh-rsa {} UDS@X2GOCLIENT\n'.format(pubKey)))
|
f.write('ssh-rsa {} UDS@X2GOCLIENT\n'.format(pubKey).encode())
|
||||||
|
|
||||||
# Ensure access is correct
|
# Ensure access is correct
|
||||||
os.chown(authorizedKeys, uid, -1)
|
os.chown(authorizedKeys, uid, -1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user