mirror of https://github.com/Aidaho12/haproxy-wi
parent
5b402b597b
commit
f934aff44c
|
@ -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:
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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('<div class="alert alert-danger">Please enter desired name</div>')
|
||||
else:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Just empty file for folder
|
|
@ -1 +0,0 @@
|
|||
Just empty file for folder
|
|
@ -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" );
|
||||
|
|
|
@ -567,14 +567,14 @@ 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;
|
||||
}
|
||||
.alert-success, .added{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
|
91
update.sh
91
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue