Эх сурвалжийг харах

local wifi pwd, persistent vpn key

Danja Vasiliev 9 жил өмнө
parent
commit
53446120aa

+ 1 - 1
openwrt/common/etc/uci-defaults/21-gen-psk

@@ -1 +1 @@
-/usr/sbin/openvpn --genkey --secret /etc/host.psk
+[ -f /etc/host.psk ] || /usr/sbin/openvpn --genkey --secret /etc/host.psk

+ 6 - 6
openwrt/common/etc/uci-defaults/22-gen-htpasswd

@@ -1,6 +1,6 @@
-_PWD='changeme'
-
-_HASH=$(printf '%s' "admin:superglue:$_PWD" | md5sum | cut -d' ' -f1)
-echo "admin:superglue:$_HASH" > /etc/lighttpd/htpasswd
-
-echo -e "$_PWD\n$_PWD" | passwd root
+[ -f /etc/lighttpd/htpasswd ] || (
+  _PWD='changeme'
+  _HASH=$(printf '%s' "admin:superglue:$_PWD" | md5sum | cut -d' ' -f1)
+  echo "admin:superglue:$_HASH" > /etc/lighttpd/htpasswd
+  echo -e "$_PWD\n$_PWD" | passwd root &>/dev/null
+)