mlton: bin/domtool-server bin/domtool-client bin/domtool-slave \
bin/domtool-admin bin/domtool-doc bin/dbtool bin/vmail \
- bin/smtplog bin/setsa bin/mysql-fixperms bin/webbw bin/domtool-tail
+ bin/smtplog bin/setsa bin/mysql-fixperms bin/webbw bin/domtool-tail \
+ bin/fwtool
smlnj: $(COMMON_DEPS) openssl/smlnj/FFI/libssl.h.cm pcre/smlnj/FFI/libpcre.h.cm \
src/domtool.cm
$(MAKE_MLB_BASE) >src/mysql-fixperms.mlb
echo "main-mysql-fixperms.sml" >>src/mysql-fixperms.mlb
+src/fwtool.mlb: src/prefix.mlb src/sources src/suffix.mlb
+ $(MAKE_MLB_BASE) >src/fwtool.mlb
+ echo "main-fwtool.sml" >>src/fwtool.mlb
+
openssl/smlnj/FFI/libssl.h.cm: openssl/openssl_sml.h
cd openssl/smlnj ; ml-nlffigen -d FFI -lh LibsslH.libh -include ../libssl-h.sml \
-cm libssl.h.cm -D__builtin_va_list="void*" \
bin/mysql-fixperms: $(COMMON_MLTON_DEPS) src/mysql-fixperms.mlb
$(MLTON) -output bin/mysql-fixperms src/mysql-fixperms.mlb
+bin/fwtool: $(COMMON_MLTON_DEPS) src/fwtool.mlb
+ $(MLTON) -output bin/fwtool src/fwtool.mlb
+
bin/webbw: $(COMMON_MLTON_DEPS) src/stats/webbw.mlb src/stats/*.sml
mlton -output bin/webbw src/stats/webbw.mlb
-cp bin/domtool-admin /usr/local/bin/
-cp bin/domtool-doc /usr/local/bin/
-cp bin/dbtool /usr/local/bin/
+ -cp bin/fwtool /usr/local/bin/
-cp bin/vmail /usr/local/bin/
-cp bin/setsa /usr/local/bin/
-cp bin/smtplog /usr/local/bin/
--- /dev/null
+(* HCoop Domtool (http://hcoop.sourceforge.net/)
+ * Copyright (c) 2006, Adam Chlipala
+ * Copyright (c) 2012 Clinton Ebadi
+ *
+ * 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.
+ *)
+
+(* Driver for fwtool *)
+
+val _ =
+ OS.Process.exit (case CommandLine.arguments () of
+ "regen" :: nodeName :: rest => Main.requestFirewallRegen nodeName
+ | _ => (print "Usage: fwtool regen NODE\n"; OS.Process.failure))
val requestTrustedPath : {node : string, uname : string} -> OS.Process.status
val requestSocketPerm : {node : string, uname : string} -> OS.Process.status
val requestFirewall : {node : string, uname : string} -> OS.Process.status
+
+ val requestFirewallRegen : string -> OS.Process.status
end
OpenSSL.close bio
end
+fun requestFirewallRegen node =
+ let
+ val (user, context) = requestContext (fn () => ())
+ val bio = OpenSSL.connect true (context, Domain.nodeIp node ^ ":" ^ Int.toString Config.slavePort)
+ (* Only supporting on slave nodes *)
+
+ val _ = Msg.send (bio, MsgFirewallRegen)
+
+ fun handleResult () =
+ case Msg.recv bio of
+ NONE => (print "Server closed connection unexpectedly.\n";
+ OS.Process.failure)
+ | SOME m =>
+ case m of
+ MsgOk => (print "Firewall regenerated.\n";
+ OS.Process.success)
+ | MsgError s => (print ("Firewall regeneration failed: " ^ s ^ "\n");
+ OS.Process.failure)
+ | _ => (print "Unexpected server reply.\n";
+ OS.Process.failure)
+ in
+ handleResult()
+ before OpenSSL.close bio
+ end
+
structure SS = StringSet
fun domainList dname =