[06/12] statusmail: Infrastructure files

Message ID 20190405172940.13168-7-ipfr@tfitzgeorge.me.uk
State New
Headers show
Series statusmail: Status and Log Summary Emails | expand

Commit Message

Tim FitzGeorge April 6, 2019, 4:29 a.m. UTC
Adds statusmail to build and menu

Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
---
 config/backup/include                      |  3 ++
 config/menu/10-system.menu                 |  5 +++
 config/rootfiles/common/misc-progs         |  1 +
 config/rootfiles/common/statusmail         | 22 +++++++++
 config/rootfiles/common/web-user-interface |  2 +
 lfs/statusmail                             | 71 ++++++++++++++++++++++++++++++
 make.sh                                    |  2 +
 src/misc-progs/Makefile                    |  2 +-
 8 files changed, 107 insertions(+), 1 deletion(-)
 create mode 100644 config/rootfiles/common/statusmail
 create mode 100644 lfs/statusmail

Patch

diff --git a/config/backup/include b/config/backup/include
index 1190eda81..bd8b77198 100644
--- a/config/backup/include
+++ b/config/backup/include
@@ -49,6 +49,9 @@ 
 /var/ipfire/suricata/*.conf
 /var/ipfire/suricata/*.yaml
 /var/ipfire/*/settings
+/var/ipfire/statusmail/contact_settings
+/var/ipfire/statusmail/schedule_settings
+/var/ipfire/statusmail/keys/*.gpg
 /var/ipfire/time/
 /var/ipfire/urlfilter
 /var/ipfire/vpn
diff --git a/config/menu/10-system.menu b/config/menu/10-system.menu
index 3b84e31c0..007f7e95d 100644
--- a/config/menu/10-system.menu
+++ b/config/menu/10-system.menu
@@ -21,6 +21,11 @@ 
 				'title' => "$Lang::tr{'email settings'}",
 				'enabled' => 1,
 				};
+    $subsystem->{'25.statusmail'} = {'caption' => $Lang::tr{'statusmail status emails'},
+                'uri'     => '/cgi-bin/statusmail.cgi',
+                'title'   => $Lang::tr{'statusmail status emails'},
+                'enabled' => 1,
+                };
     $subsystem->{'30.ssh'} = {
 				'caption' => $Lang::tr{'ssh access'},
 				'uri' => '/cgi-bin/remote.cgi',
diff --git a/config/rootfiles/common/misc-progs b/config/rootfiles/common/misc-progs
index c48a474b2..828ed2383 100644
--- a/config/rootfiles/common/misc-progs
+++ b/config/rootfiles/common/misc-progs
@@ -26,6 +26,7 @@  usr/local/bin/redctrl
 #usr/local/bin/sambactrl
 usr/local/bin/setaliases
 usr/local/bin/smartctrl
+usr/local/bin/statusmailctrl
 usr/local/bin/squidctrl
 usr/local/bin/suricatactrl
 usr/local/bin/sshctrl
diff --git a/config/rootfiles/common/statusmail b/config/rootfiles/common/statusmail
new file mode 100644
index 000000000..4a754990e
--- /dev/null
+++ b/config/rootfiles/common/statusmail
@@ -0,0 +1,22 @@ 
+#usr/lib/statusmail
+usr/lib/statusmail/EncryptedMail.pm
+usr/lib/statusmail/StatusMail.pm
+usr/lib/statusmail/generate_signature.sh
+#usr/lib/statusmail/plugins
+usr/lib/statusmail/plugins/graphs.pm
+usr/lib/statusmail/plugins/hardware_media_space.pm
+usr/lib/statusmail/plugins/network_firewall.pm
+#usr/lib/statusmail/plugins/services_ups_apc.pm
+#usr/lib/statusmail/plugins/services_clamav.pm
+usr/lib/statusmail/plugins/services_intrusion_prevention_system.pm
+usr/lib/statusmail/plugins/services_urlfilter.pm
+usr/lib/statusmail/plugins/system_kernel.pm
+usr/lib/statusmail/plugins/system_pakfire.pm
+usr/lib/statusmail/plugins/system_ssh.pm
+usr/lib/statusmail/plugins/system_status_ps.pm
+usr/lib/statusmail/plugins/system_status_services.pm
+usr/lib/statusmail/stylesheet.css
+usr/local/bin/statusmail.pl
+usr/lib/statusmail/statusmail.sh
+var/ipfire/statusmail
+var/ipfire/statusmail/keys
diff --git a/config/rootfiles/common/web-user-interface b/config/rootfiles/common/web-user-interface
index d538b8a5b..e78e09abe 100644
--- a/config/rootfiles/common/web-user-interface
+++ b/config/rootfiles/common/web-user-interface
@@ -79,6 +79,7 @@  srv/web/ipfire/cgi-bin/routing.cgi
 srv/web/ipfire/cgi-bin/services.cgi
 srv/web/ipfire/cgi-bin/shutdown.cgi
 srv/web/ipfire/cgi-bin/speed.cgi
+srv/web/ipfire/cgi-bin/statusmail.cgi
 srv/web/ipfire/cgi-bin/system.cgi
 srv/web/ipfire/cgi-bin/time.cgi
 #srv/web/ipfire/cgi-bin/tor.cgi
@@ -237,6 +238,7 @@  srv/web/ipfire/html/images/on.gif
 srv/web/ipfire/html/images/openvpn.gif
 srv/web/ipfire/html/images/openvpn.png
 srv/web/ipfire/html/images/package-x-generic.png
+srv/web/ipfire/html/images/play.png
 srv/web/ipfire/html/images/printer-error.png
 srv/web/ipfire/html/images/printer.png
 srv/web/ipfire/html/images/process-stop.png
diff --git a/lfs/statusmail b/lfs/statusmail
new file mode 100644
index 000000000..8ddf2df36
--- /dev/null
+++ b/lfs/statusmail
@@ -0,0 +1,71 @@ 
+###############################################################################
+# IPFire.org    - An Open Source Firewall Solution                            #
+# Copyright (C) 2007-2019  IPFire Team  <info@ipfire.org>                     #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+VER        = 1.0
+
+THISAPP    = statusmail
+DIR_APP    = $(DIR_SRC)/$(THISAPP)
+TARGET     = $(DIR_INFO)/$(THISAPP)
+PROG       = statusmail
+PAK_VER    = 1
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+install : $(TARGET)
+
+check : 
+
+download :
+
+md5 : 
+
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+	@$(PREBUILD)
+	@rm -rf $(DIR_APP) && mkdir $(DIR_APP) && cp -R $(DIR_SRC)/src/statusmail/ $(DIR_APP)
+	cd $(DIR_APP)
+	mkdir -p /usr/lib/statusmail
+	mkdir -p /usr/lib/statusmail/plugins
+	mkdir -p /var/ipfire/statusmail
+	mkdir -p /var/ipfire/statusmail/keys
+	
+	chown nobody.nobody /var/ipfire/statusmail/keys
+	chmod 0700 /var/ipfire/statusmail/keys
+	chown nobody.nobody /var/ipfire/statusmail
+	
+	install -v -m 0755 $(DIR_APP)/statusmail/statusmail.pl /usr/local/bin
+	install -v -m 0755 $(DIR_APP)/statusmail/statusmail.sh /usr/lib/statusmail
+	install -v -m 0644 $(DIR_APP)/statusmail/EncryptedMail.pm /usr/lib/statusmail
+	install -v -m 0644 $(DIR_APP)/statusmail/StatusMail.pm /usr/lib/statusmail
+	install -v -m 0755 $(DIR_APP)/statusmail/stylesheet.css /usr/lib/statusmail
+	install -v -m 0755 $(DIR_APP)/statusmail/generate_signature.sh /usr/lib/statusmail
+
+	install -v -m 0644 $(DIR_APP)/statusmail/plugins/graphs.pm /usr/lib/statusmail/plugins
+	install -v -m 0644 $(DIR_APP)/statusmail/plugins/hardware_media_space.pm /usr/lib/statusmail/plugins/
+	install -v -m 0644 $(DIR_APP)/statusmail/plugins/network_firewall.pm /usr/lib/statusmail/plugins/
+	install -v -m 0644 $(DIR_APP)/statusmail/plugins/system_kernel.pm /usr/lib/statusmail/plugins/
+	install -v -m 0644 $(DIR_APP)/statusmail/plugins/system_pakfire.pm /usr/lib/statusmail/plugins/
+	install -v -m 0644 $(DIR_APP)/statusmail/plugins/system_ssh.pm /usr/lib/statusmail/plugins/
+	install -v -m 0644 $(DIR_APP)/statusmail/plugins/system_status_ps.pm /usr/lib/statusmail/plugins/
+	install -v -m 0644 $(DIR_APP)/statusmail/plugins/system_status_services.pm /usr/lib/statusmail/plugins/
+	install -v -m 0644 $(DIR_APP)/statusmail/plugins/services_urlfilter.pm /usr/lib/statusmail/plugins/
+	install -v -m 0644 $(DIR_APP)/statusmail/plugins/services_intrusion_prevention_system.pm /usr/lib/statusmail/plugins/
+#	install -v -m 0644 $(DIR_APP)/statusmail/plugins/services_clamav.pm /usr/lib/statusmail/plugins/
+#	install -v -m 0644 $(DIR_APP)/statusmail/plugins/services_ups_apc.pm /usr/lib/statusmail/plugins/
+
+	@rm -rf $(DIR_APP)
+	@$(POSTBUILD)
diff --git a/make.sh b/make.sh
index de973c69c..6be8d1d7f 100755
--- a/make.sh
+++ b/make.sh
@@ -1594,6 +1595,7 @@  buildipfire() {
   lfsmake2 zabbix_agentd
   lfsmake2 flashrom
   lfsmake2 firmware-update
+  lfsmake2 statusmail
 }
 
 buildinstaller() {
diff --git a/src/misc-progs/Makefile b/src/misc-progs/Makefile
index bea54e773..42f239cec 100644
--- a/src/misc-progs/Makefile
+++ b/src/misc-progs/Makefile
@@ -32,7 +32,7 @@  SUID_PROGS = squidctrl sshctrl ipfirereboot \
 	smartctrl clamavctrl addonctrl pakfire mpfirectrl wlanapctrl \
 	setaliases urlfilterctrl updxlratorctrl fireinfoctrl rebuildroutes \
 	getconntracktable wirelessclient torctrl ddnsctrl unboundctrl \
-	captivectrl
+	captivectrl statusmailctrl
 SUID_UPDX = updxsetperms
 
 OBJS = $(patsubst %,%.o,$(PROGS) $(SUID_PROGS))