Browse Source

local wifi pwd, persistent vpn key

Danja Vasiliev 9 years ago
parent
commit
6d18623083

+ 1 - 1
openwrt/common/etc/lighttpd/lighttpd.conf

@@ -38,7 +38,7 @@ cgi.assign = (
 url.access-deny = ( "~", ".inc", ".htaccess", ".htpasswd", "htpasswd", "/tmp/" )
 url.access-deny = ( "~", ".inc", ".htaccess", ".htpasswd", "htpasswd", "/tmp/" )
 
 
 auth.backend = "htdigest"
 auth.backend = "htdigest"
-auth.backend.htdigest.userfile = "/opt/lib/htpasswd"
+auth.backend.htdigest.userfile = "/etc/lighttpd/htpasswd"
 
 
 $HTTP["url"] =~ "^/admin$|^/admin/(.*)|^/log/(.*)$" {                                                 
 $HTTP["url"] =~ "^/admin$|^/admin/(.*)|^/log/(.*)$" {                                                 
   auth.require = ( "" => (    
   auth.require = ( "" => (    

+ 0 - 6
openwrt/common/etc/passwd

@@ -1,6 +0,0 @@
-root:x:0:0:root:/root:/bin/ash
-daemon:*:1:1:daemon:/var:/bin/false
-ftp:*:55:55:ftp:/home/ftp:/bin/false
-network:*:101:101:network:/var:/bin/false
-nobody:*:65534:65534:nobody:/var:/bin/false
-httpd:*:999:999:www-data:/www:/bin/false

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

@@ -1 +1 @@
-/usr/sbin/openvpn --genkey --secret /opt/lib/host.psk 
+/usr/sbin/openvpn --genkey --secret /etc/host.psk

+ 6 - 5
openwrt/common/opt/lib/admin/admin2.cgi

@@ -14,8 +14,8 @@
 ##          406 (+ error message in debug mode) on error
 ##          406 (+ error message in debug mode) on error
 
 
 readonly _WWW='/www'
 readonly _WWW='/www'
-readonly _PWDFILE="/opt/lib/htpasswd"
-readonly _HOSTPSK='/opt/lib/host.psk'
+readonly _PWDFILE="/etc/lighhtpd/htpasswd"
+readonly _HOSTPSK='/etc/host.psk'
 readonly _TMP='/tmp'
 readonly _TMP='/tmp'
 readonly _LOG="${_WWW}/log/admin.log"
 readonly _LOG="${_WWW}/log/admin.log"
 readonly _SCRIPTS='/opt/lib/scripts'
 readonly _SCRIPTS='/opt/lib/scripts'
@@ -101,13 +101,14 @@ validIp() {
 pwdChange() {
 pwdChange() {
   local _USER='admin'
   local _USER='admin'
   local _REALM='superglue'
   local _REALM='superglue'
+  local _HASH _x
   [[ -e $_PWDFILE ]] || showMesg 'Password file not found'
   [[ -e $_PWDFILE ]] || showMesg 'Password file not found'
   [[ -z "${POST_pwd##$POST_pwdd}" ]] || showMesg 'Passwords did not match'
   [[ -z "${POST_pwd##$POST_pwdd}" ]] || showMesg 'Passwords did not match'
   [[ ${#POST_pwd} -ge 6 ]] || showMesg 'Password must be at least 6 characters long'
   [[ ${#POST_pwd} -ge 6 ]] || showMesg 'Password must be at least 6 characters long'
-  local _HASH=$(printf '%s' "$_USER:$_REALM:${POST_pwd}" | md5sum | cut -b -32) &&
-  printf '%b' "${POST_pwd}\n${POST_pwd}\n" | passwd root &&
+  read _HASH _x < <(printf '%s' "$_USER:$_REALM:${POST_pwd}" | md5sum)
+  printf '%b' "${POST_pwd}\n${POST_pwd}\n" | passwd root &>/dev/null &&
   printf '%b' "$_USER:$_REALM:$_HASH\n" > $_PWDFILE &&
   printf '%b' "$_USER:$_REALM:$_HASH\n" > $_PWDFILE &&
-  showMesg 'Password is changed' '2' ||
+  showMesg 'Password is changed' ||
   showMesg 'Password change failed!' '5'
   showMesg 'Password change failed!' '5'
 }
 }
 
 

+ 0 - 1
openwrt/common/opt/lib/htpasswd

@@ -1 +0,0 @@
-admin:superglue:dbeca8aa1272a6b13c2575ac5b234690

+ 0 - 26
openwrt/common/opt/lib/scripts/sg-ddns-update.sh

@@ -1,26 +0,0 @@
-#!/bin/bash
-
-_DOMAIN=$1
-_PSK=$(<../host.psk)
-_DATE=$(date +%s)
-
-_SGVPN='10.0.4.2'
-#_SGVPN=''
-
-trim() {
-  while read line; do
-    if [[ "$line" == "${line//#}" && "$line" == "${line//-----}" ]]; then
-      echo -n $line
-    fi
-  done <<< "$_PSK"
-}
-
-_MD5=$(trim | md5sum) 
-_MD5=${_MD5// *}
-
-_DOMAIN=$(printf '%s' $_DOMAIN | base64)
-
-_JSON='{"jsonrpc": "2.0", "client": "'$_MD5'", "domain": "'$_DOMAIN'", "sgvpn": "'$_SGVPN'"}'
-
-#wget -q --post-data "data=$_JSON" https://superglue.it/ddns/update -O -
-curl -k -d "data=$_JSON" https://superglue.it/ddns/update

+ 1 - 1
openwrt/tools/auto_scp.sh

@@ -10,7 +10,7 @@ pwd
 CMD='FILE=%f; DEST_FILE=${FILE#*/*/};
 CMD='FILE=%f; DEST_FILE=${FILE#*/*/};
 scp $FILE superglue:/$DEST_FILE; 
 scp $FILE superglue:/$DEST_FILE; 
 if [ $? -eq 0 ]; then 
 if [ $? -eq 0 ]; then 
-  play -q -n synth 0.1 tri 5000.0 gain -35;
+  play -q -n synth 0.15 tri 5000.0 gain -25;
 else
 else
   play -q -n synth 0.5 tri 500.0 gain -10;
   play -q -n synth 0.5 tri 500.0 gain -10;
 fi' 
 fi'