Initial mod_waklog support
authorAdam Chlipala <adamc@hcoop.net>
Tue, 10 Apr 2007 03:03:05 +0000 (03:03 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Tue, 10 Apr 2007 03:03:05 +0000 (03:03 +0000)
configDefault/apache.cfg
configDefault/apache.csg
src/configTypes.sml [new file with mode: 0644]
src/main.sml
src/plugins/apache.sml
src/sources

index 33ca610..7181b49 100644 (file)
@@ -1,5 +1,7 @@
 structure Apache :> APACHE_CONFIG = struct
 
+open ConfigTypes
+
 val reload = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache"
 val down = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache-down"
 val undown = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache-undown"
@@ -10,8 +12,8 @@ val undown1 = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache1.3-undown"
 
 val confDir = "/var/domtool/vhosts"
 
-val webNodes_all = [("mire", true)]
-val webNodes_admin = [("deleuze", false)]
+val webNodes_all = [("mire", {version = APACHE_1_3, auth = MOD_WAKLOG})]
+val webNodes_admin = [("deleuze", {version = APACHE_2, auth = NO_AUTH})]
 
 val webNodes_default = ["mire"]
 
index 0491805..b0b8d11 100644 (file)
@@ -10,8 +10,8 @@ signature APACHE_CONFIG = sig
 
     val confDir : string
 
-    val        webNodes_all : (string * bool) list
-    val webNodes_admin : (string * bool) list
+    val        webNodes_all : (string * ConfigTypes.apache_info) list
+    val webNodes_admin : (string * ConfigTypes.apache_info) list
     val webNodes_default : string list
 
     val proxyTargets : string list
diff --git a/src/configTypes.sml b/src/configTypes.sml
new file mode 100644 (file)
index 0000000..a92bb76
--- /dev/null
@@ -0,0 +1,34 @@
+(* HCoop Domtool (http://hcoop.sourceforge.net/)
+ * Copyright (c) 2007, Adam Chlipala
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *)
+
+(* Datatypes to use in configuration (config.sml et al.) *)
+
+structure ConfigTypes = struct
+
+datatype apache_version =
+        APACHE_1_3
+       | APACHE_2
+
+datatype apache_auth_scheme =
+        NO_AUTH
+       | MOD_WAKLOG
+
+type apache_info = {version : apache_version,
+                   auth : apache_auth_scheme}
+
+end
\ No newline at end of file
index b6b6d24..f7b8346 100644 (file)
@@ -1,5 +1,5 @@
 (* HCoop Domtool (http://hcoop.sourceforge.net/)
- * Copyright (c) 2006, Adam Chlipala
+ * Copyright (c) 2006-2007, Adam Chlipala
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
index 4ea0389..511901c 100644 (file)
@@ -228,10 +228,15 @@ fun findVhostUser fname =
 val webNodes_full = Config.Apache.webNodes_all @ Config.Apache.webNodes_admin
 
 fun isVersion1 node =
-    List.exists (fn x => x = (node, true)) webNodes_full
+    List.exists (fn (n, {version = ConfigTypes.APACHE_1_3, ...}) => n = node
+                 | _ => false) webNodes_full
 
 fun imVersion1 () = isVersion1 (Slave.hostname ())
 
+fun isWaklog node =
+    List.exists (fn (n, {auth = ConfigTypes.MOD_WAKLOG, ...}) => n = node
+                 | _ => false) webNodes_full
+
 fun down () = if imVersion1 () then Config.Apache.down1 else Config.Apache.down
 fun undown () = if imVersion1 () then Config.Apache.undown1 else Config.Apache.undown
 fun reload () = if imVersion1 () then Config.Apache.reload1 else Config.Apache.reload
@@ -442,6 +447,13 @@ val () = Env.containerV_one "vhost"
                                                    TextIO.output (file, group))
                                           else
                                               ();
+                                          if isWaklog node then
+                                              (TextIO.output (file, "\n\tWaklogProtected on\n\tWaklogPrincipal ");
+                                               TextIO.output (file, user);
+                                               TextIO.output (file, "/cgi@HCOOP.NET /etc/keytabs/cgi/");
+                                               TextIO.output (file, user))
+                                          else
+                                              ();
                                           (Domain.homedirOf user ^ "/apache/log/"
                                            ^ node ^ "/" ^ vhostId, file)
                                       end)
index 70b79da..a544a3b 100644 (file)
@@ -5,6 +5,8 @@ dataStructures.sml
 
 ast.sml
 
+configTypes.sml
+
 ../configDefault/config.sig
 ../configDefault/configDefault.sml