1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-02-02 09:47:13 +03:00

fixed actor logout persistent & x2go authorize script

This commit is contained in:
Adolfo Gómez García 2020-04-01 14:08:49 +02:00
parent 43fbfdab3d
commit 359857b9b3
2 changed files with 6 additions and 4 deletions

View File

@ -398,7 +398,9 @@ class Logout(ActorV3Action):
if osManager:
if osManager.isRemovableOnLogout(userService):
logger.debug('Removable on logout: %s', osManager)
userService.remove()
userService.remove()
else:
userService.remove()
return ActorV3Action.actorResult('ok')

View File

@ -42,17 +42,17 @@ def updateAuthorizedKeys(user, pubKey):
authorizedKeys = '{}/authorized_keys'.format(sshFolder)
try:
with open(authorizedKeys, 'r') as f:
with open(authorizedKeys, 'rb') as f:
lines = f.readlines()
except Exception:
lines = []
with open(authorizedKeys, 'w') as f:
with open(authorizedKeys, 'wb') as f:
for line in lines:
if 'UDS@X2GOCLIENT' not in line and line.strip():
f.write(line)
# 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
os.chown(authorizedKeys, uid, -1)