diff --git a/app/config.py b/app/config.py index b9fca4fe..976c5c37 100644 --- a/app/config.py +++ b/app/config.py @@ -30,7 +30,6 @@ try: except: pass -log_path = funct.get_config_var('main', 'log_path') hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir') if serv is not None: diff --git a/app/funct.py b/app/funct.py index c816287e..86c70b03 100644 --- a/app/funct.py +++ b/app/funct.py @@ -50,6 +50,10 @@ def get_data(type): def logging(serv, action, **kwargs): import sql log_path = get_config_var('main', 'log_path') + + if not os.path.exists(log_path): + os.makedirs(log_path) + try: IP = cgi.escape(os.environ["REMOTE_ADDR"]) cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE")) diff --git a/app/options.py b/app/options.py index da5b6493..d42ac3c9 100644 --- a/app/options.py +++ b/app/options.py @@ -38,6 +38,10 @@ if form.getvalue('getcert') is not None and serv is not None: if form.getvalue('ssh_cert'): name = form.getvalue('name') + + if not os.path.exists(os.getcwd())+'/keys/'): + os.makedirs(os.getcwd())+'/keys/') + ssh_keys = os.path.dirname(os.getcwd())+'/keys/'+name+'.pem' try: @@ -56,6 +60,9 @@ if serv and form.getvalue('ssl_cert'): cert_local_dir = funct.get_config_var('main', 'cert_local_dir') cert_path = sql.get_setting('cert_path') + if not os.path.exists(cert_local_dir): + os.makedirs(cert_local_dir) + if form.getvalue('ssl_name') is None: print('
Please enter desired name
') else: diff --git a/app/scripts/waf.sh b/app/scripts/waf.sh index 41bc6498..a9ac4309 100644 --- a/app/scripts/waf.sh +++ b/app/scripts/waf.sh @@ -15,7 +15,7 @@ do done - +VERSION=$(echo $VERSION | awk -F"-" '{print $1}') VERSION_MAJ=$(echo $VERSION | awk -F"." '{print $1"."$2}') if [[ $PROXY != "" ]] @@ -29,7 +29,7 @@ if [ -f $HAPROXY_PATH/waf/modsecurity.conf ];then exit 1 fi if hash apt-get 2>/dev/null; then - sudo apt-get install yajl-dev libevent-dev apache2-dev libxml2-dev gcc curl-dev -y + sudo apt install libevent-dev apache2-dev libpcre3-dev libxml2-dev gcc -y else wget -O /tmp/yajl-devel-2.0.4-4.el7.x86_64.rpm http://rpmfind.net/linux/centos/7.5.1804/os/x86_64/Packages/yajl-devel-2.0.4-4.el7.x86_64.rpm >> /dev/null wget -O /tmp/libevent-devel-2.0.21-4.el7.x86_64.rpm http://mirror.centos.org/centos/7/os/x86_64/Packages/libevent-devel-2.0.21-4.el7.x86_64.rpm >> /dev/null diff --git a/configs/hap_config/172.28.5.5.cfg b/configs/hap_config/172.28.5.5.cfg deleted file mode 100644 index 90fec49b..00000000 --- a/configs/hap_config/172.28.5.5.cfg +++ /dev/null @@ -1 +0,0 @@ -Just empty file for folder diff --git a/configs/kp_config/172.28.5.5.cfg b/configs/kp_config/172.28.5.5.cfg deleted file mode 100644 index 90fec49b..00000000 --- a/configs/kp_config/172.28.5.5.cfg +++ /dev/null @@ -1 +0,0 @@ -Just empty file for folder diff --git a/inc/script.js b/inc/script.js index ceb47afa..26859d0e 100644 --- a/inc/script.js +++ b/inc/script.js @@ -1256,7 +1256,7 @@ function change_select_waf(id) { type: "GET", success: function( data ) { console.log(data) - if(parseFloat(data) < parseFloat('1.7')) { + if(parseFloat(data) < parseFloat('1.8')) { $("#waf"+id).checkboxradio( "disable" ); } else { $("#waf"+id).checkboxradio( "enable" ); diff --git a/inc/style.css b/inc/style.css index d41776a7..7acdd373 100644 --- a/inc/style.css +++ b/inc/style.css @@ -567,15 +567,15 @@ a:focus { .alert-danger, .alert-info, .alert-success, .alert-warning, .added { width: 400px; margin-left: 15px; + margin-top: 15px; + display: block; } .alert-danger { color: #a94442; background-color: #f2dede; border-color: #ebccd1; - width: 400px; - display: block; - margin-top: 15px; - margin-bottom: -50px; + width: 400px; + margin-bottom: -50px; } .alert-success, .added{ color: #3c763d; diff --git a/install.sh b/install.sh index 26eb6bb0..8ab3be11 100644 --- a/install.sh +++ b/install.sh @@ -40,7 +40,7 @@ echo "" echo "################################" if hash apt-get 2>/dev/null; then - apt-get install git net-tools lshw dos2unix apache2 gcc netcat python3-pip g++ -y + apt-get install git net-tools lshw dos2unix apache2 gcc netcat python3-pip g++ freetype2-demos libatlas-base-dev -y HTTPD_CONFIG="/etc/apache2/apache2.conf" HAPROXY_WI_VHOST_CONF="/etc/apache2/sites-enabled/haproxy-wi.conf" HTTPD_NAME="apache2" @@ -411,9 +411,13 @@ echo "################################" sudo mkdir /var/www/$HOME_HAPROXY_WI/app/certs sudo mkdir /var/www/$HOME_HAPROXY_WI/keys +sudo mkdir /var/www/$HOME_HAPROXY_WI/configs/ +sudo mkdir /var/www/$HOME_HAPROXY_WI/configs/hap_config/ +sudo mkdir /var/www/$HOME_HAPROXY_WI/configs/kp_config/ +sudo mkdir /var/www/$HOME_HAPROXY_WI/log/ sudo sudo chmod +x /var/www/$HOME_HAPROXY_WI/app/*.py sudo chmod +x /var/www/$HOME_HAPROXY_WI/app/tools/*.py -sudo rm -f /var/www/$HOME_HAPROXY_WI/log/config_edit.log + cd /var/www/$HOME_HAPROXY_WI/app ./update_db.py if hash apt-get 2>/dev/null; then diff --git a/log/config_edit.log b/log/config_edit.log deleted file mode 100644 index 8b137891..00000000 --- a/log/config_edit.log +++ /dev/null @@ -1 +0,0 @@ - diff --git a/update.sh b/update.sh index b950745d..0bd191f1 100644 --- a/update.sh +++ b/update.sh @@ -16,97 +16,6 @@ else yum -y install git nmap-ncat net-tools python34 dos2unix python34-pip httpd python34-devel gcc-c++ fi -at << EOF > /etc/systemd/system/multi-user.target.wants/checker_haproxy.service -[Unit] -Description=Haproxy backends state checker -After=syslog.target network.target - -[Service] -Type=simple -WorkingDirectory=$(pwd)/app/ -ExecStart=$(pwd)/app/tools/checker_master.py - -StandardOutput=syslog -StandardError=syslog -SyslogIdentifier=checker - -RestartSec=2s -Restart=on-failure -TimeoutStopSec=1s - -[Install] -WantedBy=multi-user.target -EOF - -cat << EOF > /etc/rsyslog.d/checker.conf -if $programname startswith 'checker' then $(pwd)/log/checker-error.log -& stop -EOF - -cat << EOF > /etc/logrotate.d/checker -$(pwd)/log/checker-error.log { - daily - rotate 10 - missingok - notifempty - create 0644 apache apache - dateext - sharedscripts -} -EOF - -cat << EOF > /etc/systemd/system/multi-user.target.wants/metrics_haproxy.service -[Unit] -Description=Haproxy metrics -After=syslog.target network.target - -[Service] -Type=simple -WorkingDirectory=$(pwd)/app/ -ExecStart=$(pwd)/app/tools/metrics_master.py - -StandardOutput=syslog -StandardError=syslog -SyslogIdentifier=metrics - -RestartSec=2s -Restart=on-failure -TimeoutStopSec=1s - -[Install] -WantedBy=multi-user.target -EOF - -cat << EOF > /etc/rsyslog.d/metrics.conf -if $programname startswith 'metrics' then $(pwd)/log/metrics-error.log -& stop -EOF - -cat << EOF > /etc/logrotate.d/metrics -$(pwd)/log/metrics-error.log { - daily - rotate 10 - missingok - notifempty - create 0644 apache apache - dateext - sharedscripts -} -EOF - -sed -i 's/#$UDPServerRun 514/$UDPServerRun 514/g' /etc/rsyslog.conf -sed -i 's/#$ModLoad imudp/$ModLoad imudp/g' /etc/rsyslog.conf - -systemctl daemon-reload -systemctl restart logrotate -systemctl restart rsyslog -systemctl restart cmetrics_haproxy.service -systemctl restart checker_haproxy.service -systemctl enable metrics_haproxy.service -systemctl enable checker_haproxy.service - -chown -R apache:apache * - cd app/ ./update_db.py