smlnj: $(COMMON_DEPS) openssl/smlnj/FFI/libssl.h.cm pcre/smlnj/FFI/libpcre.h.cm \
src/domtool.cm
+ CFLAGS += -m32
-configDefault/config.sig: src/config.sig.header \
+configDefault/config.sig: config/core/core.sig src/config.sig.header \
configDefault/*.csg configDefault/*.cfs \
src/config.sig.footer
cat configDefault/*.csg \
src/config.sig.footer \
>configDefault/config.sig
-configDefault/configDefault.sml: src/configDefault.sml.header \
+configDefault/configDefault.sml: config/core/core.sml src/configDefault.sml.header \
configDefault/*.cfg src/configDefault.sml.footer
cat src/configDefault.sml.header \
configDefault/*.cfg \
--- /dev/null
+(* Core configure to allow domtool to be easily relocated *)
+signature CONFIG_CORE = sig
+
+ val sharedRoot : string
+ (* Global file system space for domtool daemon to share *)
+
+ val localRoot : string
+ (* Local file system space for domtool to generate configuration into *)
+
+ val installPrefix : string
+ (* Prefix for domtool bin/share data ala GNU $PREFIX *)
+
+ val cat : string
+ val cp : string
+ val diff : string
+ val rm : string
+ val echo : string
+ val grep : string
+ val sudo : string
+ (* Paths to standard UNIX utilities *)
+
+end
--- /dev/null
+structure ConfigCore :> CONFIG_CORE = struct
+
+val sharedRoot = "/afs/hcoop.net/common/etc/domtool"
+val localRoot = "/var/domtool"
+val installPrefix = "/usr/local"
+
+val cat = "/bin/cat"
+val cp = "/bin/cp"
+val diff = "/usr/bin/diff"
+val rm = "/bin/rm"
+val echo = "/bin/echo"
+val grep = "/bin/grep"
+val sudo = "/usr/bin/sudo"
+
+end
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"
-val fixperms = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache-fixperms"
+val reload = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish apache"
+val down = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish apache-down"
+val undown = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish apache-undown"
+val fixperms = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish apache-fixperms"
-val reload1 = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache1.3"
-val down1 = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache1.3-down"
-val undown1 = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache1.3-undown"
-val fixperms1 = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache1.3-fixperms"
+val reload1 = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish apache1.3"
+val down1 = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish apache1.3-down"
+val undown1 = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish apache1.3-undown"
+val fixperms1 = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish apache1.3-fixperms"
-val confDir = "/var/domtool/vhosts"
+val confDir = ConfigCore.localRoot ^ "/vhosts"
val webNodes_all = [("navajos", {version = APACHE_2, auth = MOD_WAKLOG})]
val webNodes_admin = [("deleuze", {version = APACHE_2, auth = MOD_WAKLOG})]
user,
"/apache/log"]
+(* FIXME: hcoop.net reference *)
fun realLogDirOf user =
if size user < 2 then
"/bad_username"
fun backupLogDirOf version1 =
if version1 then
- "/afs/hcoop.net/common/etc/domtool/backup/apache/"
+ ConfigCore.sharedRoot ^ "/backup/apache/"
else
- "/afs/hcoop.net/common/etc/domtool/backup/apache2/"
+ ConfigCore.sharedRoot ^ "/backup/apache2/"
val defaultPhpVersion = 5
-val waklogUserFile = "/var/domtool/waklog.conf"
+val waklogUserFile = ConfigCore.localRoot ^ "/waklog.conf"
end
structure Bind :> BIND_CONFIG = struct
-val defaultTTL = 3600
+val masterNode = "deleuze"
+val slaveNodes = ["outpost"]
+val defaultTTL = 3600
-val zonePath = "/var/domtool/zones"
+val zonePath = ConfigCore.localRoot ^ "/zones"
val zonePath_real = "/etc/bind/zones"
-val namedConf = "/var/domtool/named.conf.local"
+val namedConf = ConfigCore.localRoot ^ "/named.conf.local"
-val reload = "/usr/bin/sudo /usr/local/sbin/domtool-publish bind"
+val reload = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish bind"
end
signature BIND_CONFIG = sig
+ val masterNode : string
+ val slaveNodes : string list
+
val defaultTTL : int
val zonePath : string
val userdbDir = "/etc/courier/userdb"
(* Directory for storing userdb info *)
-val postReload = "/usr/bin/sudo /usr/local/sbin/domtool-publish courier"
+val postReload = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish courier"
(* Command to run after reloading userdb data *)
val logFile = "/var/log/exim4/mainlog"
(* SMTP log *)
-val pushUserdb = "/usr/bin/rsync -r --delete /etc/courier/userdb/* /afs/hcoop.net/common/etc/domtool/email/userdb/"
-val pullUserdb = "/usr/bin/rsync -r --delete /afs/hcoop.net/common/etc/domtool/email/userdb/* /etc/courier/userdb/"
+(* FIXME: should probably be in an external script *)
+val pushUserdb = "/usr/bin/rsync -r --delete /etc/courier/userdb/* " ^ ConfigCore.sharedRoot ^ "/email/userdb/"
+val pullUserdb = "/usr/bin/rsync -r --delete " ^ ConfigCore.sharedRoot ^ "/email/userdb/* /etc/courier/userdb/"
end
-val libRoot = "/afs/hcoop.net/common/etc/domtool/lib"
-val resultRoot = "/afs/hcoop.net/common/etc/domtool/nodes"
+open ConfigCore
+
+val libRoot = ConfigCore.sharedRoot ^ "/lib"
+val resultRoot = ConfigCore.sharedRoot ^ "/nodes"
val tmpDir = "/tmp/domtool"
-val oldResultRoot = "/afs/hcoop.net/common/etc/domtool/nodes.old"
+val oldResultRoot = ConfigCore.sharedRoot ^ "/nodes.old"
-val cat = "/bin/cat"
-val cp = "/bin/cp"
-val diff = "/usr/bin/diff"
-val rm = "/bin/rm"
-val echo = "/bin/echo"
-val grep = "/bin/grep"
-val sudo = "/usr/bin/sudo"
-val domtool_publish = "/usr/local/sbin/domtool-publish"
+val domtool_publish = ConfigCore.installPrefix ^ "/sbin/domtool-publish"
val defaultNs = "ns1.hcoop.net"
val nodeIps = [("deleuze", "69.90.123.67"), ("hopper", "69.90.123.74"), ("fritz", "69.90.123.75"), ("navajos", "69.90.123.70"), ("bog", "69.90.123.72"), ("outpost", "151.236.216.192")]
val defaultNode = "fritz"
-val masterNode = "deleuze"
-val slaveNodes = ["outpost"]
-(* THESE ARE THE DNS MASTER/SLAVE, NOT DOMTOOL NODES *)
-
val dnsNodes_all = ["deleuze", "outpost"]
val dnsNodes_admin = []
val mailNodes_all = ["deleuze"]
val mailNodes_admin = []
-val aclFile = "/afs/hcoop.net/common/etc/domtool/acl"
+val aclFile = ConfigCore.sharedRoot ^ "/acl"
val testUser = "test"
val defaultDomain = "hcoop.net"
-val dispatcher = defaultNode ^ ".hcoop.net"
+val dispatcher = defaultNode ^ "." ^ defaultDomain
val dispatcherPort = 1234
val slavePort = 1235
val queueSize = 5
val bufSize = 1024
-val trustStore = "/afs/hcoop.net/common/etc/domtool/TrustStore.pem"
+val trustStore = ConfigCore.sharedRoot ^ "/TrustStore.pem"
-val certDir = "/afs/hcoop.net/common/etc/domtool/certs"
-val keyDir = "/afs/hcoop.net/common/etc/domtool/keys"
-val serialDir = "/afs/hcoop.net/common/etc/domtool/serials"
+val certDir = ConfigCore.sharedRoot ^ "/certs"
+val keyDir = ConfigCore.sharedRoot ^ "/keys"
+val serialDir = ConfigCore.sharedRoot ^ "/serials"
val dispatcherName = defaultNode
fun domtoolDir user =
case user of
- "domtool" => "/afs/hcoop.net/common/etc/domtool/.domtool"
+ "domtool" => ConfigCore.sharedRoot ^ "/.domtool"
| _ => OS.Path.joinDirFile {dir = Posix.SysDB.Passwd.home (Posix.SysDB.getpwnam user),
file = ".domtool"}
val worldReadable = ["/usr/share/moin", "/usr/share/apache/icons", "/afs/hcoop.net/common/app/moin/installed"]
-val publish_reusers = "/usr/bin/sudo " ^ domtool_publish ^ " users"
+val publish_reusers = ConfigCore.sudo ^ " " ^ domtool_publish ^ " users"
val tmpDir : string
(* Filesystem location for creating temporary directories *)
-(* Paths to standard UNIX utilities *)
-val cat : string
-val cp : string
-val diff : string
-val rm : string
-val echo : string
-val grep : string
-val sudo : string
val domtool_publish : string
(* DNS SOA parameter defaults *)
val nodeIps : (string * string) list
val defaultNode : string
-val masterNode : string
-val slaveNodes : string list
-
val aclFile : string
(* Place to serialize ACL information *)
-structure Exim :> EXIM_CONFIG = struct
-
-val aliases = "/var/domtool/aliases"
-val aliasesDefault = "/var/domtool/aliases.default"
-val handleDomains = "/var/domtool/local_domains.cfg"
-val relayDomains = "/var/domtool/relay_domains.cfg"
-
-val reload = "/usr/bin/sudo /usr/local/sbin/domtool-publish exim"
-
-val aliasTo = ["deleuze"]
-
-val mainLog = "/var/log/exim4/mainlog"
-
-end
+structure Exim :> EXIM_CONFIG = struct
+
+val aliases = ConfigCore.localRoot ^ "/aliases"
+val aliasesDefault = ConfigCore.localRoot ^ "/aliases.default"
+val handleDomains = ConfigCore.localRoot ^ "/local_domains.cfg"
+val relayDomains = ConfigCore.localRoot ^ "/relay_domains.cfg"
+
+val reload = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish exim"
+
+val aliasTo = ["deleuze"]
+
+val mainLog = "/var/log/exim4/mainlog"
+
+end
(* -*- sml -*- *)
structure Firewall :> FIREWALL_CONFIG = struct
-val firewallRules = "/afs/hcoop.net/common/etc/domtool/firewall/user.rules"
-val firewallDir = "/var/domtool/firewall/"
+val firewallRules = ConfigCore.sharedRoot ^ "/firewall/user.rules"
+val firewallDir = ConfigCore.localRoot ^ "/firewall/"
val firewallNodes = ["bog", "navajos"]
-val reload = "/usr/bin/sudo /usr/local/sbin/domtool-publish firewall"
+val reload = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish firewall"
end
val node = "deleuze"
-val mapFile = "/var/domtool/mailman.map"
-val handleDomains = "/var/domtool/mailman_domains.cfg"
+val mapFile = ConfigCore.localRoot ^ "/mailman.map"
+val handleDomains = ConfigCore.localRoot ^ "/mailman_domains.cfg"
-val reload = "/usr/bin/sudo /usr/local/sbin/domtool-publish mailman"
+val reload = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-publish mailman"
end
-structure MySQL :> MYSQL_CONFIG = struct
-
-val adduser = "/usr/bin/sudo /usr/local/sbin/domtool-mysql adduser"
-val passwd = "/usr/bin/sudo /usr/local/sbin/domtool-mysql passwd"
-val createdb = "/usr/bin/sudo /usr/local/sbin/domtool-mysql createdb"
-val dropdb = "/usr/bin/sudo /usr/local/sbin/domtool-mysql dropdb"
-val grant = "/usr/bin/sudo /usr/local/sbin/domtool-mysql grant"
-
-end
+structure MySQL :> MYSQL_CONFIG = struct
+
+val adduser = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-mysql adduser"
+val passwd = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-mysql passwd"
+val createdb = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-mysql createdb"
+val dropdb = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-mysql dropdb"
+val grant = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-mysql grant"
+
+end
-structure Postgres :> POSTGRES_CONFIG = struct
-
-val adduser = "/usr/bin/sudo /usr/local/sbin/domtool-postgres adduser"
-val createdb = "/usr/bin/sudo /usr/local/sbin/domtool-postgres createdb"
-val dropdb = "/usr/bin/sudo /usr/local/sbin/domtool-postgres dropdb"
-
-val postgres81port = "5432";
-val postgres91port = "5433"
-
-end
+structure Postgres :> POSTGRES_CONFIG = struct
+
+val adduser = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-postgres adduser"
+val createdb = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-postgres createdb"
+val dropdb = ConfigCore.sudo ^ " " ^ ConfigCore.installPrefix ^ "/sbin/domtool-postgres dropdb"
+
+val postgres81port = "5432";
+val postgres91port = "5433"
+
+end
structure Webalizer :> WEBALIZER_CONFIG = struct
-val configDir = "/afs/hcoop.net/common/etc/domtool/webalizer/config"
-val outputDir = "/afs/hcoop.net/common/etc/domtool/webalizer/output"
-val backupDir = "/afs/hcoop.net/common/etc/domtool/backup/webalizer"
+val configDir = ConfigCore.sharedRoot ^ "/webalizer/config"
+val outputDir = ConfigCore.sharedRoot ^ "/webalizer/output"
+val backupDir = ConfigCore.sharedRoot ^ "/backup/webalizer"
-val defaultOutput = "/afs/hcoop.net/common/etc/domtool/webalizer/output/main/"
+val defaultOutput = ConfigCore.sharedRoot ^ "/webalizer/output/main/"
val defaultHost = "www.hcoop.net"
end
[nsD, serialD, refD, retD, expD, minD])
val masterD = (EApp ((EVar "internalMaster", dl),
- (EString Config.masterNode, dl)),
+ (EString Config.Bind.masterNode, dl)),
dl)
val slavesD = (EList (map (fn s => (EString s, dl))
- (List.filter (fn x => List.exists (fn y => y = x) (Config.dnsNodes_all @ Config.dnsNodes_admin)) Config.slaveNodes)), dl)
+ (List.filter (fn x => List.exists (fn y => y = x) (Config.dnsNodes_all @ Config.dnsNodes_admin)) Config.Bind.slaveNodes)), dl)
val _ = Defaults.registerDefault ("Aliases",
(TList (TBase "your_domain", dl), dl),
val {dir, file} = OS.Path.splitDirFile (#file fs)
fun dnsChanged () =
- if #domain fs = !didDomain orelse Slave.hostname () <> Config.masterNode then
+ if #domain fs = !didDomain orelse Slave.hostname () <> Config.Bind.masterNode then
()
else if Slave.isDelete (#action fs) then
let
configTypes.sml
+../config/core/core.sig
+../config/core/core.sml
../configDefault/config.sig
../configDefault/configDefault.sml