[X2Go-Commits] x2gobroker.git - tmp (branch) updated: 0.0.0.1-66-g2813264

X2Go dev team git-admin at x2go.org
Tue Apr 23 21:08:49 CEST 2013


The branch, tmp has been updated
       via  2813264ea2724e15c3bd82722fb2eb5dc1447553 (commit)
      from  74acb0d029a9d94f01251274f939425b0bf9d6b3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 sbin/x2gobroker-pubkeyauthorizer |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

The diff of changes is:
diff --git a/sbin/x2gobroker-pubkeyauthorizer b/sbin/x2gobroker-pubkeyauthorizer
index 2dc9dd4..66ad1ce 100755
--- a/sbin/x2gobroker-pubkeyauthorizer
+++ b/sbin/x2gobroker-pubkeyauthorizer
@@ -90,17 +90,24 @@ if __name__ == '__main__':
         logger_error.error('Cannot proceed without having an URL specified. Use --broker-url as cmdline parameter. Exiting...')
         sys.exit(-2)
 
+    broker_uid = x2gobroker.defaults.X2GOBROKER_DAEMON_USER
+    broker_uidnumber = getpwnam(broker_uid).pw_uid
+    broker_gid = x2gobroker.defaults.X2GOBROKER_DAEMON_GROUP
+    broker_gidnumber = getgrnam(broker_gid).gr_gid
+    broker_home = x2gobroker.defaults.X2GOBROKER_HOME
+
     if not os.path.exists(broker_home):
         logger_error.error('The home directory {home} of user {user} does not exists. Cannot continue. Exiting...'.format(home=broker_home, user=broker_uid))
         sys.exit(-2)
 
     logger_broker.info('Authorizing access to this X2Go server for X2Go Session Broker at URL {url}'.format(url=cmdline_args.broker_url))
 
+
     if not os.path.exists('{home}/.ssh'.format(home=broker_home)):
         os.mkdir('{home}/.ssh'.format(home=broker_home))
         os.chown('{home}/.ssh'.format(home=broker_home), broker_uidnumber, broker_gidnumber)
         os.chmod('{home}/.ssh'.format(home=broker_home), 0750)
-        logger_broker.info('  Created {home}/.ssh'.format(home=broker_home)
+        logger_broker.info('  Created {home}/.ssh'.format(home=broker_home))
 
     # FIXME: this probably needs some sanity checks(?)
     tmpfile_name, httpmsg = urllib.urlretrieve(cmdline_args.broker_url)
@@ -111,27 +118,27 @@ if __name__ == '__main__':
     tmpfile.close()
 
     try:
-        read_authorized_keys = open('{home}/.ssh/authorized_keys'.format(home=x2gobroker.defaults.X2GOBROKER_HOME), 'rb')
+        read_authorized_keys = open('{home}/.ssh/authorized_keys'.format(home=broker_home), 'rb')
         already_authorized_keys = read_authorized_keys.read().split('\n')
         read_authorized_keys.close()
     except IOError:
         already_authorized_keys = []
 
-    append_authorized_keys = open('{home}/.ssh/authorized_keys'.format(home=x2gobroker.defaults.X2GOBROKER_HOME), 'ab')
+    append_authorized_keys = open('{home}/.ssh/authorized_keys'.format(home=broker_home), 'ab')
 
     i = 0
     for new_pubkey in new_pubkeys:
         i += 1
         if new_pubkey not in already_authorized_keys:
             append_authorized_keys.write('{k}\n'.format(k=new_pubkey))
-            logger_broker.info('  Adding new public key (counter={i}) to {authorized_keys}.'.format(i=i, authorized_keys='{home}/.ssh/authorized_keys'.format(home=x2gobroker.defaults.X2GOBROKER_HOME)))
+            logger_broker.info('  Adding new public key (counter={i}) to {authorized_keys}.'.format(i=i, authorized_keys='{home}/.ssh/authorized_keys'.format(home=broker_home)))
         else:
-            logger_broker.warning('  Skipping new public key (counter={i}), already in {authorized_keys}.'.format(i=i, authorized_keys='{home}/.ssh/authorized_keys'.format(home=x2gobroker.defaults.X2GOBROKER_HOME)))
+            logger_broker.warning('  Skipping new public key (counter={i}), already in {authorized_keys}.'.format(i=i, authorized_keys='{home}/.ssh/authorized_keys'.format(home=broker_home)))
 
     append_authorized_keys.close()
 
     # set proper file permissions
-    os.chown('{home}/.ssh/authorized_keys'.format(home=x2gobroker.defaults.X2GOBROKER_HOME), getpwnam(x2gobroker.defaults.X2GOBROKER_DAEMON_USER).pw_uid, getgrnam(x2gobroker.defaults.X2GOBROKER_DAEMON_GROUP).gr_gid)
-    os.chmod('{home}/.ssh/authorized_keys'.format(home=x2gobroker.defaults.X2GOBROKER_HOME), 0644)
+    os.chown('{home}/.ssh/authorized_keys'.format(home=broker_home), broker_uidnumber, broker_gidnumber)
+    os.chmod('{home}/.ssh/authorized_keys'.format(home=broker_home), 0644)
 
     logger_broker.info('Completed successfully: X2Go Session Broker\'s PubKey Authorizer.'.format(url=cmdline_args.broker_url))


hooks/post-receive
-- 
x2gobroker.git (HTTP(S) Session broker for X2Go)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2gobroker.git" (HTTP(S) Session broker for X2Go).




More information about the x2go-commits mailing list