Skip to content

Commit 27824c5

Browse files
author
Sylvain
committed
Update
1 parent a343dc0 commit 27824c5

7 files changed

Lines changed: 110 additions & 14 deletions

File tree

examples/nginx.conf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
2+
location __PATH__/ {
3+
4+
# Path to source
5+
alias __INSTALL_DIR__/;
6+
7+
index index.php;
8+
9+
try_files $uri $uri/ index.php;
10+
location ~ [^/]\.php(/|$) {
11+
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
12+
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
13+
14+
fastcgi_index index.php;
15+
include fastcgi_params;
16+
fastcgi_param REMOTE_USER $remote_user;
17+
fastcgi_param PATH_INFO $fastcgi_path_info;
18+
fastcgi_param SCRIPT_FILENAME $request_filename;
19+
}
20+
}

examples/sudoers

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Grant sudo permissions to the user to manage fail2ban-client
2+
__USER__ ALL=(ALL) NOPASSWD: /usr/bin/fail2ban-client

examples/systemd.service

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[Unit]
2+
Description=Change access rights of fail2ban.sock
3+
Requires=fail2ban.service
4+
After=fail2ban.service
5+
6+
[Service]
7+
Type=oneshot
8+
# Only root can fully execute chmod
9+
User=root
10+
Group=root
11+
ExecStart=/bin/chmod 660 /var/run/fail2ban/fail2ban.sock
12+
13+
[Install]
14+
WantedBy=multi-user.target

favicon.ico

108 KB
Binary file not shown.

images/logo.svg

Lines changed: 48 additions & 0 deletions
Loading

index.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,27 @@
5555
<!DOCTYPE html>
5656
<html>
5757
<head>
58-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
58+
<meta meta name="viewport" content="width=device-width, initial-scale=1" charset="utf-8">
59+
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
5960
<link rel="stylesheet" href="style.css" type="text/css">
6061
<title>Fail2Ban Webinterface</title>
61-
<h1>Fail2Ban Webinterface</h1>
62-
<form name="reload" method="POST">
63-
<button class="button" type="submit" name="submit_reload"><?=$refresh?>
64-
<img src="images/reload.svg" alt="add">
65-
</button>
66-
</form>
67-
</head>
68-
<body>
62+
<div class="header" id="myHeader">
63+
<h1>Fail2Ban Webinterface</h1>
64+
<form name="reload" method="POST">
65+
<button class="button" type="submit" name="submit_reload"><?=$refresh?>
66+
<img src="images/reload.svg" alt="add">
67+
</button>
68+
</form>
69+
</div>
6970
<?php
7071
$erg2=@exec('sudo /usr/bin/fail2ban-client status');
7172
if($erg2=='') {
7273
echo '<h1><p class="msg_er">'.$serviceerror.'</p></h1>';
7374
exit;
7475
}
7576
?>
77+
</head>
78+
<body>
7679
<h2><?=$bannedclientsperJail?></h2>
7780
<?php
7881
$usedns=$_GET['usedns'];
@@ -138,7 +141,7 @@
138141
foreach($clients as $client) {
139142
$client_ip=explode(" (", $client)[0];
140143
echo '
141-
<tr>
144+
<tr class="highlight">
142145
<form name="unban" method="POST">
143146
<input type="hidden" name="unban_jail" value="'.$jail.'">
144147
<input type="hidden" name="unban_ip" value="'.$client_ip.'">
@@ -153,7 +156,7 @@
153156
';
154157
}
155158
} else {
156-
echo '<tr><td class="msg_gr" colspan="2">'.$nobannedclients.'</td></tr>';
159+
echo '<tr class="highlight"><td class="msg_gr" colspan="2">'.$nobannedclients.'</td></tr>';
157160
}
158161
}
159162
}
@@ -168,7 +171,7 @@
168171
<th>IP</th>
169172
<th><?=$banip?></th>
170173
</tr>
171-
<tr>
174+
<tr class="highlight">
172175
<td>
173176
<select name="ban_jail"><option value="">- <?=$select?> -</option>
174177
<?php

style.css

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ h1, h2 {
77
margin-bottom: 0px;
88
}
99

10+
.header {
11+
position: sticky;
12+
top: 0;
13+
z-index: 999;
14+
background-color: #aca;
15+
padding-left: 10px;
16+
padding-bottom: 10px;
17+
}
18+
1019
footer {
1120
color : #666;
1221
font-style : italic;
@@ -28,12 +37,12 @@ td {
2837
padding-right : 5px;
2938
}
3039

31-
td.bold {
40+
.bold {
3241
font-weight : bold;
3342
background-color : #aca;
3443
}
3544

36-
tr:hover {
45+
.highlight:hover {
3746
background-color : #cac;
3847
opacity : 0.75;
3948
}

0 commit comments

Comments
 (0)