[X2Go-Commits] x2gobroker.git - tmp (branch) updated: 9d21d6fd245e25e7bbb2cb8caf9cfc316b10017a

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


The branch, tmp has been updated
       via  9d21d6fd245e25e7bbb2cb8caf9cfc316b10017a (commit)
      from  d4db450e2514f71b0fed5e465f77267a84ea1fe8 (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:
 .../x2gobroker-singlenodes-sessionprofiles.conf    |  179 --------------------
 .../x2gobroker-singlenodes-sessionprofilesmap.conf |   17 --
 etc/x2gobroker-sessionprofiles.conf                |  145 ++++++++++++++++
 x2gobroker/backends/base.py                        |   23 ++-
 x2gobroker/backends/inifile.py                     |   98 +++++++++++
 x2gobroker/backends/loadbalancer.py                |   33 ----
 x2gobroker/backends/singlenodes.py                 |   36 ----
 x2gobroker/config.py                               |   23 ---
 x2gobroker/web/plain.py                            |    2 +-
 9 files changed, 258 insertions(+), 298 deletions(-)
 delete mode 100644 etc/broker/x2gobroker-singlenodes-sessionprofiles.conf
 delete mode 100644 etc/broker/x2gobroker-singlenodes-sessionprofilesmap.conf
 create mode 100644 etc/x2gobroker-sessionprofiles.conf
 create mode 100644 x2gobroker/backends/inifile.py
 delete mode 100644 x2gobroker/backends/loadbalancer.py
 delete mode 100644 x2gobroker/backends/singlenodes.py

The diff of changes is:
diff --git a/etc/broker/x2gobroker-singlenodes-sessionprofiles.conf b/etc/broker/x2gobroker-singlenodes-sessionprofiles.conf
deleted file mode 100644
index d72a68b..0000000
--- a/etc/broker/x2gobroker-singlenodes-sessionprofiles.conf
+++ /dev/null
@@ -1,179 +0,0 @@
-[siteA-serverA-GNOME]
-user=
-defsndport=true
-useiconv=false
-iconvfrom=UTF-8
-height=600
-export=
-quality=9
-fullscreen=false
-layout=
-useexports=true
-width=800
-speed=2
-soundsystem=pulse
-print=true
-type=auto
-sndport=4713
-xinerama=true
-variant=
-usekbd=true
-fstunnel=true
-applications=TERMINAL,WWWBROWSER,MAILCLIENT,OFFICE
-host=server-a.site-a.local
-multidisp=false
-sshproxyport=22
-sound=true
-rootless=false
-name=GNOME - siteA+serverA
-iconvto=UTF-8
-soundtunnel=true
-command=GNOME
-dpi=96
-sshport=22
-setdpi=0
-pack=16m-jpeg
-
-[siteA-serverA-KDE]
-user=
-defsndport=true
-useiconv=false
-iconvfrom=UTF-8
-height=600
-export=
-quality=9
-fullscreen=false
-layout=
-useexports=true
-width=800
-speed=2
-soundsystem=pulse
-print=true
-type=auto
-sndport=4713
-xinerama=true
-variant=
-usekbd=true
-fstunnel=true
-applications=TERMINAL,WWWBROWSER,MAILCLIENT,OFFICE
-host=server-a.site-a.local
-multidisp=false
-sshproxyport=22
-sound=true
-rootless=false
-name=GNOME - siteA+serverA
-iconvto=UTF-8
-soundtunnel=true
-command=GNOME
-dpi=96
-sshport=22
-setdpi=0
-pack=16m-jpeg
-
-[siteA-serverB-GNOME]
-user=
-defsndport=true
-useiconv=false
-iconvfrom=UTF-8
-height=600
-export=
-quality=9
-fullscreen=false
-layout=
-useexports=true
-width=800
-speed=2
-soundsystem=pulse
-print=true
-type=auto
-sndport=4713
-xinerama=true
-variant=
-usekbd=true
-fstunnel=true
-applications=TERMINAL,WWWBROWSER,MAILCLIENT,OFFICE
-host=server-b.site-a.local
-multidisp=false
-sshproxyport=22
-sound=true
-rootless=false
-name=GNOME - siteA+serverB
-iconvto=UTF-8
-soundtunnel=true
-command=GNOME
-dpi=96
-sshport=22
-setdpi=0
-pack=16m-jpeg
-
-[siteB-serverA-LXDE]
-user=
-defsndport=true
-useiconv=false
-iconvfrom=UTF-8
-height=600
-export=
-quality=9
-fullscreen=false
-layout=
-useexports=true
-width=800
-speed=2
-soundsystem=pulse
-print=true
-type=auto
-sndport=4713
-xinerama=true
-variant=
-usekbd=true
-fstunnel=true
-applications=TERMINAL,WWWBROWSER,MAILCLIENT,OFFICE
-host=server-a.site-b.local
-multidisp=false
-sshproxyport=22
-sound=true
-rootless=false
-name=LXDE - siteB+serverA
-iconvto=UTF-8
-soundtunnel=true
-command=LXDE
-dpi=96
-sshport=22
-setdpi=0
-pack=16m-jpeg
-
-[siteC-serverA-XFCE]
-user=
-defsndport=true
-useiconv=false
-iconvfrom=UTF-8
-height=600
-export=
-quality=9
-fullscreen=false
-layout=
-useexports=true
-width=800
-speed=2
-soundsystem=pulse
-print=true
-type=auto
-sndport=4713
-xinerama=true
-variant=
-usekbd=true
-fstunnel=true
-applications=TERMINAL,WWWBROWSER,MAILCLIENT,OFFICE
-host=server-a.site-c.local
-multidisp=false
-sshproxyport=22
-sound=true
-rootless=false
-name=XFCE - siteC+serverA
-iconvto=UTF-8
-soundtunnel=true
-command=XFCE
-dpi=96
-sshport=22
-setdpi=0
-pack=16m-jpeg
diff --git a/etc/broker/x2gobroker-singlenodes-sessionprofilesmap.conf b/etc/broker/x2gobroker-singlenodes-sessionprofilesmap.conf
deleted file mode 100644
index be1e4e9..0000000
--- a/etc/broker/x2gobroker-singlenodes-sessionprofilesmap.conf
+++ /dev/null
@@ -1,17 +0,0 @@
-[siteA-serverA-GNOME]
-allow=@gnomegroup, at admingroup,adminuser
-client_subnet=<site-A/netmask-A>
-
-[siteA-serverA-KDE]
-allow-login=@gnomegroup, at admingroup,adminuser
-allow-connect=<site-A/netmask-A>,<homeoffice-IP-A>
-
-[siteA-serverB-GNOME]
-users=
-users=@
-
-[siteB-serverA-LXDE]
-users=
-
-[siteC-serverA-XFCE]
-users=
diff --git a/etc/x2gobroker-sessionprofiles.conf b/etc/x2gobroker-sessionprofiles.conf
new file mode 100644
index 0000000..2e7568e
--- /dev/null
+++ b/etc/x2gobroker-sessionprofiles.conf
@@ -0,0 +1,145 @@
+### X2Go Broker Session Profiles - ADAPT TO YOUR NEEDS ###
+
+# This whole file reflects a set of examplary X2Go session profiles being provided
+# via the X2Go Session Broker (backend: iniconf).
+
+# This whole file could be the broker setup in some university institute that runs
+# three server pools (pool-A, pool-B and pool-C). Though most univerities have
+# real IPv4 internet addresses, we use private subnets in the examples below.
+
+# The X2Go Session Broker is served into the institutes local intranet, the
+# broker cannot be reached from the internet directly.
+
+# The first section [DEFAULTS] provides a set of default profile settings that
+# are common to all session profiles given in sections below.
+
+# The other section names can be freely chosen, however, each section name has to
+# be unique within this file.
+
+[DEFAULTS]
+defsndport=true
+useiconv=false
+iconvfrom=UTF-8
+height=600
+export=
+quality=9
+fullscreen=false
+layout=
+useexports=true
+width=800
+speed=2
+soundsystem=pulse
+print=true
+type=auto
+sndport=4713
+xinerama=true
+variant=
+usekbd=true
+fstunnel=true
+applications=TERMINAL,WWWBROWSER,MAILCLIENT,OFFICE
+multidisp=false
+sshproxyport=22
+sound=true
+rootless=false
+iconvto=UTF-8
+soundtunnel=true
+dpi=96
+sshport=22
+setdpi=0
+pack=16m-jpeg
+
+## 
+## pool-A (staff servers)
+##
+## The pool-A contains three X2Go Servers (server-A, server-B and server-C).
+
+## The staff of our example institute falls into two groups of users: gnome-users and kde-users.
+## The gnome-users log into server-A or server-B, depending on their client subnet (IP configuration of the client).
+## The kde-users login to server-C (server-C can be reached from the whole intranet).
+##
+## The split-up of the GNOME users allows some primitive load balancing.
+##
+## If staff people are members of both groups (kde-users, gnome-users) both session profiles will be
+## shown in X2Go Client.
+##
+
+[pool-A-server-A]
+user=
+host=server-a.pool-a.domain.local
+name=GNOME - pool-A (srv-A)
+command=GNOME
+acl-users-deny=ALL
+acl-groups-allows=gnome-users,admins
+acl-clients-deny=ALL
+acl-clients-allow=10.1.0.0/16
+acl-any-order=deny-allow
+
+[pool-A-server-B]
+user=
+host=server-b.pool-a.domain.local
+name=GNOME - pool-A (srv-B)
+command=GNOME
+acl-users-deny=ALL
+acl-groups-allow=gnome-users,admins
+acl-clients-deny=ALL
+acl-clients-allow=10.2.0.0/16
+acl-any-order=deny-allow
+
+[pool-A-server-C]
+user=
+host=server-c.pool-a.domain.local
+name=KDE - pool-A (srv-C)
+command=KDE
+acl-users-deny=ALL
+acl-groups-allow=kde-users,admins
+acl-any-order=deny-allow
+
+##
+## pool-B (e.g. webserver in the DMZ or on the internet)
+##
+## The pool-B is a single X2Go Server (server-D) that is
+## hosted externally. The server-D has an official internet IP.
+##
+## The session profile for server-D shall be provided to the
+## admins group only.
+##
+## Furthermore, the session profile for server-D shall only get
+## offered to a member of the admins group if the admin is sitting
+## in front of one of the admin client machines.
+##
+
+[pool-B-server-D-LXDE]
+user=
+host=server-d.domain.internet
+name=LXDE - srv-D
+command=LXDE
+acl-users-deny=ALL
+acl-groups-allow=admins
+acl-clients-deny=ALL
+acl-clients-allow=admin-machine1.domain.local, admin-machine2.domain.local, admin-machine3.domain.local
+acl-any-order=deny-allow
+
+##
+## pool-C
+##
+## The pool-C is a server pool for students. Our example institute
+## knows 200-300 students and has to offer working places for
+## every student.
+##
+## The resource limits on these servers are pretty strict, so staff members
+## normally stay away from these machines, anyway. Only two test account
+## get this session profile into their X2Go Clients.
+##
+## The pool-C contains 6 X2Go Servers that serve all students users together as a load balance
+## server farm.
+##
+
+[pool-C-XFCE]
+user=
+host=s-E1.pool-c.domain.local,s-E2.pool-c.domain.local,s-E3.pool-c.domain.local,s-E4.pool-c.domain.local,s-E5.pool-c.domain.local,s-E6.pool-c.domain.local
+name=XFCE - pool-C
+command=XFCE
+acl-users-deny=ALL
+acl-users-allow=test-A,test-B
+acl-groups-allow=students,admins
+acl-any-order=deny-allow
diff --git a/x2gobroker/backends/base.py b/x2gobroker/backends/base.py
index 06b7150..8b2cbb3 100644
--- a/x2gobroker/backends/base.py
+++ b/x2gobroker/backends/base.py
@@ -40,19 +40,20 @@ class X2GoBroker(object):
 
     Currently available broker classes are::
         L{zeroconf.X2GoBroker} (working)
-        L{simple.X2GoBroker} (in prep)
+        L{inifile.X2GoBroker} (in prep)
         L{ldap.X2GoBroker} (in prep)
-        L{loadbalancer.X2GoBroker} (in prep)
 
     """
 
+    backend_name = 'base'
+
     def __init__(self, config_file="/etc/x2go/x2gobroker.conf"):
         """\
         Initialize a new X2GoBroker instance to control X2Go session through an
         X2Go Client with an intermediate session broker.
 
         """
-        self.config = x2gobroker.config.X2GoBrokerConfigFile()
+        self.config = x2gobroker.config.X2GoBrokerConfigFile(config_files=config_file)
 
         self._dynamic_authid_map = {}
 
@@ -63,6 +64,13 @@ class X2GoBroker(object):
         """
         pass
 
+    def is_enabled(self):
+        """\
+        Check if this backend has been enabled in the configuration file.
+
+        """
+        return self.config.get_value(self.backend_name, 'enable')
+
     def get_global_config(self):
         """\
         Get the global section of the configuration file.
@@ -71,20 +79,17 @@ class X2GoBroker(object):
         @rtype: C{dict}
 
         """
-        return self.config.get_global_config()
+        return self.config.get_section('global')
 
-    def get_backend_config(self, backend='zeroconf'):
+    def get_backend_config(self):
         """\
         Get the configuration section of a specific backend.
 
-        @param backend: the name of the backend
-        @type backend: C{str}
-
         @return: all backend configuration parameters
         @rtype: C{dict}
 
         """
-        return self.config.get_backend_config(backend=backend)
+        return self.config.get_section(self.backend_name)
 
     def get_backend_value(self, backend='zeroconf', option='enabled'):
         """\
diff --git a/x2gobroker/backends/inifile.py b/x2gobroker/backends/inifile.py
new file mode 100644
index 0000000..a030b14
--- /dev/null
+++ b/x2gobroker/backends/inifile.py
@@ -0,0 +1,98 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2012 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# Copyright (C) 2012 by Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>
+#
+# X2Go Session Broker is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# X2Go Session Broker is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+"""\
+X2goBrokerINIFILE class - a simple X2GoBroker implementations that uses text-based config files only
+and does not support load balancing.
+
+"""
+__NAME__ = 'x2gobroker-pylib'
+
+# modules
+
+# Python X2GoBroker modules
+import base
+import x2gobroker.config
+
+class X2GoBroker(base.X2GoBroker):
+    """\
+
+    """
+class X2GoBroker(base.X2GoBroker):
+
+    backend_name = 'inifile'
+
+    def __init__(self, profile_config='/etc/x2go/x2gobroker-sessionprofiles.conf', **kwargs):
+        """\
+
+        @param config_file: path to the X2Go Session Broker configuration file (x2gobroker.conf)
+        @type config_file: C{unicode}
+        @param profile_config: path to the backend's session profile configuration (x2gobroker-sessionprofiles.conf)
+        @type profile_config: C{unicode} 
+        """
+        if kwargs.has_key('profile_config'):
+            _profile_config = kwargs['profile_config']
+        self.profile_config = x2gobroker.config.X2GoBrokerConfigFile(config_files=_profile_config)
+
+    def get_profile_ids(self):
+        """\
+        Retrieve the complete list of session profile IDs.
+
+        @return: list of profile IDs
+        @rtype: C{list}
+
+        """
+        return self.profile_config.sections()
+
+    def get_profile_defaults(self):
+        """\
+        Get the session profile defaults, i.e. profile options that all
+        configured session profiles have in common.
+
+        @return: a dictionary containing the session profile defaults
+        @rtype: C{dict}
+
+        """
+        return self.profile_config.get_section('DEFAULTS')
+
+    def get_profile_config(self, profile_id):
+        """\
+        Get the session profile for profile ID <profile_id>.
+
+        @param profile_id: the ID of a profile, in other words the section name in the configuration file
+        @type profile_id: C{unicode}
+
+        @return: a dictionary representing the session profile for ID <profile_id>
+        @rtype: C{dict}
+
+        """
+        return self.profile_config.get_section(profile_id)
+
+    def list_profiles(self, username):
+
+
+        return list_of_profiles
+
+    def select_profile(self, profile_name):
+
+        selectprofile_output = {
+            'server': 'localhost:22',
+        }
+        return selectprofile_output
\ No newline at end of file
diff --git a/x2gobroker/backends/loadbalancer.py b/x2gobroker/backends/loadbalancer.py
deleted file mode 100644
index 6be2f18..0000000
--- a/x2gobroker/backends/loadbalancer.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (C) 2012 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
-# Copyright (C) 2012 by Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>
-#
-# X2Go Session Broker is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# X2Go Session Broker is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-
-"""\
-X2goBrokerLOADBALANCER class - a simple load balancer example for n X2Go Server with the same session profile
-
-"""
-__NAME__ = 'x2gobroker-pylib'
-
-# modules
-import x2gobroker.base
-
-class X2GoBroker(x2gobroker.base.X2GoBroker):
-    """\
-
-    """
diff --git a/x2gobroker/backends/singlenodes.py b/x2gobroker/backends/singlenodes.py
deleted file mode 100644
index 3ab4554..0000000
--- a/x2gobroker/backends/singlenodes.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (C) 2012 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
-# Copyright (C) 2012 by Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>
-#
-# X2Go Session Broker is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# X2Go Session Broker is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-
-"""\
-X2goBrokerSINGLENODES class - a simple X2GoBroker implementations that uses text-based config files only
-and does not support load balancing.
-
-"""
-__NAME__ = 'x2gobroker-pylib'
-
-# modules
-
-# Python X2GoBroker modules
-import base
-
-class X2GoBroker(base.X2GoBroker):
-    """\
-
-    """
diff --git a/x2gobroker/config.py b/x2gobroker/config.py
index 99531ae..51524d8 100644
--- a/x2gobroker/config.py
+++ b/x2gobroker/config.py
@@ -272,29 +272,6 @@ class X2GoBrokerConfigFile(object):
 
         return _section_config
 
-    def get_global_config(self):
-        """\
-        Get the global section of the configuration file.
-
-        @return: all global configuration parameters
-        @rtype: C{dict}
-
-        """
-        return self.get_section('global')
-
-    def get_backend_config(self, backend='zeroconf'):
-        """\
-        Get the configuration section of a specific backend.
-
-        @param backend: the name of the backend
-        @type backend: C{str}
-
-        @return: all backend configuration parameters
-        @rtype: C{dict}
-
-        """
-        return self.get_section(backend)
-
     @property
     def printable_config_file(self):
         """\
diff --git a/x2gobroker/web/plain.py b/x2gobroker/web/plain.py
index a05a4cb..d64f0ae 100644
--- a/x2gobroker/web/plain.py
+++ b/x2gobroker/web/plain.py
@@ -56,7 +56,7 @@ class X2GoBrokerWebPlain:
         global_config = broker_backend.get_global_config()
         backend_config = broker_backend.get_backend_config(backend)
 
-        if not backend_config['enable']:
+        if not broker_backend.is_enabled():
             return web.notfound()
 
         data = web.input()


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