Pavel Loginov 4 years ago
parent e9c28c95a7
commit c5067cd5bc

@ -570,7 +570,7 @@ if act == "overviewServers":
async def async_get_overviewServers(serv1, serv2, service):
if service == 'haproxy':
cmd = 'echo "show info" |nc %s %s -w 1|grep -e "Ver\|CurrConns\|Maxco\|MB\|Uptime:"' % (serv2, sql.get_setting('haproxy_sock_port'))
cmd = 'echo "show info" |nc %s %s -w 1|grep -e "node\|Nbproc\|Maxco\|MB\|Peers\|Nbthread"' % (serv2, sql.get_setting('haproxy_sock_port'))
out = funct.subprocess_execute(cmd)
out1 = ""
@ -2099,6 +2099,7 @@ if form.getvalue('lets_domain'):
lets_email = form.getvalue('lets_email')
proxy = sql.get_setting('proxy')
ssl_path = sql.get_setting('cert_path')
haproxy_dir = sql.get_setting('haproxy_dir')
script = "letsencrypt.sh"
ssh_enable, ssh_user_name, ssh_user_password, ssh_key_name = funct.return_ssh_keys_path(serv)
@ -2116,7 +2117,7 @@ if form.getvalue('lets_domain'):
else:
proxy_serv = ''
commands = ["chmod +x " + script + " && ./" + script + " PROXY=" + proxy_serv +
commands = ["chmod +x " + script + " && ./" + script + " PROXY=" + proxy_serv + " haproxy_dir=" + haproxy_dir +
" DOMAIN=" + lets_domain + " EMAIL=" + lets_email + " SSH_PORT=" + ssh_port + " SSL_PATH=" + ssl_path +
" HOST=" + serv + " USER=" + ssh_user_name + " PASS=" + ssh_user_password + " KEY=" + ssh_key_name]
@ -2207,7 +2208,7 @@ if form.getvalue('scan_ports') is not None:
ip = s[2]
cmd = "sudo nmap -sS %s |grep -E '^[[:digit:]]'|sed 's/ */ /g'" % ip
cmd1 = "sudo nmap -sS %s |head -5|tail -3" % ip
cmd1 = "sudo nmap -sS %s |head -5|tail -2" % ip
stdout, stderr = funct.subprocess_execute(cmd)
stdout1, stderr1 = funct.subprocess_execute(cmd1)

@ -6,6 +6,13 @@ country_location="GeoLite2-Country-CSV_*/GeoLite2-Country-Locations-en.csv"
country_ip="GeoLite2-Country-CSV_*/GeoLite2-Country-Blocks-IPv4.csv"
haproxy_dir="{{haproxy_dir}}"
MAXMIND_LICENSE="{{maxmind_key}}"
PROXY="{{PROXY}}"
if [[ $PROXY != "" ]]
then
export http_proxy="$PROXY"
export https_proxy="$PROXY"
fi
cd /tmp
@ -40,4 +47,6 @@ if [[ ! -d "$haproxy_dir"/geoip ]]; then
mkdir "$haproxy_dir"/geoip
fi
cp subnets/* "$haproxy_dir"/geoip
cp subnets/* "$haproxy_dir"/geoip
systemctl reload haproxy

@ -35,10 +35,15 @@
- name: Combine into pem file
shell: cat /etc/letsencrypt/live/{{DOMAIN}}/fullchain.pem /etc/letsencrypt/live/{{DOMAIN}}/privkey.pem > "{{SSL_PATH}}"/"{{DOMAIN}}".pem
- name: Creates directory
file:
path: "{{haproxy_dir}}/scripts"
state: directory
- name: Copy renew script
template:
src: /var/www/haproxy-wi/app/scripts/ansible/roles/renew_letsencrypt.j2
dest: /etc/haproxy/renew_letsencrypt.sh
dest: "{{haproxy_dir}}/scripts/renew_letsencrypt.sh"
mode: '0755'
ignore_errors: yes
failed_when: false
@ -48,4 +53,4 @@
cron:
name: "Let's encrypt renew script"
special_time: "monthly"
job: '/etc/haproxy/renew_letsencrypt.sh'
job: '{{haproxy_dir}}/scripts/renew_letsencrypt.sh'

@ -20,4 +20,4 @@ for i in $(ls -d */ |awk -F"/" '{print $1}'); do
done
# Reload HAProxy
sudo systemctl reload haproxy
sudo systemctl reload haproxy

@ -14,6 +14,7 @@ do
DOMAIN) DOMAIN=${VALUE} ;;
EMAIL) EMAIL=${VALUE} ;;
SSL_PATH) SSL_PATH=${VALUE} ;;
haproxy_dir) haproxy_dir=${VALUE} ;;
*)
esac
done
@ -29,9 +30,9 @@ PWD=$PWD/scripts/ansible/
echo "$HOST ansible_port=$SSH_PORT" > $PWD/$HOST
if [[ $KEY == "" ]]; then
ansible-playbook $PWD/roles/letsencrypt.yml -e "ansible_user=$USER ansible_ssh_pass=$PASS ansible_port=$SSH_PORT variable_host=$HOST PROXY=$PROXY DOMAIN=$DOMAIN EMAIL=$EMAIL SSL_PATH=$SSL_PATH" -i $PWD/$HOST
ansible-playbook $PWD/roles/letsencrypt.yml -e "ansible_user=$USER ansible_ssh_pass=$PASS ansible_port=$SSH_PORT variable_host=$HOST PROXY=$PROXY DOMAIN=$DOMAIN EMAIL=$EMAIL haproxy_dir=$haproxy_dir SSL_PATH=$SSL_PATH" -i $PWD/$HOST
else
ansible-playbook $PWD/roles/letsencrypt.yml --key-file $KEY -e "ansible_user=$USER ansible_port=$SSH_PORT variable_host=$HOST PROXY=$PROXY DOMAIN=$DOMAIN EMAIL=$EMAIL SSL_PATH=$SSL_PATH" -i $PWD/$HOST
ansible-playbook $PWD/roles/letsencrypt.yml --key-file $KEY -e "ansible_user=$USER ansible_port=$SSH_PORT variable_host=$HOST PROXY=$PROXY DOMAIN=$DOMAIN EMAIL=$EMAIL haproxy_dir=$haproxy_dir SSL_PATH=$SSL_PATH" -i $PWD/$HOST
fi
if [ $? -gt 0 ]

@ -0,0 +1,118 @@
{% set thead = ' <thead>
<tr class="overviewHead">
<th class="padding10" style="padding-left: 10px; width: 50px;">Number</th>
<th>Target</th>
<th>Protocol</th>
<th>Source</th>
<th>Destination</th>
<th>Port</th>
</tr>
</thead>' %}
<div id="firewall_tabs">
<ul>
<li><a href="#input" title="Input firewall rules">Input</a></li>
<li><a href="#IN_public_allow" title="IN_public_allow firewall rules">IN_public_allow</a></li>
<li><a href="#output" title="Output firewall rules">Output</a></li>
</ul>
<div id="input">
<table class="overview">
{{thead}}
<tbody>
{% for p in input %}
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10" style="padding-left: 10px;">
{{p.split(' ')[0]}}
</td>
<td>
{{p.split(' ')[1]}}
</td>
<td>
{{p.split(' ')[2]}}
</td>
<td>
{{p.split(' ')[4]}}
</td>
<td>
{{p.split(' ')[5]}}
</td>
<td>
{{p.split(' ')[7]}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div id="IN_public_allow">
<table class="overview">
{{thead}}
<tbody>
{% for p in IN_public_allow %}
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10" style="padding-left: 10px;">
{{p.split(' ')[0]}}
</td>
<td>
{{p.split(' ')[1]}}
</td>
<td>
{{p.split(' ')[2]}}
</td>
<td>
{{p.split(' ')[4]}}
</td>
<td>
{{p.split(' ')[5]}}
</td>
<td>
{{p.split(' ')[7]}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div id="output">
<table class="overview">
{{thead}}
<tbody>
{% for p in output %}
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10" style="padding-left: 10px;">
{{p.split(' ')[0]}}
</td>
<td>
{{p.split(' ')[1]}}
</td>
<td>
{{p.split(' ')[2]}}
</td>
<td>
{{p.split(' ')[4]}}
</td>
<td>
{{p.split(' ')[5]}}
</td>
<td>
{{p.split(' ')[7]}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="alert alert-warning">
There are rules only from INPUT, IN_public_allow and OUTPUT chains
</div>
<script>
$( function() {
$("#firewall_tabs").tabs();
});
</script>
<style>
#firewall_tabs {
border: none !important;
width: 100% !important;
}
</style>

@ -10,10 +10,10 @@
"searchable": false,
"orderable": false,
"targets": 2
}
],
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
} );
}
],
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
} );
} );
</script>
<table class="overview">
@ -29,14 +29,9 @@
<table class="overview hover order-column display compact" id="{{list_id}}">
<thead>
<tr class="overviewHead">
<th class="padding10" style="width: 10%; padding-left: 10px;">
Id
</th>
<th>
Ip
</th>
<th>
</th>
<th class="padding10" style="width: 10%; padding-left: 10px;">Id</th>
<th>Ip</th>
<th></th>
</tr>
</thead>
<tbody>

@ -0,0 +1,30 @@
<table class="overview">
<thead>
<tr class="overviewHead">
<th class="padding10 first-collumn">Port</th>
<th>State</th>
<th>Service</th>
</tr>
</thead>
<tbody>
{% for p in ports %}
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn">
{{p.split(' ')[0]}}
</td>
<td>
{{p.split(' ')[1]}}
</td>
<td>
{{p.split(' ')[2]}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<br />
<div style="padding-left: 10px">
{% for i in info %}
{{i}}<br />
{% endfor %}
</div>

@ -42,7 +42,6 @@
<div class="alert alert-success">Config is ok</div>
<a href="viewsttats.py?serv={{ serv }}" target="_blank" title="View stats">Go to view stats</a>
{% endif %}
{% endif %}
</center>
{% if aftersave != 1 %}

@ -16,7 +16,7 @@
</form>
{% if not aftersave and not open %}
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px; margin-top: 40%">
Here you can work with previous versions of {%if service == 'keepalived' %}Keepalived{%else%}HAProxy{%endif%} configs. Roll back to them, view or delete
Here you can work with previous versions of {%if service == 'keepalived' %}Keepalived{%elif service == 'nginx' %}Nginx{%else%}HAProxy{%endif%} configs. Roll back to them, view or delete
</div>
{% endif %}
</p>
@ -41,7 +41,7 @@
{% for file in return_files %}
<label for="{{file}}"> {{file.split('-', maxsplit=1)[1]}} </label><input type="checkbox" value="{{file}}" name="{{file}}" id="{{file}}">
<a href="/app/versions.py?service={{service}}&serv={{serv}}&open=open&configver={{file}}" class="ui-button ui-widget ui-corner-all" title="View and upload this version of the config" style="margin-top: -6px;">
Upload
View/Upload
</a><br />
{% endfor %}
<input type="hidden" value="{{serv}}" name="serv">

@ -106,10 +106,12 @@
<select id="slavefor-{{server.0}}">
<option value="0" selected>Not slave</option>
{% for master in masters %}
{% if master.0 == server.6 %}
{% if master.0 == server.6 %}
<option value="{{master.0}}" selected>{{master.1}}</option>
{% else %}
{% if master.0 != server.0 %}
<option value="{{master.0}}">{{master.1}}</option>
{% endif %}
{% endif %}
{% endfor %}
</select>
@ -154,7 +156,7 @@
<br /><span class="add-button" title="Add server" id="add-server-button">+ Add</span>
<br /><br />
<div id="checkSshConnect"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
<div class="add-note addName alert alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=servers" title="Servers description" target="_blank">here</a>
or read HowTo in this <a href="https://haproxy-wi.org/howto.py?howto=setup" title="How to setup servers, group and SSH credentials" target="_blank">article</a>
</div>

@ -221,4 +221,10 @@
</div>
<div id="dialog-confirm-services" style="display: none;">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Are you sure?</p>
</div>
<div id="show_scans_ports" style="display: none; padding: 0;">
<div id="show_scans_ports_body"></div>
</div>
<div id="firewall_rules" style="display: none; padding: 0 2px 0 0; margin-left: 1px; margin-right: -4px;">
<div id="firewall_rules_body"></div>
</div>

@ -829,20 +829,19 @@ label {
.haproxy-info {
display: inline-block;
width: 160px;
padding-left: 30px;
padding-top: 15px;
font-size: 12px;
padding-top: 5px;
font-size: 11.5px;
float: left;
}
.top-info {
display: inline-block;
width: 350px;
margin-top: 10px;
margin-top: 5px;
font-size: 10px;
}
.bin_bout {
width: 110px;
margin-left: 10px;
margin-left: 12px;
}
.bytes {
padding-top: 17px;

Loading…
Cancel
Save