[X2Go-Commits] [x2gobroker] 01/05: Add basic support for pulling https_get authmech config from configuration file. (Fixes: #470).

git-admin at x2go.org git-admin at x2go.org
Thu Apr 3 12:24:54 CEST 2014


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2gobroker.

commit f635b147e196a112284014007746fa7c5d0ce2c6
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Apr 3 10:35:13 2014 +0200

    Add basic support for pulling https_get authmech config from configuration file. (Fixes: #470).
---
 debian/changelog                           |    2 ++
 etc/x2gobroker.conf                        |   12 ++++++++++++
 x2gobroker/authmechs/https_get_authmech.py |   16 ++++++++++++----
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d7350da..98e95f7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -151,6 +151,8 @@ x2gobroker (0.0.3.0-0x2go1) UNRELEASED; urgency=low
     - Add auth mechanism https_get. (Fixes: #450).
     - Change pre and post scripts to use common codebase across frontends. (Fixes: #469).
     - Add ability to have script run in select session after server is selected.
+    - Add basic support for pulling https_get authmech config from configuration file.
+      (Fixes: #470).
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Fri, 07 Jun 2013 23:25:30 +0200
 
diff --git a/etc/x2gobroker.conf b/etc/x2gobroker.conf
index 8dbab39..e51cc18 100644
--- a/etc/x2gobroker.conf
+++ b/etc/x2gobroker.conf
@@ -207,6 +207,17 @@
 # below value is the default.
 #default-agent-query-mode=NONE
 
+
+###
+### Auth Mechs section
+###
+
+#[authmech_https_get]
+#host = my.webserver.com
+#path = /auth/index.html
+#port = 443
+
+
 ###
 ### BACKEND section
 ###
@@ -251,3 +262,4 @@
 #group-search-filter = (&(objectClass=posifxGroup)(cn=*))
 #starttls = false
 #agent-query-mode = SSH
+
diff --git a/x2gobroker/authmechs/https_get_authmech.py b/x2gobroker/authmechs/https_get_authmech.py
index d8d1a99..d3817ed 100644
--- a/x2gobroker/authmechs/https_get_authmech.py
+++ b/x2gobroker/authmechs/https_get_authmech.py
@@ -35,19 +35,27 @@ import sys
 import httplib
 import base64
 import string
+import ConfigParser
+
+from x2gobroker.defaults import X2GOBROKER_CONFIG as _X2GOBROKER_CONFIG
 
 class X2GoBrokerAuthMech(object):
 
     def authenticate(self, username, password):
 
-        ## FIXME: these should really be specificed in config file
-        host = "my.webserver.com"
-        path = "/auth/index.html"
+        ## FIXME: these should really be specificed in master config file and have better error checking
+
+        config = ConfigParser.RawConfigParser()
+        config.read(_X2GOBROKER_CONFIG)
+
+        host = config.get('authmech_https_get','host')
+        path = config.get('authmech_https_get','path')
+        port = config.get('authmech_https_get','port')
 
         # base64 encode the username and password
         auth = base64.standard_b64encode('%s:%s' % (username, password)).replace('\n', '')
 
-        https = httplib.HTTPSConnection(host)
+        https = httplib.HTTPSConnection(host,port)
         https.putrequest("GET", path)
         https.putheader("Host", host)
         https.putheader("User-Agent", "x2go http auth")

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git



More information about the x2go-commits mailing list