Commit fd969ec5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

cleanup: remove obsolete internal web files

parent ead056a4
<button onclick="unban()">Unban</button>
<script>
function unban(){
window.location.href = "unban.php";
}
</script>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>IP-адрес, к которому вы обратились, заблокирован на сервере. This IP is banned!</title>
<style>
html {
font-family: sans-serif;
text-align: center;
}
body {
overflow: hidden;
}
big {
font-weight: bold;
}
.center {
width: 800px;
height: 500px;
max-width: 100vw;
max-width: calc(100vw - 2rem);
min-height: 100vh;
margin: auto;
display: flex;
justify-content: center;
align-items: center;
}
.button {
text-decoration: none;
display: inline-block;
width: 140px;
height: 40px;
line-height: 40px;
border-radius: 5px;
margin: 10px 20px;
font-family: inherit;
font-size: 15px;
text-transform;
text-align: center;
font-weight: 600;
color: #ffffff;
background: #0d6efd;
box-shadow: 0 8px 15px rgba(0, 0, 0, .1);
transition: .3s;
}
.button:hover {
background: #2EE59D;
box-shadow: 0 15px 20px rgba(46, 229, 157, .4);
color: white;
transform: translateY(-7px);
}
</style>
</head>
<body>
<div class=center>
<p><big>Доступ к запрашиваемому ресурсу ограничен в связи с подозрительной активностью этого IP-адреса. <br>
Если вы считаете, что блокировка ошибочна, обратитесь к администратору.<br>
<br> Access to the requested resource is restricted due to suspicious activity from this IP address. <br>
If you believe this is a mistake, please contact your administrator.</big>
</div>
</body>
<html>
YYYYYYYYYYYYYes
\ No newline at end of file
<?php
header('Content-Type: text/html; charset=utf-8');
$ip = $_SERVER['REMOTE_ADDR'] ?? '';
$settings = parse_ini_file('/etc/eterban/settings.ini');
$host_redis = is_array($settings) ? ($settings['redis_server'] ?? '') : '';
$hostname = is_array($settings) ? ($settings['hostname'] ?? '') : '';
if (!filter_var($ip, FILTER_VALIDATE_IP) || empty($host_redis)) {
http_response_code(503);
error_log('eterban: invalid client IP or Redis configuration for web unban');
exit('Unban service is temporarily unavailable.');
}
if (empty($hostname)) {
$hostname = gethostname();
}
try {
$redis = new Redis();
if (!$redis->connect($host_redis, 6379, 2.5)) {
throw new RedisException('connection failed');
}
$subscribers = $redis->publish('unban', $ip);
if ($subscribers < 1) {
throw new RedisException('no Redis subscribers');
}
$redis->publish('by', $ip . ' was unblocked by ' . $hostname);
$redis->close();
} catch (RedisException $error) {
http_response_code(503);
error_log('eterban: web unban request was not delivered: ' . $error->getMessage());
exit('Unban service is temporarily unavailable. Please contact an administrator.');
}
echo 'Unban request accepted. Wait 5 seconds, please.';
?>
<script>
function update()
{
window.location.href = "/";
}
setTimeout("update()", 5000);
</script>
server {
listen 91.232.225.67:82;
#server_name priv.etersoft.ru;
root /var/www/html/eterban-internal/;
location / {
# add_header Access-Control-Allow-Origin *;
# try_files $uri $uri/ /index.php?$query_string;
index index.html;
#include /etc/nginx/fastcgi_params;
#fastcgi_pass unix:/var/run/php7-fpm/php7.fpm.sock;
}
location ~* \.php$ {
#try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php7-fpm/php7-fpm.sock; # подключаем сокет php-fpm
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
access_log /var/log/nginx/eterban_access.log;
error_log /var/log/nginx/eterban_error.log;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment