summaryrefslogtreecommitdiff
path: root/sentinel-proxy
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2020-04-02 10:10:16 +0200
committerKarel Kočí <cynerd@email.cz>2020-04-02 10:10:16 +0200
commit1419b8fb1325f6aeca43c6e7f33d0b9626a9fcce (patch)
treebe654f791a6a3f88f14cfd310bd994dd8b8add37 /sentinel-proxy
parenta1d5a6718803a5b9042045be0f114b8b99a2eacd (diff)
downloadopenwrt-personal-pkgs-1419b8fb1325f6aeca43c6e7f33d0b9626a9fcce.tar.gz
openwrt-personal-pkgs-1419b8fb1325f6aeca43c6e7f33d0b9626a9fcce.tar.bz2
openwrt-personal-pkgs-1419b8fb1325f6aeca43c6e7f33d0b9626a9fcce.zip
Add sentinel-proxy
Diffstat (limited to 'sentinel-proxy')
-rw-r--r--sentinel-proxy/Makefile60
-rw-r--r--sentinel-proxy/files/ca.pem38
-rw-r--r--sentinel-proxy/files/init12
-rw-r--r--sentinel-proxy/files/renew.cron5
-rw-r--r--sentinel-proxy/files/restart-proxy-hook.sh3
-rw-r--r--sentinel-proxy/files/uci2
6 files changed, 120 insertions, 0 deletions
diff --git a/sentinel-proxy/Makefile b/sentinel-proxy/Makefile
new file mode 100644
index 0000000..2721647
--- /dev/null
+++ b/sentinel-proxy/Makefile
@@ -0,0 +1,60 @@
+#
+## Copyright (C) 2018-2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
+#
+## This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+# #
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=sentinel-proxy
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_BRANCH:=token_crc
+
+PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz>
+PKG_LICENSE:=GPL-3.0
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/autopkg-branch.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sentinel-proxy
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=Sentinel
+ TITLE:=Proxy
+ URL:=https://gitlab.labs.nic.cz/turris/sentinel/proxy
+ DEPENDS:=+czmq +libpaho-mqtt-c +zlib +libopenssl +sentinel-certgen
+endef
+
+define Package/sentinel-proxy/description
+ Central daemon proxying all Sentinel trafic on router to Turris servers.
+endef
+
+define Package/sentinel-proxy/install
+ $(INSTALL_DIR) $(1)/etc/sentinel
+ $(INSTALL_BIN) ./files/ca.pem $(1)/etc/sentinel/ca.pem
+
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/sentinel_proxy $(1)/usr/bin/sentinel-proxy
+
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) files/init $(1)/etc/init.d/sentinel-proxy
+
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_BIN) files/uci $(1)/etc/config/sentinel
+
+ $(INSTALL_DIR) $(1)/etc/sentinel-certgen_hooks.d
+ $(INSTALL_BIN) files/restart-proxy-hook.sh $(1)/etc/sentinel-certgen_hooks.d/restart-proxy
+
+ $(INSTALL_DIR) $(1)/etc/cron.d
+ $(INSTALL_DATA) files/renew.cron $(1)/etc/cron.d/certgen-certs-renew
+endef
+
+define Package/sentinel-proxy/conffiles
+/etc/config/sentinel
+endef
+
+$(eval $(call BuildPackage,sentinel-proxy))
diff --git a/sentinel-proxy/files/ca.pem b/sentinel-proxy/files/ca.pem
new file mode 100644
index 0000000..91094e1
--- /dev/null
+++ b/sentinel-proxy/files/ca.pem
@@ -0,0 +1,38 @@
+-----BEGIN CERTIFICATE-----
+MIIGsDCCBJigAwIBAgIJAM3oziL/qM4GMA0GCSqGSIb3DQEBCwUAMIGWMQswCQYD
+VQQGEwJDWjELMAkGA1UECBMCQ1oxDzANBgNVBAcTBlByYWd1ZTEPMA0GA1UEChMG
+Q1ouTklDMQ8wDQYDVQQLEwZUdXJyaXMxFDASBgNVBAMTC1NlbnRpbmVsIENBMREw
+DwYDVQQpEwhT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
+-----END CERTIFICATE-----
diff --git a/sentinel-proxy/files/init b/sentinel-proxy/files/init
new file mode 100644
index 0000000..5737dce
--- /dev/null
+++ b/sentinel-proxy/files/init
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+
+USE_PROCD=1
+START=95
+STOP=10
+
+start_service() {
+ procd_open_instance
+ procd_set_param command /bin/sh -c 'sentinel-certgen certs && exec sentinel-proxy'
+ procd_set_param respawn 600 5 5
+ procd_close_instance
+}
diff --git a/sentinel-proxy/files/renew.cron b/sentinel-proxy/files/renew.cron
new file mode 100644
index 0000000..85aecb5
--- /dev/null
+++ b/sentinel-proxy/files/renew.cron
@@ -0,0 +1,5 @@
+## crontab
+#
+
+# Periodically check and renew Sentinel:Proxy certificate
+42 */12 * * * root sentinel-certgen certs --hooks-dir /etc/sentinel-certgen_hooks.d
diff --git a/sentinel-proxy/files/restart-proxy-hook.sh b/sentinel-proxy/files/restart-proxy-hook.sh
new file mode 100644
index 0000000..781c368
--- /dev/null
+++ b/sentinel-proxy/files/restart-proxy-hook.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+# restart Sentinel:Proxy service after Certgen renews the certificate
+/etc/init.d/sentinel-proxy restart
diff --git a/sentinel-proxy/files/uci b/sentinel-proxy/files/uci
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/sentinel-proxy/files/uci
@@ -0,0 +1,2 @@
+
+