diff --git a/app/funct.py b/app/funct.py index 5e2076de..9edcd218 100644 --- a/app/funct.py +++ b/app/funct.py @@ -314,13 +314,14 @@ def install_haproxy(serv, **kwargs): stats_user = sql.get_setting('stats_user') stats_password = sql.get_setting('stats_password') proxy = sql.get_setting('proxy') + hapver = kwargs.get('hapver') os.system("cp scripts/%s ." % script) proxy_serv = proxy if proxy is not None else "" commands = [ "sudo chmod +x "+tmp_config_path+script+" && " +tmp_config_path+"/"+script +" PROXY=" + proxy_serv+ " SOCK_PORT="+haproxy_sock_port+" STAT_PORT="+stats_port+" STAT_FILE="+server_state_file+ - " STATS_USER="+stats_user+" STATS_PASS="+stats_password ] + " STATS_USER="+stats_user+" STATS_PASS="+stats_password+" HAPVER="+hapver] error = str(upload(serv, tmp_config_path, script)) diff --git a/app/options.py b/app/options.py index 2e238120..688de00e 100644 --- a/app/options.py +++ b/app/options.py @@ -413,7 +413,7 @@ if form.getvalue('masteradd'): os.system("rm -f %s" % script) if form.getvalue('haproxyaddserv'): - funct.install_haproxy(form.getvalue('haproxyaddserv'), syn_flood=form.getvalue('syn_flood')) + funct.install_haproxy(form.getvalue('haproxyaddserv'), syn_flood=form.getvalue('syn_flood'), hapver=form.getvalue('hapver')) if form.getvalue('installwaf'): funct.waf_install(form.getvalue('installwaf')) diff --git a/app/scripts/install_haproxy.sh b/app/scripts/install_haproxy.sh index 316b5b5d..1229cf34 100644 --- a/app/scripts/install_haproxy.sh +++ b/app/scripts/install_haproxy.sh @@ -13,6 +13,7 @@ do STATS_USER) STATS_USER=${VALUE} ;; STATS_PASS) STATS_PASS=${VALUE} ;; STAT_FILE) STAT_FILE=${VALUE} ;; + HAPVER) HAPVER=${VALUE} ;; *) esac done @@ -22,7 +23,11 @@ then export http_proxy="$PROXY" export https_proxy="$PROXY" fi - +if [ $? -eq 1 ] +then + sudo yum install wget socat -y > /dev/null + sudo wget https://repo.haproxy-wi.org/haproxy-$HAPVER.el7.x86_64.rpm --no-check-certificate +fi if [ -f /etc/haproxy/haproxy.cfg ];then echo -e 'Info: Haproxy already installed. You can edit confighere

' exit 1 @@ -31,15 +36,15 @@ set +x if hash apt-get 2>/dev/null; then sudo apt-get install haproxy socat -y else - sudo wget https://repo.haproxy-wi.org/haproxy-2.0.6-1.el7.x86_64.rpm --no-check-certificate - sudo yum install haproxy-2.0.6-1.el7.x86_64.rpm -y + sudo wget https://repo.haproxy-wi.org/haproxy-$HAPVER.el7.x86_64.rpm --no-check-certificate + sudo yum install haproxy-$HAPVER.el7.x86_64.rpm -y fi if [ $? -eq 1 ] then sudo yum install wget socat -y > /dev/null - sudo wget https://repo.haproxy-wi.org/haproxy-2.0.6-1.el7.x86_64.rpm --no-check-certificate - sudo yum install haproxy-2.0.6-1.el7.x86_64.rpm -y + sudo wget https://repo.haproxy-wi.org/haproxy-$HAPVER.el7.x86_64.rpm --no-check-certificate + sudo yum install haproxy-$HAPVER.el7.x86_64.rpm -y fi if [ $? -eq 1 ] then diff --git a/app/templates/ihap.html b/app/templates/ihap.html index 24b380dc..501b70e9 100644 --- a/app/templates/ihap.html +++ b/app/templates/ihap.html @@ -3,14 +3,19 @@ - +
NoteVersion Server SYN flood protect
- Haproxy-WI will try install haproxy-2.0.6, if it does not work then haproxy-1.15 +