20190523_jeffrey - silenceuncrio/diary GitHub Wiki

0900

目前 VPN > OpenVPN

openvpn.cgi?act=cert_status 出現 500 error

從 icos openvpn 的 log 看到

root@Cellular Router:/www/cgi-bin# cat /home/log/openvpn.log
1558382996[20190520 20:9:56] [_get_openvpn_cert_status:2656][Error] Failed to get/parse the /tmp/icos/openvpn/files.json
...

1325

commit 5766746c115134199851e098da27ba23f68b47e3
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date:   Thu May 23 13:26:57 2019 +0800

    do not specify a PATH for CGI scripts

 .../base_fs/default/rootfs/home/factory/icos/lighttpd/lighttpd.conf    | 3 ---
 1 file changed, 3 deletions(-)

發現之前的結論有錯

參考 20190520_jeffrey

cgi-bin/syslog.cgi?act=gen_log 產生 500 error 是 ParseSyslog.sh 執行失敗所導致

該 script 所在位置在 /usr/sbin/icos/ParseSyslog.sh

但不需要使用 setenv.add-environment

setenv.add-environment = ( "PATH" => "/sbin:/usr/sbin:/usr/sbin/icos" )

只要把 ParseSyslog.sh 改成絕對路徑 /usr/sbin/icos/ParseSyslog.sh 即可

diff --git a/proscend/prosrc/webcgi/syslog.c b/proscend/prosrc/webcgi/syslog.c
index 439c890..fb7d9b6 100644
--- a/proscend/prosrc/webcgi/syslog.c
+++ b/proscend/prosrc/webcgi/syslog.c
@@ -80,7 +80,7 @@ static void _gen_log()
     }

     char cmd[256];
-    sprintf(cmd, "ParseSyslog.sh %s > /tmp/gen_log.json", SYSLOG_LOG_FILE_DEF_PATH);
+    sprintf(cmd, "/usr/sbin/icos/ParseSyslog.sh %s > /tmp/gen_log.json", SYSLOG_LOG_FILE_DEF_PATH);
     system(cmd);

     json_object *log = json_object_from_file("/tmp/gen_log.json");

重新 build 一版 image

1355

satus page 回 401

趕緊修一下

commit ce11a6aee478f308de45f2a043df89b58ab7c3fb
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date:   Thu May 23 13:53:00 2019 +0800

    do not use jweb.access.filter at 'Status' page

 proscend/prosrc/webcgi/status.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

確認 System > Logging 沒問題後

來修一下 openvpn 早上遇到的現象

diff --git a/proscend/prosrc/icos/icoslib/openvpn/openvpn.c b/proscend/prosrc/icos/icoslib/openvpn/openvpn.c
index 0ec010e..e37dd42 100644
--- a/proscend/prosrc/icos/icoslib/openvpn/openvpn.c
+++ b/proscend/prosrc/icos/icoslib/openvpn/openvpn.c
@@ -137,7 +137,7 @@
 #define OPENVPN_FILES_FILE "/tmp/icos/openvpn/files.json"

 #define OPENVPN_GET_FILES_COMMAND \
-    "FilesJSON.sh " \
+    "/usr/sbin/icos/FilesJSON.sh " \
     SERVER_CERT_PATH " " \
     CLIENT_CERT_PATH " " \
     TEMP_CERT_PATH

再次重 build image

1430

openvpn.cgi?act=cert_status 正常囉

先 commit

commit 1c65ddf5a887e7feb0c45a61fcc2b06155630e1d
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date:   Thu May 23 14:29:46 2019 +0800

    use the full path of `FilesJSON.sh` or cgi with lighttpd will fail:
    - openvpn.cgi?act=cert_status

 proscend/prosrc/icos/icoslib/openvpn/openvpn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

1520

VPN > Open VPN

commit 55a096693201fb3ef843352abe31cc14951c59d0
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date:   Thu May 23 15:17:28 2019 +0800

    finish 'VPN > Open VPN'

    openvpn.cgi
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _act_apply)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _status)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _cert_status)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _cert_generate)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _info)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _download)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _import)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help)

 proscend/prosrc/webcgi/openvpn.c | 101 +++++++++++++++++++++------------------
 1 file changed, 54 insertions(+), 47 deletions(-)

1530

VPN > IPSec

commit 3c92387ac1d11fef15a1927c0a5af7026f4f9932
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date:   Thu May 23 15:30:27 2019 +0800

    finish 'VPN > IPSec'

    ipsec.cgi
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _status)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _conn_status)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _create)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _info)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _download)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _import)

 proscend/prosrc/webcgi/ipsec.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

1540

VPN > GRE

commit adae1da7735dfb7c0864e8ffee86602f58a65d57
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date:   Thu May 23 15:39:48 2019 +0800

    finish 'VPN > GRE'

    gre.cgi
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help)

 proscend/prosrc/webcgi/gre.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

1545

VPN > PPTP Server

commit fb6d004f43d1493e92ba69ba3eaf1a001b56ea91
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date:   Thu May 23 15:45:07 2019 +0800

    finish 'VPN > PPTP Server'

    pptpd.cgi
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help)

 proscend/prosrc/webcgi/pptpd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

1550

VPN > L2TP

commit d2af3223caa6187dd2770976ecb285e3a7259b2d
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date:   Thu May 23 15:48:11 2019 +0800

    finish 'VPN > L2TP'

    l2tp.cgi
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help)

 proscend/prosrc/webcgi/l2tp.c  | 8 ++++----
 proscend/prosrc/webcgi/pptpd.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

1600

Firewall > Port Forwarding

commit 5f2069917c4784ebdf4572c4dcb308806a43fa4e
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date:   Thu May 23 15:57:25 2019 +0800

    finish 'Firewall > Port Forwarding'

    dnat.cgi
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help)

 proscend/prosrc/webcgi/dnat.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

1605

Firewall > DMZ

commit 19ba753a725dc0f57f9da0723e45d2ef2aba6222
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date:   Thu May 23 16:03:21 2019 +0800

    finish 'Firewall > DMZ'

    dmz.cgi
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
    - jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help)

 proscend/prosrc/webcgi/dmz.c | 212 +++++++++++++++++++++----------------------
 1 file changed, 106 insertions(+), 106 deletions(-)

1625

M360 UI 再度小改

commit f0beab416dfa4f14e3b01f42af766aa2a9b640f8
Refs: [release/v1.01], {origin/release/v1.01}
Author: jeffrey <[email protected]>
Date:   Thu May 23 16:24:15 2019 +0800

    if user apply without selecting any bands, return fail

 proscend/prosrc/www/app/feature/lock_bands.js | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

1755

M360 UI 功能強化

commit deb660e7c80ca1bd3d78f5e2e568d6b6fe5deaee
Refs: [release/v1.01], {origin/release/v1.01}
Author: jeffrey <[email protected]>
Date:   Thu May 23 17:53:45 2019 +0800

    use lte0_proto_state and lte1_proto_state to decide the button for 'Connect Action'

 proscend/prosrc/webcgi/icos_shm.c                 | 17 ++++++
 proscend/prosrc/www/app/feature/dualSim_2apn.html |  8 ++-
 proscend/prosrc/www/app/feature/dualSim_2apn.js   | 63 +++++++++++++++++------
 proscend/prosrc/www/app/services/icos.service.js  |  3 ++
 4 files changed, 72 insertions(+), 19 deletions(-)