Browse Source

Before ading WAN controls

master
Evgeny Gagua 2 years ago
parent
commit
316681c4be
  1. 4
      cert_cp.php
  2. 1
      index.php
  3. 112
      lib/scripts/distro_web_utils.php
  4. 19
      lib/scripts/sys_utils.php
  5. 10
      lib/scripts/wifi_ap_disable.sh
  6. 11
      lib/scripts/wifi_ap_enable.sh
  7. 9
      lib/scripts/wifi_ap_off.sh
  8. 11
      lib/scripts/wifi_ap_on.sh
  9. 17
      lib/sysroot/srv/etc/ag_nginx/sites-available/default
  10. 1
      lib/sysroot/srv/etc/boot.php
  11. 53
      lib/sysroot/srv/etc/cron.php
  12. 109
      lib/sysroot/srv/etc/nginx/default
  13. 109
      lib/sysroot/srv/etc/nginx/default.nossl
  14. 102
      lib/sysroot/srv/etc/nginx/default.ssl
  15. 11
      lib/sysroot/srv/etc/pereodical.php
  16. 2
      lib/sysroot/srv/etc/system.json
  17. 10
      task_wait.php

4
cert_cp.php

@ -4,8 +4,10 @@
require_once('../../scripts/distro_web_utils.php'); require_once('../../scripts/distro_web_utils.php');
print_PAGE_HEADER(); print_PAGE_HEADER();
if( $SYS_CONFIG['NGINX_AUTH_IS_SET'] == false ) {
if( isset( $SYS_CONFIG['NGINX_AUTH_IS_SET'] ) ){
if( $SYS_CONFIG['NGINX_AUTH_IS_SET'] == false ) {
print_AUTH_WARNING(); print_AUTH_WARNING();
};
}; };
print_CONNECTION_INFO(); print_CONNECTION_INFO();
print_CERT_INFO(); print_CERT_INFO();

1
index.php

@ -13,6 +13,7 @@
print_CERT_INFO(); print_CERT_INFO();
print_APPLICATION_INFO(); print_APPLICATION_INFO();
print_TIME_INFO(); print_TIME_INFO();
print_LAST_TASK_LOG();
print_PAGE_BOTTOM(); print_PAGE_BOTTOM();
?> ?>

112
lib/scripts/distro_web_utils.php

@ -258,7 +258,7 @@ function print_APPLICATION_INFO(){
<?php <?php
}; };
?> ?>
<td align="center"><a class="task_panel_btn" id="histowipe" href="/task_confirm.php?TID=19">Wipe History Data</a></td>
<td align="center"><a class="task_panel_btn" id="histowipe" href="/task_wait.php?TID=19">Wipe History Data</a></td>
<td align="center"><a class="task_panel_btn" id="reboot" href="/task_confirm.php?TID=18">Reset to Factory Defaults</a></td> <td align="center"><a class="task_panel_btn" id="reboot" href="/task_confirm.php?TID=18">Reset to Factory Defaults</a></td>
</tr> </tr>
</table><br/><?php </table><br/><?php
@ -656,6 +656,66 @@ function startTimeSync(){
cts = ((new Date())/1000); cts = ((new Date())/1000);
window.location.href = '/task_wait.php?TID=4&CTS='+cts; window.location.href = '/task_wait.php?TID=4&CTS='+cts;
}; };
function setTimeManuall(){
var Year = document.getElementById('Y_v').value;
var Month = document.getElementById('M_v').value;
var Day = document.getElementById('D_v').value;
var Hour = document.getElementById('h_v').value;
var Minutes = document.getElementById('m_v').value;
var Seconds = document.getElementById('s_v').value;
window.location.href = '/task_wait.php?TID=25&CTSY='+Year+'&CTSM='+Month+'&CTSD='+Day+'&CTSH='+Hour+'&CTSX='+Minutes+'&CTSS='+Seconds;
};
const bcts = new Date();
function setupCTD(){
var tT = document.getElementById('Y_v');
for( i = bcts.getYear()-10; i< bcts.getYear()+10; i++ ){
var option = document.createElement("option");
option.value = i+1900;
option.text = i+1900;
tT.appendChild(option);
};
tT.value = bcts.getYear()+1900;
tT = document.getElementById('M_v');
for( i = 1; i< 13; i++ ){
var option = document.createElement("option");
option.value = i;
option.text = i;
tT.appendChild(option);
};
tT.value = bcts.getMonth()+1;
tT = document.getElementById('D_v');
for( i = 1; i< 32; i++ ){
var option = document.createElement("option");
option.value = i;
option.text = i;
tT.appendChild(option);
};
tT.value = bcts.getDate();
tT = document.getElementById('h_v');
for( i = 0; i< 24; i++ ){
var option = document.createElement("option");
option.value = i;
option.text = i;
tT.appendChild(option);
};
tT.value = bcts.getHours();
tT = document.getElementById('m_v');
for( i = 0; i< 60; i++ ){
var option = document.createElement("option");
option.value = i;
option.text = i;
tT.appendChild(option);
};
tT.value = bcts.getMinutes();
tT = document.getElementById('s_v');
for( i = 0; i< 60; i++ ){
var option = document.createElement("option");
option.value = i;
option.text = i;
tT.appendChild(option);
};
tT.value = bcts.getSeconds();
};
</script> </script>
<form id="ts_form" method="post" enctype="multipart/form-data" action="/task_wait.php" > <form id="ts_form" method="post" enctype="multipart/form-data" action="/task_wait.php" >
<input type="hidden" name="TID" value="7"> <input type="hidden" name="TID" value="7">
@ -675,6 +735,19 @@ function startTimeSync(){
<tr><td colspan=3><hr></td></tr> <tr><td colspan=3><hr></td></tr>
<tr><td align="right">Platform Time</td><td><b><?=$CT['TIME'];?></b></td><td><a class="link_buton" href="#" onclick="startTimeSync();">Sync To Browser</a></td></tr> <tr><td align="right">Platform Time</td><td><b><?=$CT['TIME'];?></b></td><td><a class="link_buton" href="#" onclick="startTimeSync();">Sync To Browser</a></td></tr>
<tr><td colspan=3><hr></td></tr> <tr><td colspan=3><hr></td></tr>
<tr><td align="right">Manual Set Date/Time</td><td>
<table>
<tr>
<td><select id="Y_v"></select></td><td>-</td>
<td><select id="M_v"></select></td><td>-</td>
<td><select id="D_v"></select></td><td>&nbsp;</td>
<td><select id="h_v"></select></td><td>:</td>
<td><select id="m_v"></select></td><td>:</td>
<td><select id="s_v"></select></td>
</tr>
</table>
</td><td><a class="link_buton" href="#" onclick="setTimeManuall();">Set Value</a></td></tr>
<tr><td colspan=3><hr></td></tr>
<tr><td>NTP Synchronization is Enabled</td><td><?=$CT['NTP'];?></td><td><?php <tr><td>NTP Synchronization is Enabled</td><td><?=$CT['NTP'];?></td><td><?php
if( stripos( $CT['NTP'],'YES')!== false ){ if( stripos( $CT['NTP'],'YES')!== false ){
?><a class="link_buton" href="/task_wait.php?TID=6">Disable NTP Sync</a><?php ?><a class="link_buton" href="/task_wait.php?TID=6">Disable NTP Sync</a><?php
@ -687,6 +760,9 @@ function startTimeSync(){
</table> </table>
</form> </form>
<br/> <br/>
<script>
setupCTD();
</script>
<?php <?php
}; };
@ -719,7 +795,7 @@ function print_NIF_SETTINGS_PREVIEW( $NIF ){
$SYS_CONFIG['NEW_NET_CONFIG'][$N['ifname']]['net']['address'] = $_POST['ADR']; $SYS_CONFIG['NEW_NET_CONFIG'][$N['ifname']]['net']['address'] = $_POST['ADR'];
$SYS_CONFIG['NEW_NET_CONFIG'][$N['ifname']]['net']['netmask'] = $_POST['MASK']; $SYS_CONFIG['NEW_NET_CONFIG'][$N['ifname']]['net']['netmask'] = $_POST['MASK'];
$SYS_CONFIG['NEW_NET_CONFIG'][$N['ifname']]['net']['network'] = get_Network( $_POST['ADR'], $_POST['MASK'] ); $SYS_CONFIG['NEW_NET_CONFIG'][$N['ifname']]['net']['network'] = get_Network( $_POST['ADR'], $_POST['MASK'] );
$SYS_CONFIG['NEW_NET_CONFIG'][$N['ifname']]['net']['gateway'] = get_NetGateway( $_POST['ADR'], $_POST['MASK'] );
$SYS_CONFIG['NEW_NET_CONFIG'][$N['ifname']]['net']['gateway'] = $_POST['GW'];//get_NetGateway( $_POST['ADR'], $_POST['MASK'] );
$SYS_CONFIG['NEW_NET_CONFIG'][$N['ifname']]['net']['broadcast'] = get_NetBroadcast( $_POST['ADR'], $_POST['MASK'] ); $SYS_CONFIG['NEW_NET_CONFIG'][$N['ifname']]['net']['broadcast'] = get_NetBroadcast( $_POST['ADR'], $_POST['MASK'] );
}; };
$CC = $SYS_CONFIG['NEW_NET_CONFIG'][$N['ifname']]['net']; $CC = $SYS_CONFIG['NEW_NET_CONFIG'][$N['ifname']]['net'];
@ -810,23 +886,31 @@ function print_TASK_INFO(){
</table><?php </table><?php
}; };
function print_LAST_TASK_LOG(){
if( file_exists('/srv/tmp/task_log.var') ){
$DATA = nl2br( file_get_contents( '/srv/tmp/task_log.var' ));
?><table class="w_panel" width="100%" border=0>
<tr><td style="font-size:20px; padding-bottom: 10px;">Last Task Log Messages</td></tr>
</table>
<table class="w_panel" width="100%" border=0>
<tr><td align="left"><?=$DATA;?></td>
</table><?php
};
};
function print_GO_BACK(){ function print_GO_BACK(){
?><html><head><script>window.addEventListener("load",(event)=>{history.go(-1);});</script></head><body></body></html><?php ?><html><head><script>window.addEventListener("load",(event)=>{history.go(-1);});</script></head><body></body></html><?php
}; };
function print_TASK_CONFIRM( $TID ){ function print_TASK_CONFIRM( $TID ){
print_GO_BACK();
exit();
?>
TASK: <?=$TID;?>
switch($TID){ switch($TID){
case 18:{
echo "Are You Sure to Delete all Application Settings?";
break;
};
case 19:{
echo "Are You Sure to Delete all Reports Data and Video Files?";
break;
};
case
}; };
<?php
}; };
function print_TASK_PANEL(){ function print_TASK_PANEL(){
@ -851,11 +935,11 @@ function print_TASK_PANEL(){
?><a class="task_panel_btn" id="samba_start" href="/task_wait.php?TID=2">Start Samba</a><?php ?><a class="task_panel_btn" id="samba_start" href="/task_wait.php?TID=2">Start Samba</a><?php
}; };
?></td><td align="center"><?php ?></td><td align="center"><?php
if( $SYS_CONFIG['WIFI_SETUP'] ){
if( $SYS_CONFIG['WIFI_SETUP'] || 1 ){
if( $SYS_CONFIG['WIFI_IS_ON'] ){ if( $SYS_CONFIG['WIFI_IS_ON'] ){
?><a class="task_panel_btn" id="samba_stop" href="/">Disable WiFi</a><?php
?><a class="task_panel_btn" id="samba_stop" href="/task_wait.php?TID=21">Disable WiFi</a><?php
} else { } else {
?><a class="task_panel_btn" id="wifi_ap" href="/">Enable WiFi</a><?php
?><a class="task_panel_btn" id="wifi_ap" href="/task_wait.php?TID=22">Enable WiFi</a><?php
}; };
} else { } else {
?><div class="task_panel_btn" id="wifi_na" href="/">WiFi</div><?php ?><div class="task_panel_btn" id="wifi_na" href="/">WiFi</div><?php

19
lib/scripts/sys_utils.php

@ -29,7 +29,7 @@ function reload_system_config(){
function out_log( $str ){ function out_log( $str ){
$FD = fopen( '/srv/etc/task_log.var', "a+" );
$FD = fopen( '/srv/tmp/task_log.var', "a+" );
if( $FD ){ if( $FD ){
fprintf( $FD, "%s\n", trim($str) ); fprintf( $FD, "%s\n", trim($str) );
fclose( $FD ); fclose( $FD );
@ -52,7 +52,7 @@ function run_command( $CMD ){
function create_cron_task( $TID, $Params = '' ){ function create_cron_task( $TID, $Params = '' ){
if( file_exists( '/srv/etc/cron.json' ) ) return false; if( file_exists( '/srv/etc/cron.json' ) ) return false;
@unlink( '/srv/etc/task_log.var' );
@unlink( '/srv/tmp/task_log.var' );
$Data['operation'] = intval( $TID ); $Data['operation'] = intval( $TID );
if( $Params!= '' ){ if( $Params!= '' ){
$Data['parameter'] = $Params; $Data['parameter'] = $Params;
@ -1100,9 +1100,9 @@ function apply_application_config( $A, $DBF ){
function set_factory_settings(){ function set_factory_settings(){
stop_BACKEND_APPLICATION(); stop_BACKEND_APPLICATION();
$R = `rm -f -R /srv/www/web/lib/controller/data/uploads/*`;
$R = `rm -f -R /srv/www/web/lib/controller/data/device_draws/*`;
$R = `rm -f -R /srv/www/web/lib/controller/data/videos/*`;
$R = `rm -f -R /srv/www/web/lib/controller/data/uploads/*`;//*/
$R = `rm -f -R /srv/www/web/lib/controller/data/device_draws/*`;//*/
$R = `rm -f -R /srv/www/web/lib/controller/data/videos/*`;//*/
$SRC = '/srv/www/distro/lib/data/mysqlitedb.db'; $SRC = '/srv/www/distro/lib/data/mysqlitedb.db';
$DST = '/srv/www/web/lib/controller/data/mysqlitedb.db'; $DST = '/srv/www/web/lib/controller/data/mysqlitedb.db';
$R = `rm -f $DST`; $R = `rm -f $DST`;
@ -1116,11 +1116,10 @@ function set_factory_settings(){
function clear_history(){ function clear_history(){
stop_BACKEND_APPLICATION(); stop_BACKEND_APPLICATION();
$R = `rm -f -R /srv/www/web/lib/controller/data/videos/*`;
$SRC = '/srv/www/distro/lib/data/reports.db';
$DST = '/srv/www/web/lib/controller/data/reports.db';
$R = `rm -f $DST`;
$C = `cp $SRC $DST`;
$CMD = `rm -R /srv/www/web/lib/controller/data/reports`;
$CMD = `mkdir /srv/www/web/lib/controller/data/reports`;
$CMD = `chown www-data:www-data /srv/www/web/lib/controller/data/reports`;
$CMD = `chmod 775 /srv/www/web/lib/controller/data/reports`;
start_BACKEND_APPLICATION(); start_BACKEND_APPLICATION();
}; };

10
lib/scripts/wifi_ap_disable.sh

@ -0,0 +1,10 @@
#!/bin/bash
ip link set wlan0 down
ip link set wlan1 down
systemctl stop hostapd
systemctl disable hostapd
killall hostapd
systemctl daemon-reload
systemctl restart dnsmasq

11
lib/scripts/wifi_ap_enable.sh

@ -0,0 +1,11 @@
#!/bin/bash
ip link set wlan0 up
ip link set wlan1 up
systemctl daemon-reload
#systemctl enable dnsmasq
systemctl enable hostapd
systemctl daemon-reload
systemctl restart dnsmasq
systemctl start hostapd

9
lib/scripts/wifi_ap_off.sh

@ -0,0 +1,9 @@
#!/bin/bash
ip link set wlan0 down
ip link set wlan1 down
systemctl stop hostapd
killall hostapd
systemctl restart dnsmasq

11
lib/scripts/wifi_ap_on.sh

@ -0,0 +1,11 @@
#!/bin/bash
ip link set wlan0 up
ip link set wlan1 up
#systemctl daemon-reload
#systemctl enable dnsmasq
#systemctl enable hostapd
#systemctl daemon-reload
systemctl restart dnsmasq
systemctl start hostapd

17
lib/sysroot/srv/etc/ag_nginx/sites-available/default

@ -49,3 +49,20 @@ server {
deny all; deny all;
} }
} }
server {
listen 9090 default_server;
listen [::]:9090 default_server;
#add_header X-Content-Type-Options nosniff;
root /srv/www/distro;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
#proxy_pass http://192.168.0.100:80;
proxy_pass http://192.168.200.124:80;
}
}

1
lib/sysroot/srv/etc/boot.php

@ -4,6 +4,7 @@
unset( $SYS_CONFIG['NET_INFO'] ); unset( $SYS_CONFIG['NET_INFO'] );
unset( $SYS_CONFIG['NET_CONFIG'] ); unset( $SYS_CONFIG['NET_CONFIG'] );
$SYS_CONFIG['NET_CONFIG'] = get_network_config(); $SYS_CONFIG['NET_CONFIG'] = get_network_config();
$SYS_CONFIG['PERIODIC_JOB_COUNTS'] = 0;
$TD = get_SERVICE_STATUS( 'smbd' ); $TD = get_SERVICE_STATUS( 'smbd' );
$SYS_CONFIG['SAMBA_IS_ON'] = $TD['ENA']; $SYS_CONFIG['SAMBA_IS_ON'] = $TD['ENA'];
$SYS_CONFIG['ARGUS_CONFIG'] = get_argus_config(); $SYS_CONFIG['ARGUS_CONFIG'] = get_argus_config();

53
lib/sysroot/srv/etc/cron.php

@ -207,6 +207,59 @@
clear_history(); clear_history();
break; break;
}; };
case 20:{
//create Backup of data
break;
};
case 21:{
//Turn Off WiFi AP till Reboot And then Kill after 5 minutes
$L=`/srv/scripts/wifi_ap_off.sh`;
$SYS_CONFIG['WIFI_IS_ON'] = false;
$SYS_CONFIG['WIFI_MODE'] = 1;
save_system_config();
break;
};
case 22:{
//Turn On Wifi AP And Enable Killing Wifi AP after 5 minutes
if( $SYS_CONFIG['WIFI_MODE'] == 0 ){
$L=`/srv/scripts/wifi_ap_enable.sh`;
} else {
$L=`/srv/scripts/wifi_ap_on.sh`;
$SYS_CONFIG['PERIODIC_JOB_COUNTS'] = 0; //reset counter
};
$SYS_CONFIG['WIFI_IS_ON'] = true;
$SYS_CONFIG['WIFI_MODE'] = 1;
save_system_config();
break;
};
case 23:{
//Turn On Wifi AP And Disable Killing Wifi AP after 5 minutes
$L=`/srv/scripts/wifi_ap_enable.sh`;
$SYS_CONFIG['WIFI_IS_ON'] = true;
$SYS_CONFIG['WIFI_MODE'] = 2;
save_system_config();
break;
};
case 24:{
//Turn Off WiFi AP And disable
$L=`/srv/scripts/wifi_ap_disable.sh`;
$SYS_CONFIG['WIFI_IS_ON'] = false;
$SYS_CONFIG['WIFI_MODE'] = 0;
save_system_config();
break;
};
case 25:{
//Set manually time
// set-time [TIME]
//Set the system clock to the specified time. This will also update the RTC time accordingly. The time may be specified in the forma
///"2012-10-30 18:17:16".
$CMD = "timedatectl set-time \"{$CRON_CONFIG['parameter']}\"";
$L=`$CMD`;
// Aster Set Date-Time performe reboot
$L = `reboot`;
exit();
break;
};
}; };
}; };
?> ?>

109
lib/sysroot/srv/etc/nginx/default

@ -0,0 +1,109 @@
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
client_max_body_size 400M;
# SSL configuration
#
#listen 443 ssl default_server;
#listen [::]:443 ssl default_server;
#add_header Strict-Transport-Security "max-age=0;";
#add_header X-XSS-Protection "0";
#add_header X-XSS-Protection "1; mode=block";
#add_header X-Frame-Options "SAMEORIGIN";
#add_header X-Content-Type-Options nosniff;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
#include /srv/etc/nginx/self-signed.conf;
#include /srv/etc/nginx/ssl-params.conf;
root /srv/www/web;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
index index.html index.php;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
#keepalive_timeout 0;
include snippets/fastcgi-php.conf;
#fastcgi_hide_header X-Frame-Options;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~* /jsapi_dynamic/.+\.js$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
location /video_feed/ {
proxy_pass http://127.0.0.1:8972;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 20s; # time to open a connection to the proxy before we give up
proxy_send_timeout 20s; # timeout for transmitting a request to the proxied server
proxy_read_timeout 20s; # timeout for reading a response from the proxied server - did it send back anything before this has expired
send_timeout 20s; # timeout for sending a response to the requesting client - note this isn't proxy_send_timeout, but the time between two successive write operations to the requesting client (ie. browser)
reset_timedout_connection on;
}
location /video_view/ {
proxy_pass http://127.0.0.1:8974;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 20s; # time to open a connection to the proxy before we give up
proxy_send_timeout 20s; # timeout for transmitting a request to the proxied server
proxy_read_timeout 20s; # timeout for reading a response from the proxied server - did it send back anything before this has expired
send_timeout 20s; # timeout for sending a response to the requesting client - note this isn't proxy_send_timeout, but the time between two successive write operations to the requesting client (ie. browser)
reset_timedout_connection on;
}
location ~ /\.ht {
deny all;
}
}

109
lib/sysroot/srv/etc/nginx/default.nossl

@ -0,0 +1,109 @@
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
client_max_body_size 400M;
# SSL configuration
#
#listen 443 ssl default_server;
#listen [::]:443 ssl default_server;
#add_header Strict-Transport-Security "max-age=0;";
#add_header X-XSS-Protection "0";
#add_header X-XSS-Protection "1; mode=block";
#add_header X-Frame-Options "SAMEORIGIN";
#add_header X-Content-Type-Options nosniff;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
#include /srv/etc/nginx/self-signed.conf;
#include /srv/etc/nginx/ssl-params.conf;
root /srv/www/web;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
index index.html index.php;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
#keepalive_timeout 0;
include snippets/fastcgi-php.conf;
#fastcgi_hide_header X-Frame-Options;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~* /jsapi_dynamic/.+\.js$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
location /video_feed/ {
proxy_pass http://127.0.0.1:8972;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 20s; # time to open a connection to the proxy before we give up
proxy_send_timeout 20s; # timeout for transmitting a request to the proxied server
proxy_read_timeout 20s; # timeout for reading a response from the proxied server - did it send back anything before this has expired
send_timeout 20s; # timeout for sending a response to the requesting client - note this isn't proxy_send_timeout, but the time between two successive write operations to the requesting client (ie. browser)
reset_timedout_connection on;
}
location /video_view/ {
proxy_pass http://127.0.0.1:8974;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 20s; # time to open a connection to the proxy before we give up
proxy_send_timeout 20s; # timeout for transmitting a request to the proxied server
proxy_read_timeout 20s; # timeout for reading a response from the proxied server - did it send back anything before this has expired
send_timeout 20s; # timeout for sending a response to the requesting client - note this isn't proxy_send_timeout, but the time between two successive write operations to the requesting client (ie. browser)
reset_timedout_connection on;
}
location ~ /\.ht {
deny all;
}
}

102
lib/sysroot/srv/etc/nginx/default.ssl

@ -0,0 +1,102 @@
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
include /srv/etc/nginx/host.conf;
include /srv/etc/nginx/params.conf;
add_header X-Content-Type-Options nosniff;
root /srv/www/web;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
index index.html index.php;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~* /jsapi_dynamic/.+\.js$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
location /video_feed/ {
proxy_pass http://127.0.0.1:8972;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 20s; # time to open a connection to the proxy before we give up
proxy_send_timeout 20s; # timeout for transmitting a request to the proxied server
proxy_read_timeout 20s; # timeout for reading a response from the proxied server - did it send back anything before this has expired
send_timeout 20s; # timeout for sending a response to the requesting client - note this isn't proxy_send_timeout, but the time between two successive write operations to the requesting client (ie. browser)
reset_timedout_connection on;
}
location /video_view/ {
proxy_pass http://127.0.0.1:8974;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 20s; # time to open a connection to the proxy before we give up
proxy_send_timeout 20s; # timeout for transmitting a request to the proxied server
proxy_read_timeout 20s; # timeout for reading a response from the proxied server - did it send back anything before this has expired
send_timeout 20s; # timeout for sending a response to the requesting client - note this isn't proxy_send_timeout, but the time between two successive write operations to the requesting client (ie. browser)
reset_timedout_connection on;
}
location ~ /\.ht {
deny all;
}
}

11
lib/sysroot/srv/etc/pereodical.php

@ -1,4 +1,11 @@
<?php <?php
require_once( '/srv/scripts/sys_utils.php' );
$SYS_CONFIG['PERIODIC_JOB_COUNTS']++;
if( $SYS_CONFIG['WIFI_MODE'] == 1 ){
if( $SYS_CONFIG['PERIODIC_JOB_COUNTS'] == 5 ){
$L=`/srv/scripts/wifi_ap_off.sh`;
$SYS_CONFIG['WIFI_IS_ON'] = false;
};
};
save_system_config();
?> ?>

2
lib/sysroot/srv/etc/system.json

@ -1 +1 @@
{"SAMBA_IS_ON":true,"ARGUS_CONFIG":{"app_is_running":false,"webui_is_running":true},"NET_CONFIG":{"lo":{"flags":{"hotplug":0,"auto":0},"net":[],"fam":"inet","mode":"loopback"},"eth0":{"flags":{"hotplug":1,"auto":1},"net":[],"fam":"inet","mode":"dhcp"}}}
{"SAMBA_IS_ON":true,"ARGUS_CONFIG":{"app_is_running":true,"webui_is_running":true},"PERIODIC_JOB_COUNTS":0,"NET_CONFIG":{"lo":{"flags":{"hotplug":0,"auto":1},"net":[],"fam":"inet","mode":"loopback"},"enp6s0":{"flags":{"hotplug":1,"auto":0},"net":[],"fam":"inet","mode":"dhcp"}}}

10
task_wait.php

@ -13,6 +13,16 @@
case 4: $CPARAM = intval( $_GET['CTS'] ); break; case 4: $CPARAM = intval( $_GET['CTS'] ); break;
case 7: $CPARAM = $_POST['CTZ']; break; case 7: $CPARAM = $_POST['CTZ']; break;
case 15: $CPARAM = $_POST['FID']; break; case 15: $CPARAM = $_POST['FID']; break;
case 25:{
$CPARAM = sprintf( "%04d-%02d-%02d %02d:%02d:%02d",
intval( $_GET['CTSY'] ),
intval( $_GET['CTSM'] ),
intval( $_GET['CTSD'] ),
intval( $_GET['CTSH'] ),
intval( $_GET['CTSX'] ),
intval( $_GET['CTSS'] ));
break;
};
}; };
if( !create_cron_task( $CTID, $CPARAM ) ){ if( !create_cron_task( $CTID, $CPARAM ) ){
header('location: /'); header('location: /');

Loading…
Cancel
Save