1 |
jpp |
1.1 |
diff -Nur --no-dereference smeserver-unifi-5.6.30.old/createlinks smeserver-unifi-5.6.30/createlinks |
2 |
jpp |
1.2 |
--- smeserver-unifi-5.6.30.old/createlinks 2018-03-09 02:15:53.000000000 -0500 |
3 |
|
|
+++ smeserver-unifi-5.6.30/createlinks 2022-08-03 21:49:45.091000000 -0400 |
4 |
jpp |
1.1 |
@@ -3,7 +3,7 @@ |
5 |
|
|
use esmith::Build::CreateLinks qw(:all); |
6 |
|
|
|
7 |
|
|
|
8 |
jpp |
1.2 |
-service_link_enhanced("unifi", "S85", "7"); |
9 |
|
|
+#service_link_enhanced("unifi", "S85", "7"); |
10 |
jpp |
1.1 |
|
11 |
|
|
|
12 |
|
|
foreach $event (qw(remoteaccess-update)) |
13 |
jpp |
1.2 |
@@ -17,13 +17,28 @@ |
14 |
jpp |
1.1 |
} |
15 |
|
|
|
16 |
|
|
|
17 |
jpp |
1.2 |
-# add link to |
18 |
|
|
+my $pkg= "smeserver-unifi"; |
19 |
|
|
+my $event = "${pkg}-update"; |
20 |
|
|
|
21 |
|
|
+event_actions($event, qw( |
22 |
|
|
+ upgrade_unifi_controller.sh 20 |
23 |
|
|
+ systemd-default 88 |
24 |
|
|
+ systemd-reload 89 |
25 |
|
|
+)); |
26 |
|
|
+ |
27 |
|
|
+#event_templates($event, qw( |
28 |
|
|
+#/etc/httpd/conf/httpd.conf |
29 |
|
|
+#)); |
30 |
|
|
+ |
31 |
|
|
+event_services($event, qw( |
32 |
|
|
+ unifi restart |
33 |
|
|
+)); |
34 |
|
|
+ |
35 |
|
|
+use esmith::Build::Backup qw(:all); |
36 |
|
|
+backup_includes($pkg, qw( |
37 |
|
|
+/opt/Unifi |
38 |
|
|
+/opt/UniFi_bak |
39 |
|
|
+)); |
40 |
|
|
|
41 |
|
|
-#foreach $file ( |
42 |
|
|
-# qw(/var/lib/denyhosts/allowed-hosts /etc/hosts.allow /etc/denyhosts.conf)) |
43 |
|
|
-#{ |
44 |
|
|
-# templates2events($file, qw(bootstrap-console-save conf-denyhosts)); |
45 |
|
|
-#} |
46 |
jpp |
1.1 |
|
47 |
|
|
exit 0; |
48 |
|
|
diff -Nur --no-dereference smeserver-unifi-5.6.30.old/root/etc/e-smith/db/configuration/defaults/unifi/TCPPort smeserver-unifi-5.6.30/root/etc/e-smith/db/configuration/defaults/unifi/TCPPort |
49 |
jpp |
1.2 |
--- smeserver-unifi-5.6.30.old/root/etc/e-smith/db/configuration/defaults/unifi/TCPPort 2018-03-09 00:22:01.000000000 -0500 |
50 |
|
|
+++ smeserver-unifi-5.6.30/root/etc/e-smith/db/configuration/defaults/unifi/TCPPort 1969-12-31 19:00:00.000000000 -0500 |
51 |
|
|
@@ -1 +0,0 @@ |
52 |
|
|
-8080,8443,8880,8843 |
53 |
|
|
diff -Nur --no-dereference smeserver-unifi-5.6.30.old/root/etc/e-smith/db/configuration/defaults/unifi/TCPPorts smeserver-unifi-5.6.30/root/etc/e-smith/db/configuration/defaults/unifi/TCPPorts |
54 |
|
|
--- smeserver-unifi-5.6.30.old/root/etc/e-smith/db/configuration/defaults/unifi/TCPPorts 1969-12-31 19:00:00.000000000 -0500 |
55 |
|
|
+++ smeserver-unifi-5.6.30/root/etc/e-smith/db/configuration/defaults/unifi/TCPPorts 2022-08-03 22:13:26.349000000 -0400 |
56 |
jpp |
1.1 |
@@ -0,0 +1 @@ |
57 |
|
|
+8080,8443,8880,8843 |
58 |
|
|
diff -Nur --no-dereference smeserver-unifi-5.6.30.old/root/etc/e-smith/db/configuration/defaults/unifi/UDPPorts smeserver-unifi-5.6.30/root/etc/e-smith/db/configuration/defaults/unifi/UDPPorts |
59 |
jpp |
1.2 |
--- smeserver-unifi-5.6.30.old/root/etc/e-smith/db/configuration/defaults/unifi/UDPPorts 1969-12-31 19:00:00.000000000 -0500 |
60 |
|
|
+++ smeserver-unifi-5.6.30/root/etc/e-smith/db/configuration/defaults/unifi/UDPPorts 2022-08-03 22:06:10.159000000 -0400 |
61 |
|
|
@@ -0,0 +1 @@ |
62 |
|
|
+3478,10001 |
63 |
jpp |
1.1 |
diff -Nur --no-dereference smeserver-unifi-5.6.30.old/root/etc/e-smith/db/configuration/force/unifi/access smeserver-unifi-5.6.30/root/etc/e-smith/db/configuration/force/unifi/access |
64 |
jpp |
1.2 |
--- smeserver-unifi-5.6.30.old/root/etc/e-smith/db/configuration/force/unifi/access 1969-12-31 19:00:00.000000000 -0500 |
65 |
|
|
+++ smeserver-unifi-5.6.30/root/etc/e-smith/db/configuration/force/unifi/access 2022-08-03 22:05:07.504000000 -0400 |
66 |
|
|
@@ -0,0 +1 @@ |
67 |
|
|
+private |
68 |
jpp |
1.1 |
diff -Nur --no-dereference smeserver-unifi-5.6.30.old/root/etc/e-smith/db/configuration/migrate/unifi smeserver-unifi-5.6.30/root/etc/e-smith/db/configuration/migrate/unifi |
69 |
jpp |
1.2 |
--- smeserver-unifi-5.6.30.old/root/etc/e-smith/db/configuration/migrate/unifi 1969-12-31 19:00:00.000000000 -0500 |
70 |
|
|
+++ smeserver-unifi-5.6.30/root/etc/e-smith/db/configuration/migrate/unifi 2022-08-03 22:18:07.024000000 -0400 |
71 |
|
|
@@ -0,0 +1,6 @@ |
72 |
|
|
+{ |
73 |
|
|
+ |
74 |
|
|
+ my $unifi = $DB->get('unifi') || $DB->new_record("unifi",{type=>'service'}); |
75 |
|
|
+ $unifi->delete_prop('TCPPort') if ( defined( $unifi->prop('TCPPort') ) and $unifi->prop('TCPPort') eq "8080,8443,8880,8843"); |
76 |
|
|
+ |
77 |
|
|
+} |
78 |
jpp |
1.3 |
diff -Nur --no-dereference smeserver-unifi-5.6.30.old/root/etc/e-smith/events/actions/upgrade_unifi_controller.sh smeserver-unifi-5.6.30/root/etc/e-smith/events/actions/upgrade_unifi_controller.sh |
79 |
|
|
--- smeserver-unifi-5.6.30.old/root/etc/e-smith/events/actions/upgrade_unifi_controller.sh 2021-11-01 21:56:56.066000000 -0400 |
80 |
|
|
+++ smeserver-unifi-5.6.30/root/etc/e-smith/events/actions/upgrade_unifi_controller.sh 2022-08-03 22:46:48.835000000 -0400 |
81 |
|
|
@@ -64,7 +64,7 @@ |
82 |
|
|
|
83 |
|
|
# Stop the local UniFi Controller service |
84 |
|
|
printf "\n" |
85 |
|
|
- service $UNIFI_SERVICE stop |
86 |
|
|
+ /usr/bin/systemctl stop $UNIFI_SERVICE |
87 |
|
|
|
88 |
|
|
# Remove previous backup directory (if it exists) |
89 |
|
|
# if [ -d "$UNIFI_BACKUP_DIR" ]; then |
90 |
|
|
@@ -101,7 +101,7 @@ |
91 |
|
|
|
92 |
|
|
# Restart the local UniFi Controller service |
93 |
|
|
printf "\n" |
94 |
|
|
- service $UNIFI_SERVICE start |
95 |
|
|
+ /usr/bin/systemctl start $UNIFI_SERVICE |
96 |
|
|
|
97 |
|
|
# All done! |
98 |
|
|
printf "\nUpgrade of UniFi Controller complete!\n" |
99 |
jpp |
1.1 |
diff -Nur --no-dereference smeserver-unifi-5.6.30.old/root/etc/e-smith/templates/usr/bin/hook-script.sh/30unifi smeserver-unifi-5.6.30/root/etc/e-smith/templates/usr/bin/hook-script.sh/30unifi |
100 |
jpp |
1.2 |
--- smeserver-unifi-5.6.30.old/root/etc/e-smith/templates/usr/bin/hook-script.sh/30unifi 1969-12-31 19:00:00.000000000 -0500 |
101 |
|
|
+++ smeserver-unifi-5.6.30/root/etc/e-smith/templates/usr/bin/hook-script.sh/30unifi 2022-08-03 22:03:07.459000000 -0400 |
102 |
|
|
@@ -0,0 +1,26 @@ |
103 |
|
|
+if [ $1 = "deploy_cert" ]; then |
104 |
|
|
+ # and now deploy our LE cert to Unifi controller ! |
105 |
|
|
+{ # in case we rely on scl again |
106 |
|
|
+ #. /opt/rh/rh-mongodb34/service-environment |
107 |
|
|
+ #. scl_source enable \$RH_MONGODB34_SCLS_ENABLED |
108 |
|
|
+} |
109 |
|
|
+ # To automatically detect DOMAIN (thanks to @SprockTech): |
110 |
|
|
+ DOMAIN=$(mongo --quiet --port 27117 --eval 'db.getSiblingDB("ace").setting.find(\{"key": "super_identity"\}).forEach(function(document)\{ print(document.hostname) \})') |
111 |
|
|
+ |
112 |
|
|
+ # Backup previous keystore |
113 |
|
|
+ cp /opt/UniFi/data/keystore /opt/UniFi/data/keystore.backup.$(date +%F_%R) |
114 |
|
|
+ |
115 |
|
|
+ # Convert cert to PKCS12 format |
116 |
|
|
+ # Ignore warnings |
117 |
|
|
+ #openssl pkcs12 -export -inkey /etc/letsencrypt/live/${DOMAIN}/privkey.pem -in /etc/letsencrypt/live/${DOMAIN}/fullchain.pem -out /etc/letsencrypt/live/${DOMAIN}/fullchain.p12 -name unifi -password pass:unifi |
118 |
|
|
+ openssl pkcs12 -export -inkey `config getprop modSSL key` -in `config getprop modSSL crt` -out /opt/UniFi/data/fullchain.p12 -name unifi -password pass:unifi 2>/dev/null |
119 |
|
|
+ |
120 |
|
|
+ # Install certificate |
121 |
|
|
+ # Ignore warnings |
122 |
|
|
+ #keytool -importkeystore -deststorepass aircontrolenterprise -destkeypass aircontrolenterprise -destkeystore /var/lib/unifi/keystore -srckeystore /etc/letsencrypt/live/${DOMAIN}/fullchain.p12 -srcstoretype PKCS12 -srcstorepass unifi -alias unifi -noprompt |
123 |
|
|
+ keytool -importkeystore -deststorepass aircontrolenterprise -destkeypass aircontrolenterprise -destkeystore /opt/UniFi/data/keystore -srckeystore /opt/UniFi/data/fullchain.p12 -srcstoretype PKCS12 -srcstorepass unifi -alias unifi -noprompt |
124 |
|
|
+ |
125 |
|
|
+ #Restart UniFi controller |
126 |
|
|
+ /usr/bin/systemctl restart unifi.service |
127 |
|
|
+fi |
128 |
|
|
+ |
129 |
jpp |
1.1 |
diff -Nur --no-dereference smeserver-unifi-5.6.30.old/root/usr/lib/systemd/system/unifi.service smeserver-unifi-5.6.30/root/usr/lib/systemd/system/unifi.service |
130 |
jpp |
1.2 |
--- smeserver-unifi-5.6.30.old/root/usr/lib/systemd/system/unifi.service 1969-12-31 19:00:00.000000000 -0500 |
131 |
|
|
+++ smeserver-unifi-5.6.30/root/usr/lib/systemd/system/unifi.service 2022-08-03 21:55:45.138000000 -0400 |
132 |
|
|
@@ -0,0 +1,20 @@ |
133 |
|
|
+# UniFi Controller systemd Service File |
134 |
|
|
+# by Steve Jenkins |
135 |
|
|
+# Last updated January 8, 2017 |
136 |
|
|
+# adapted for Koozali SME Server 10 |
137 |
|
|
+[Unit] |
138 |
|
|
+Description=Ubiquiti UniFi Controller |
139 |
|
|
+After=syslog.target network.target |
140 |
|
|
+ |
141 |
|
|
+[Service] |
142 |
|
|
+ExecStartPre=-/sbin/e-smith/service-status unifi |
143 |
|
|
+ExecStart=/usr/bin/java -Xmx1024M -jar /opt/UniFi/lib/ace.jar start |
144 |
|
|
+ExecStop=/usr/bin/java -jar /opt/UniFi/lib/ace.jar stop |
145 |
|
|
+Type=simple |
146 |
|
|
+User=ubnt |
147 |
|
|
+WorkingDirectory=/opt/UniFi |
148 |
|
|
+SuccessExitStatus=143 |
149 |
|
|
+ |
150 |
|
|
+[Install] |
151 |
|
|
+WantedBy=multi-user.target |
152 |
|
|
+WantedBy=sme-server.target |