Rev 51: Merge jelmer apache2+lerberos test server in file:///net/bigmamac/Volumes/home/vila/.bazaar/plugins/local_test_server/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Feb 20 14:35:06 GMT 2009


At file:///net/bigmamac/Volumes/home/vila/.bazaar/plugins/local_test_server/

------------------------------------------------------------
revno: 51
revision-id: v.ladeuil+lp at free.fr-20090220143505-lvmblqzl569358ah
parent: v.ladeuil+lp at free.fr-20090209130917-mmm5019gm67kcgo7
parent: jelmer at samba.org-20090217164704-ommgwc8h6tj07nqv
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: local_test_server
timestamp: Fri 2009-02-20 15:35:05 +0100
message:
  Merge jelmer apache2+lerberos test server
added:
  configs/apache2-krb5.conf      apache2krb5.conf-20090217145021-57o5t91njummyfh1-1
modified:
  config.py                      __init__.py-20080523170713-0c8mnxio9r41iyhk-1
  server.py                      server.py-20080524160639-rqhbexqatjqbwypw-1
  test_server.py                 test_server.py-20080530070615-f555godexnk7frms-1
  tests/test_utils.py            test_utils.py-20080603162150-w01001l902j0gu95-1
    ------------------------------------------------------------
    revno: 50.1.3
    revision-id: jelmer at samba.org-20090217164704-ommgwc8h6tj07nqv
    parent: jelmer at samba.org-20090217162548-sbyftp5yezubi9o5
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Tue 2009-02-17 17:47:04 +0100
    message:
      Add note about keytab, add test permutations.
    modified:
      configs/apache2-krb5.conf      apache2krb5.conf-20090217145021-57o5t91njummyfh1-1
      test_server.py                 test_server.py-20080530070615-f555godexnk7frms-1
    ------------------------------------------------------------
    revno: 50.1.2
    revision-id: jelmer at samba.org-20090217162548-sbyftp5yezubi9o5
    parent: jelmer at samba.org-20090217151008-vtfpxylz8tzvlrk1
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Tue 2009-02-17 17:25:48 +0100
    message:
      Make configuration more generic, fix authorization (authentication already worked).
    modified:
      configs/apache2-krb5.conf      apache2krb5.conf-20090217145021-57o5t91njummyfh1-1
    ------------------------------------------------------------
    revno: 50.1.1
    revision-id: jelmer at samba.org-20090217151008-vtfpxylz8tzvlrk1
    parent: v.ladeuil+lp at free.fr-20090209130917-mmm5019gm67kcgo7
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Tue 2009-02-17 16:10:08 +0100
    message:
      Add apache2 with mod-auth-kerb.
    added:
      configs/apache2-krb5.conf      apache2krb5.conf-20090217145021-57o5t91njummyfh1-1
    modified:
      config.py                      __init__.py-20080523170713-0c8mnxio9r41iyhk-1
      server.py                      server.py-20080524160639-rqhbexqatjqbwypw-1
      test_server.py                 test_server.py-20080530070615-f555godexnk7frms-1
      tests/test_utils.py            test_utils.py-20080603162150-w01001l902j0gu95-1
-------------- next part --------------
=== modified file 'config.py'
--- a/config.py	2009-02-09 13:09:17 +0000
+++ b/config.py	2009-02-17 15:10:08 +0000
@@ -153,6 +153,15 @@
         self.values['svn_dir'] = self.abspath('svn')
 
 
+class Apache2Kerberos(Apache2):
+
+    def __init__(self, _base_dir=None):
+        super(Apache2Kerberos, self).__init__(
+            'apache2-krb5',
+            required_dirs=self._required_dirs, _base_dir=_base_dir)
+        self.values['keytab'] = self.abspath('krb5.keytab')
+
+
 class Cherokee(HttpConfig):
 
     def __init__(self, _base_dir=None):

=== added file 'configs/apache2-krb5.conf'
--- a/configs/apache2-krb5.conf	1970-01-01 00:00:00 +0000
+++ b/configs/apache2-krb5.conf	2009-02-17 16:47:04 +0000
@@ -0,0 +1,58 @@
+#
+# Based on /etc/apache2/apache2.conf in Ubuntu Gusty
+#
+
+# This file will be interpolated by python see plugin source for
+# details.
+
+# Note that most of the directories below are usually owned by
+# root. We want directories writable by the user running the
+# tests.
+
+ServerRoot "%(base_dir)s"
+
+LockFile "%(var_lock_dir)s/accept.lock
+
+PidFile %(pid_file)s
+
+ErrorLog %(log_file)s
+LogFormat "%%h %%l %%u %%t \"%%r\" %%>s %%b \"%%{Referer}i\" \"%%{User-Agent}i\"" combined
+CustomLog %(var_log_dir)s/access.log combined
+LogLevel debug
+
+ServerName %(host)s
+Listen %(port)s
+
+# The following directives seems to activate the smallest apache2
+# server possible. If you know better, comments are very welcome.
+# More info at
+# http://localhost/doc/apache2-doc/manual/mod/worker.html
+StartServers         1
+MaxClients           5
+ThreadsPerChild      5
+
+# Tests will create symlinks in that directory to point to the
+# appropriate location
+DocumentRoot %(data_dir)s
+
+# required for
+#bzrlib.tests.test_transport_implementations.TransportTests.test_has_root_works
+LoadModule dir_module /usr/lib/apache2/modules/mod_dir.so
+LoadModule autoindex_module /usr/lib/apache2/modules/mod_autoindex.so
+
+# the following may help for debug
+ServerSignature On
+
+LoadModule auth_basic_module /usr/lib/apache2/modules/mod_auth_basic.so
+LoadModule auth_kerb_module /usr/lib/apache2/modules/mod_auth_kerb.so
+LoadModule authz_user_module /usr/lib/apache2/modules/mod_authz_user.so
+
+<Directory %(data_dir)s>
+	# The kerberos file has to be generated for the principal HTTP/%(host)s and 
+	# saved in %(keytab)s, accessible by the user running apache2.
+	Krb5Keytab %(keytab)s
+	KrbMethodNegotiate on
+	KrbMethodK5Passwd off
+	AuthType Kerberos
+	require valid-user
+</Directory>

=== modified file 'server.py'
--- a/server.py	2009-02-09 13:09:17 +0000
+++ b/server.py	2009-02-17 15:10:08 +0000
@@ -487,6 +487,15 @@
         self.output_config_path = self.config.abspath('etc/apache2-svn.conf')
 
 
+class Apache2Kerberos(Apache2):
+
+    def __init__(self, port, _conf=None):
+        if _conf is None:
+            _conf = config.Apache2Kerberos()
+        super(Apache2Kerberos, self).__init__(port, _conf=_conf)
+        self.output_config_path = self.config.abspath('etc/apache2-krb5.conf')
+
+
 class Cherokee(Server):
 
     _server_command_name = 'cherokee'
@@ -685,6 +694,7 @@
 _servers['apache2-dav'] = Apache2DAV(37003)
 _servers['lighttpd-dav'] = LighttpdDAV(37004)
 _servers['apache2-svn'] = Apache2SVN(37005)
+_servers['apache2-krb5'] = Apache2Kerberos(37006)
 #_servers['vsftpd'] = Vsftpd(37006)
 #_servers['proftpd'] = Proftpd(37007)
 _servers['apache2-https'] = Apache2HTTPS(37008)

=== modified file 'test_server.py'
--- a/test_server.py	2009-02-09 13:09:17 +0000
+++ b/test_server.py	2009-02-17 16:47:04 +0000
@@ -80,6 +80,11 @@
     _server_name = 'apache2-svn'
 
 
+class Apache2KerberosFeature(LocalTestServerFeature):
+
+    _server_name = 'apache2-krb5'
+
+
 class CherokeeFeature(LocalTestServerFeature):
 
     _server_name = 'cherokee'
@@ -244,6 +249,12 @@
     _url_protocol = 'http'
 
 
+class Apache2Kerberos(Apache2):
+
+    _server_name = 'apache2-krb5'
+    _url_protocol = 'http'
+
+
 class Cherokee(LocalHTTPTestServer):
 
     _server_name = 'cherokee'
@@ -335,6 +346,12 @@
     except errors.DependencyNotPresent:
         webdav_present = False
 
+    try:
+        import kerberos
+        kerberos_present = True
+    except ImportError:
+        kerberos_present = False
+
     permutations = []
     if Apache2Feature().available():
         permutations.append((HttpTransport_urllib, Apache2_urllib))
@@ -367,6 +384,10 @@
         if LighttpdDAVFeature().available():
             permutations.append((webdav.HttpDavTransport, LighttpdDAV))
 
+    if kerberos_present:
+        if Apache2KerberosFeature().available():
+            permutations.append((HttpTransport_urllib, Apache2Kerberos))
+
 #    if VsftpdFeature().available():
 #        permutations.append((FtpTransport, Vsftpd))
 #

=== modified file 'tests/test_utils.py'
--- a/tests/test_utils.py	2009-02-09 13:09:17 +0000
+++ b/tests/test_utils.py	2009-02-17 15:10:08 +0000
@@ -128,6 +128,13 @@
                 _server_feature_class=test_server.Apache2SVNFeature,
                 _test_server_class=test_server.Apache2SVN,
                 )),
+        ('apache2-krb5', dict(
+                _server_name='apache2-krb5',
+                _config_class=config.Apache2Kerberos,
+                _server_class=server.Apache2Kerberos,
+                _server_feature_class=test_server.Apache2KerberosFeature,
+                _test_server_class=test_server.Apache2Kerberos,
+                )),
         ('cherokee', dict(
                 _server_name='cherokee',
                 _config_class=config.Cherokee,



More information about the bazaar-commits mailing list