pre release v2
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
TZ=Europe/Samara
|
||||
PORT=51820
|
||||
ADDRESS=10.0.1.1/24
|
||||
WGPORT=51820
|
||||
WGADDRESS=10.0.1.1/24
|
||||
|
||||
+12
-2
@@ -1,5 +1,15 @@
|
||||
/app/config.php
|
||||
/cert/*
|
||||
!/cert/.gitkeep
|
||||
/certs/*
|
||||
!/certs/.gitkeep
|
||||
/logs/*
|
||||
!/logs/.gitkeep
|
||||
/ssh/*
|
||||
!/ssh/.gitkeep
|
||||
/app/zaprelists/*
|
||||
!/app/zaprelists/.gitkeep
|
||||
/sftp-config.json
|
||||
/tg.pyr
|
||||
/config/wg0.conf
|
||||
/todo.todo
|
||||
/app/zapretlists/*
|
||||
!/app/zapretlists/.gitkeep
|
||||
|
||||
+1337
-212
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
error_reporting(E_ERROR);
|
||||
// ini_set('display_errors', 'On');
|
||||
ini_set("log_errors", 1);
|
||||
ini_set("error_log", __DIR__ . "/error_log");
|
||||
ini_set("error_log", '/logs/php_error');
|
||||
|
||||
$debug = [
|
||||
'raw' => file_get_contents('php://input'),
|
||||
@@ -17,5 +17,5 @@ function exit_log($debug)
|
||||
{
|
||||
$output = ob_get_contents();
|
||||
$debug['response'] = json_decode($output, true) ?: $output;
|
||||
file_put_contents(__DIR__ . '/debug', "\n" . date('Y-m-d H:i:s') . "\n" . var_export($debug, true) . "\n", FILE_APPEND);
|
||||
file_put_contents('/logs/requests', "\n" . date('Y-m-d H:i:s') . "\n" . var_export($debug, true) . "\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
+30
-8
@@ -1,14 +1,36 @@
|
||||
<?php
|
||||
|
||||
// require __DIR__ . '/debug.php';
|
||||
require __DIR__ . '/bot.php';
|
||||
require __DIR__ . '/config.php';
|
||||
date_default_timezone_set(getenv('TZ'));
|
||||
|
||||
$url = trim($_SERVER['REQUEST_URI'], '/');
|
||||
if (!('POST' == $_SERVER['REQUEST_METHOD'] && $url == $key)) {
|
||||
header('500', true, 500);
|
||||
// bot
|
||||
require __DIR__ . '/config.php';
|
||||
if ('POST' == $_SERVER['REQUEST_METHOD'] && $_GET['k'] == $key) {
|
||||
// require __DIR__ . '/debug.php';
|
||||
require __DIR__ . '/bot.php';
|
||||
$bot = new Bot($key);
|
||||
$bot->input();
|
||||
die();
|
||||
}
|
||||
|
||||
$bot = new Bot($key);
|
||||
$bot->input();
|
||||
// pac
|
||||
$type = $_GET['t'] ?? 'pac';
|
||||
$address = $_GET['a'] ?: '127.0.0.1';
|
||||
$port = $_GET['p'] ?: '1080';
|
||||
$hash = $_GET['h'];
|
||||
if ($hash == substr(md5($key), 0, 8)) {
|
||||
if (file_exists($file = __DIR__ . "/zapretlists/$type")) {
|
||||
$pac = file_get_contents($file);
|
||||
header("Content-Type: text/plain");
|
||||
echo str_replace([
|
||||
'~address~',
|
||||
'~port~',
|
||||
], [
|
||||
$address,
|
||||
$port
|
||||
], $pac);
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
header('500', true, 500);
|
||||
die();
|
||||
|
||||
@@ -0,0 +1,320 @@
|
||||
<?php
|
||||
|
||||
ini_set('memory_limit', '256M');
|
||||
|
||||
function elzw(string $str)
|
||||
{
|
||||
global $text, $load;
|
||||
$str = mb_str_split($str);
|
||||
$code = 256;
|
||||
$r = $phrase = '';
|
||||
$keys = [];
|
||||
$last = count($str) - 1;
|
||||
$size = count($str);
|
||||
$curr = $j = 0;
|
||||
$time = microtime(true);
|
||||
foreach ($str as $k => $v) {
|
||||
$curr ++;
|
||||
$percent = (int) ceil($curr * 100 / $size);
|
||||
$rotate = $curr != $size ? $load[$j % count($load)] : '';
|
||||
$tail = <<<text
|
||||
Minified pac $percent% $rotate
|
||||
text;
|
||||
if (microtime(true) - $time > 0.1) {
|
||||
update($text . $tail);
|
||||
$time = microtime(true);
|
||||
$j++;
|
||||
}
|
||||
switch (true) {
|
||||
case $last == $k:
|
||||
$r .= strlen($phrase) > 1 ? mb_chr($keys[$phrase]) : $v;
|
||||
break;
|
||||
case !empty($keys[$phrase . $str[$k + 1]]):
|
||||
$phrase .= $str[$k + 1];
|
||||
break;
|
||||
default:
|
||||
$r .= strlen($phrase) > 1 ? mb_chr($keys[$phrase]) : $v;
|
||||
$keys[$phrase . $str[$k + 1]] = $code;
|
||||
$code++;
|
||||
$phrase = $str[$k + 1];
|
||||
}
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function dlzw($text)
|
||||
{
|
||||
$text = mb_str_split($text);
|
||||
$code = 256;
|
||||
$r = $phrase = '';
|
||||
$keys = [];
|
||||
$last = count($text) - 1;
|
||||
foreach ($text as $k => $v) {
|
||||
$cc = mb_ord($v);
|
||||
$r .= $cc < 256 ? $v : $keys[$cc];
|
||||
if ($last == $k) {
|
||||
break;
|
||||
}
|
||||
if (!empty($phrase)) {
|
||||
$keys[$code] = $phrase . ($cc < 256 ? $v : $keys[$cc][0]);
|
||||
$code++;
|
||||
}
|
||||
$phrase = $cc < 256 ? $v : $keys[$cc];
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function getSize($url)
|
||||
{
|
||||
$ch = curl_init($url);
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_HEADER => 1,
|
||||
CURLOPT_NOBODY => 1,
|
||||
CURLOPT_RETURNTRANSFER => 1,
|
||||
CURLOPT_TIMEOUT => 10,
|
||||
]);
|
||||
$r = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
preg_match('~content-length.+?(\d+)~ius', $r, $m);
|
||||
return (int) $m[1];
|
||||
}
|
||||
|
||||
function update($text)
|
||||
{
|
||||
global $bot;
|
||||
$bot->update($bot->input['chat'], $bot->input['message_id'], $text);
|
||||
}
|
||||
|
||||
function start()
|
||||
{
|
||||
global $bot, $source, $res, $load, $text;
|
||||
|
||||
$conf = $bot->getPacConf();
|
||||
|
||||
$subzones = array_keys(array_filter($conf['subzoneslist'], fn($x) => $x == true));
|
||||
|
||||
// check && exclude
|
||||
$include = array_filter($conf['includelist'], fn($x) => $x == true);
|
||||
if ($conf['zapret']) {
|
||||
foreach ($source as $k => $v) {
|
||||
$size = getSize($v['source']);
|
||||
if ($size > 0) {
|
||||
if (file_exists($v['dest'])) {
|
||||
unlink($v['dest']);
|
||||
}
|
||||
touch($v['dest']);
|
||||
$percent = 0;
|
||||
$curr = 0;
|
||||
exec("php updatepac.php download $k > /dev/null &");
|
||||
$i = $j = 0;
|
||||
while ($curr <= $size) {
|
||||
$rotate = $curr != $size ? $load[$j % count($load)] : '';
|
||||
$tail = <<<text
|
||||
Downloading {$v['source']}
|
||||
$curr/$size $percent% $rotate
|
||||
text;
|
||||
update($text . $tail);
|
||||
if ($curr == $size || $i > 50) {
|
||||
break;
|
||||
}
|
||||
usleep(50000);
|
||||
clearstatcache();
|
||||
if ($curr == filesize($v['dest'])) {
|
||||
$i++;
|
||||
}
|
||||
$curr = filesize($v['dest']);
|
||||
$percent = (int) ceil($curr * 100 / $size);
|
||||
$j++;
|
||||
}
|
||||
if ($curr != $size) {
|
||||
$text .= "\nError downloading {$v['source']}\nabort script";
|
||||
endScript($text);
|
||||
}
|
||||
} else {
|
||||
$text .= "\nError size {$v['source']}\nabort script";
|
||||
endScript($text);
|
||||
}
|
||||
$text .= $tail ? "$tail\n" : '';
|
||||
}
|
||||
// prepare
|
||||
$reg = '~^([^.*]+\.(?:(?:' . implode('|', $subzones) . ')\.)?[^.]+)$~';
|
||||
|
||||
foreach ($source as $k => $v) {
|
||||
$size = filesize($v['dest']);
|
||||
$curr = $j = 0;
|
||||
$time = microtime(true);
|
||||
$name = basename($v['dest']);
|
||||
$f = fopen($v['dest'], 'r');
|
||||
while (($s = fgets($f)) !== false) {
|
||||
$curr += strlen($s);
|
||||
$percent = (int) ceil($curr * 100 / $size);
|
||||
$rotate = $curr != $size ? $load[$j % count($load)] : '';
|
||||
$tail = <<<text
|
||||
Prepare $name $percent% $rotate
|
||||
text;
|
||||
if (microtime(true) - $time > 0.1) {
|
||||
update($text . $tail);
|
||||
$time = microtime(true);
|
||||
$j++;
|
||||
}
|
||||
if ($name == 'dump.csv') {
|
||||
if (!preg_match('~;.*;~', $s)) {
|
||||
continue;
|
||||
}
|
||||
$t = explode(';', iconv('CP1251', 'utf-8', $s));
|
||||
if (empty($t[1])) {
|
||||
continue;
|
||||
}
|
||||
if (preg_match($reg, idn_to_ascii(trim($t[1])), $m)) {
|
||||
$domains[$m[1]] = 0;
|
||||
}
|
||||
} else {
|
||||
if (preg_match($reg, idn_to_ascii(iconv('CP1251', 'utf-8', trim($s))), $m)) {
|
||||
$domains[$m[1]] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($f);
|
||||
$text .= $tail ? "$tail\n" : '';
|
||||
}
|
||||
$exclude = array_keys(array_filter($conf['excludelist'], fn($x) => $x == true));
|
||||
foreach ($include as $k => $v) {
|
||||
$domains[$k] = 0;
|
||||
}
|
||||
} else {
|
||||
$domains = $include;
|
||||
}
|
||||
if (empty($domains)) {
|
||||
$text = "Empty domains. Delete pac files";
|
||||
unlink(__DIR__ . '/zapretlists/mpac');
|
||||
unlink(__DIR__ . '/zapretlists/pac');
|
||||
} else {
|
||||
$domains = array_keys($domains);
|
||||
|
||||
$size = count($domains);
|
||||
$curr = $j = 0;
|
||||
$time = microtime(true);
|
||||
$f = fopen(__DIR__ . '/zapretlists/mpac', 'w');
|
||||
$t = [];
|
||||
foreach ($domains as $v) {
|
||||
$curr ++;
|
||||
$percent = (int) ceil($curr * 100 / $size);
|
||||
$rotate = $curr != $size ? $load[$j % count($load)] : '';
|
||||
$tail = <<<text
|
||||
Create pac for shadowsocks-android $percent% $rotate
|
||||
text;
|
||||
if (microtime(true) - $time > 0.1) {
|
||||
update($text . $tail);
|
||||
$time = microtime(true);
|
||||
$j++;
|
||||
}
|
||||
if ($exclude && preg_match('~' . implode('|', $exclude) . '~', $v)) {
|
||||
continue;
|
||||
}
|
||||
fwrite($f, preg_quote($v) . "\n");
|
||||
|
||||
preg_match('~(.+)\.([^.]+)$~', $v, $m);
|
||||
$t[$m[2]][strlen($m[1])][] = $m[1];
|
||||
}
|
||||
fclose($f);
|
||||
$text .= $tail ? "$tail\n" : '';
|
||||
|
||||
// create pac
|
||||
$domains = elzw(json_encode($t));
|
||||
$pac = 'function FindProxyForURL(t,e){"indexOf"in Array.prototype||(Array.prototype.indexOf=function(t,e){void 0===e&&(e=0),e<0&&(e+=this.length),e<0&&(e=0);for(var n=this.length;e<n;e++)if(e in this&&this[e]===t)return e;return -1}),"dlzw"in String.prototype||(String.prototype.dlzw=function(t){for(var e in text=this.split(""),code=256,o=phrase="",last=text.length,keys=[],text){if(o+=(cc="".charCodeAt.call(this[e],0))<256?text[e]:keys[cc],last==e)break;phrase&&phrase.length>0&&(keys[code]=phrase+(cc<256?text[e]:keys[cc][0]),code++),phrase=cc<256?text[e]:keys[cc]}return o});var n=JSON.parse(\'' . $domains . '\'.dlzw()),r=(/\.(' . implode('|', $subzones) . ')\.[^.]+$/.test(e)?e.replace(/(.+)\.([^.]+\.[^.]+\.[^.]+$)/,"$2"):e.replace(/(.+)\.([^.]+\.[^.]+$)/,"$2")).replace(/^www\.(.+)/,"$1").match(/(.*)\.([^.]+$)/);if(console.log(n,r),!r||!r[2])return"DIRECT";var o=r[1],i=r[2],a=[];if(n.hasOwnProperty(i)&&n[i].hasOwnProperty(o.length)){if("string"==typeof n[i][o.length]){var l=RegExp(".{"+o.length.toString()+"}","g");n[i][o.length]=n[i][o.length].match(l)}a=n[i][o.length]}return -1!==a.indexOf(o)?"SOCKS5 ~address~:~port~; DIRECT":"DIRECT"}';
|
||||
file_put_contents(__DIR__ . '/zapretlists/pac', $pac);
|
||||
$text .= "Create minified pac 100%\n";
|
||||
}
|
||||
|
||||
// create reverse PAC
|
||||
$domains = array_filter($conf['reverselist'], fn($x) => $x == true);
|
||||
if (empty($domains)) {
|
||||
$text .= "Empty reverse domains. Delete reverse pac files";
|
||||
unlink(__DIR__ . '/zapretlists/rmpac');
|
||||
unlink(__DIR__ . '/zapretlists/rpac');
|
||||
} else {
|
||||
$domains = array_keys($domains);
|
||||
|
||||
// $size = count($domains);
|
||||
// $curr = $j = 0;
|
||||
// $time = microtime(true);
|
||||
// $f = fopen(__DIR__ . '/zapretlists/rmpac', 'w');
|
||||
// $t = [];
|
||||
// foreach ($domains as $v) {
|
||||
// $curr ++;
|
||||
// $percent = (int) ceil($curr * 100 / $size);
|
||||
// $rotate = $curr != $size ? $load[$j % count($load)] : '';
|
||||
// $tail = <<<text
|
||||
// Create reverse pac for shadowsocks-android $percent% $rotate
|
||||
// text;
|
||||
// if (microtime(true) - $time > 0.1) {
|
||||
// update($text . $tail);
|
||||
// $time = microtime(true);
|
||||
// $j++;
|
||||
// }
|
||||
// fwrite($f, '!(' . preg_quote($v) . ')' . "\n");
|
||||
|
||||
// preg_match('~(.+)\.([^.]+)$~', $v, $m);
|
||||
// $t[$m[2]][strlen($m[1])][] = $m[1];
|
||||
// }
|
||||
// fclose($f);
|
||||
$text .= $tail ? "$tail\n" : '';
|
||||
|
||||
$domains = elzw(json_encode($t));
|
||||
$pac = 'function FindProxyForURL(t,e){"indexOf"in Array.prototype||(Array.prototype.indexOf=function(t,e){void 0===e&&(e=0),e<0&&(e+=this.length),e<0&&(e=0);for(var n=this.length;e<n;e++)if(e in this&&this[e]===t)return e;return -1}),"dlzw"in String.prototype||(String.prototype.dlzw=function(t){for(var e in text=this.split(""),code=256,o=phrase="",last=text.length,keys=[],text){if(o+=(cc="".charCodeAt.call(this[e],0))<256?text[e]:keys[cc],last==e)break;phrase&&phrase.length>0&&(keys[code]=phrase+(cc<256?text[e]:keys[cc][0]),code++),phrase=cc<256?text[e]:keys[cc]}return o});var n=JSON.parse(\'' . $domains . '\'.dlzw()),r=(/\.(' . implode('|', $subzones) . ')\.[^.]+$/.test(e)?e.replace(/(.+)\.([^.]+\.[^.]+\.[^.]+$)/,"$2"):e.replace(/(.+)\.([^.]+\.[^.]+$)/,"$2")).replace(/^www\.(.+)/,"$1").match(/(.*)\.([^.]+$)/);if(console.log(n,r),!r||!r[2])return"DIRECT";var o=r[1],i=r[2],a=[];if(n.hasOwnProperty(i)&&n[i].hasOwnProperty(o.length)){if("string"==typeof n[i][o.length]){var l=RegExp(".{"+o.length.toString()+"}","g");n[i][o.length]=n[i][o.length].match(l)}a=n[i][o.length]}return -1!==a.indexOf(o)?"DIRECT":"SOCKS5 ~address~:~port~"}';
|
||||
file_put_contents(__DIR__ . '/zapretlists/rpac', $pac);
|
||||
$text .= 'Create minified reverse pac 100%';
|
||||
}
|
||||
endScript($text);
|
||||
}
|
||||
|
||||
function endScript($text)
|
||||
{
|
||||
global $bot;
|
||||
update($text);
|
||||
sleep(2);
|
||||
$bot->menu('pac');
|
||||
die();
|
||||
}
|
||||
|
||||
function download($index)
|
||||
{
|
||||
global $source;
|
||||
file_put_contents($source[$index]['dest'], file_get_contents($source[$index]['source']));
|
||||
}
|
||||
|
||||
require __DIR__ . '/debug.php';
|
||||
require __DIR__ . '/bot.php';
|
||||
require __DIR__ . '/config.php';
|
||||
$source = [
|
||||
[
|
||||
'source' => 'https://raw.githubusercontent.com/zapret-info/z-i/master/nxdomain.txt',
|
||||
'dest' => __DIR__ . '/zapretlists/nxdomain.txt',
|
||||
],
|
||||
[
|
||||
'source' => 'https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv',
|
||||
'dest' => __DIR__ . '/zapretlists/dump.csv',
|
||||
],
|
||||
];
|
||||
|
||||
$res = __DIR__ . '/zapretlists/result';
|
||||
|
||||
$text = '';
|
||||
$load = [
|
||||
'/',
|
||||
'-',
|
||||
'\\',
|
||||
];
|
||||
|
||||
switch ($_SERVER['argv'][1]) {
|
||||
case 'start':
|
||||
$bot = new Bot($key);
|
||||
$bot->input['chat'] = $_SERVER['argv'][2];
|
||||
$bot->input['message_id'] = $_SERVER['argv'][3];
|
||||
$bot->input['callback_id'] = $_SERVER['argv'][4];
|
||||
start();
|
||||
break;
|
||||
case 'download':
|
||||
download($_SERVER['argv'][2]);
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
bind_host: 0.0.0.0
|
||||
bind_port: 80
|
||||
beta_bind_port: 0
|
||||
users:
|
||||
- name: admin
|
||||
password:
|
||||
auth_attempts: 5
|
||||
block_auth_min: 15
|
||||
http_proxy: ""
|
||||
language: ""
|
||||
debug_pprof: false
|
||||
web_session_ttl: 720
|
||||
dns:
|
||||
bind_hosts:
|
||||
- 0.0.0.0
|
||||
port: 53
|
||||
statistics_interval: 1
|
||||
querylog_enabled: true
|
||||
querylog_file_enabled: true
|
||||
querylog_interval: 2160h
|
||||
querylog_size_memory: 1000
|
||||
anonymize_client_ip: false
|
||||
protection_enabled: true
|
||||
blocking_mode: default
|
||||
blocking_ipv4: ""
|
||||
blocking_ipv6: ""
|
||||
blocked_response_ttl: 10
|
||||
parental_block_host: family-block.dns.adguard.com
|
||||
safebrowsing_block_host: standard-block.dns.adguard.com
|
||||
ratelimit: 20
|
||||
ratelimit_whitelist: []
|
||||
refuse_any: true
|
||||
upstream_dns:
|
||||
- https://dns10.quad9.net/dns-query
|
||||
upstream_dns_file: ""
|
||||
bootstrap_dns:
|
||||
- 9.9.9.10
|
||||
- 149.112.112.10
|
||||
- 2620:fe::10
|
||||
- 2620:fe::fe:10
|
||||
all_servers: false
|
||||
fastest_addr: false
|
||||
fastest_timeout: 1s
|
||||
allowed_clients: []
|
||||
disallowed_clients: []
|
||||
blocked_hosts:
|
||||
- version.bind
|
||||
- id.server
|
||||
- hostname.bind
|
||||
trusted_proxies:
|
||||
- 10.10.0.0/24
|
||||
- 127.0.0.0/8
|
||||
- ::1/128
|
||||
cache_size: 4194304
|
||||
cache_ttl_min: 0
|
||||
cache_ttl_max: 0
|
||||
cache_optimistic: false
|
||||
bogus_nxdomain: []
|
||||
aaaa_disabled: false
|
||||
enable_dnssec: false
|
||||
edns_client_subnet: false
|
||||
max_goroutines: 300
|
||||
handle_ddr: true
|
||||
ipset: []
|
||||
ipset_file: ""
|
||||
filtering_enabled: true
|
||||
filters_update_interval: 24
|
||||
parental_enabled: false
|
||||
safesearch_enabled: false
|
||||
safebrowsing_enabled: false
|
||||
safebrowsing_cache_size: 1048576
|
||||
safesearch_cache_size: 1048576
|
||||
parental_cache_size: 1048576
|
||||
cache_time: 30
|
||||
rewrites: []
|
||||
blocked_services: []
|
||||
upstream_timeout: 10s
|
||||
private_networks: []
|
||||
use_private_ptr_resolvers: true
|
||||
local_ptr_upstreams: []
|
||||
serve_http3: false
|
||||
use_http3_upstreams: false
|
||||
tls:
|
||||
enabled: false
|
||||
server_name: ""
|
||||
force_https: false
|
||||
port_https: 443
|
||||
port_dns_over_tls: 853
|
||||
port_dns_over_quic: 853
|
||||
port_dnscrypt: 0
|
||||
dnscrypt_config_file: ""
|
||||
allow_unencrypted_doh: false
|
||||
certificate_chain: ""
|
||||
private_key: ""
|
||||
certificate_path: ""
|
||||
private_key_path: ""
|
||||
strict_sni_check: false
|
||||
filters:
|
||||
- enabled: true
|
||||
url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt
|
||||
name: AdGuard DNS filter
|
||||
id: 1
|
||||
- enabled: false
|
||||
url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt
|
||||
name: AdAway Default Blocklist
|
||||
id: 2
|
||||
whitelist_filters: []
|
||||
user_rules: []
|
||||
dhcp:
|
||||
enabled: false
|
||||
interface_name: ""
|
||||
local_domain_name: lan
|
||||
dhcpv4:
|
||||
gateway_ip: ""
|
||||
subnet_mask: ""
|
||||
range_start: ""
|
||||
range_end: ""
|
||||
lease_duration: 86400
|
||||
icmp_timeout_msec: 1000
|
||||
options: []
|
||||
dhcpv6:
|
||||
range_start: ""
|
||||
lease_duration: 86400
|
||||
ra_slaac_only: false
|
||||
ra_allow_slaac: false
|
||||
clients:
|
||||
runtime_sources:
|
||||
whois: true
|
||||
arp: true
|
||||
rdns: true
|
||||
dhcp: true
|
||||
hosts: true
|
||||
persistent: []
|
||||
log_file: ""
|
||||
log_max_backups: 0
|
||||
log_max_size: 100
|
||||
log_max_age: 3
|
||||
log_compress: false
|
||||
log_localtime: false
|
||||
verbose: false
|
||||
os:
|
||||
group: ""
|
||||
user: ""
|
||||
rlimit_nofile: 0
|
||||
schema_version: 14
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
load_module modules/ngx_stream_js_module.so;
|
||||
|
||||
error_log /logs/nginx_error;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Proxy Cache storage - so we can cache the DoH response from the upstream
|
||||
proxy_cache_path /var/cache/nginx/doh_cache levels=1:2 keys_zone=doh_cache:10m;
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen 443 ssl http2 default_server;
|
||||
ssl_certificate /certs/self_public;
|
||||
ssl_certificate_key /certs/self_private;
|
||||
|
||||
access_log /logs/nginx_default_access;
|
||||
|
||||
location / {
|
||||
return 444;
|
||||
}
|
||||
location /adguard/ {
|
||||
access_log /logs/nginx_adguard_access;
|
||||
proxy_pass http://ad:80/;
|
||||
proxy_redirect / /adguard/;
|
||||
proxy_cookie_path / /adguard/;
|
||||
}
|
||||
location /pac {
|
||||
access_log /logs/nginx_pac_access;
|
||||
proxy_pass http://unit;
|
||||
}
|
||||
location /tlgrm {
|
||||
access_log /logs/nginx_tlgrm_access;
|
||||
proxy_pass http://unit;
|
||||
}
|
||||
location /v2ray {
|
||||
access_log /logs/nginx_v2ray_access;
|
||||
proxy_redirect off;
|
||||
proxy_buffering off;
|
||||
proxy_http_version 1.1;
|
||||
proxy_pass http://ss:8388/;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
location ~\.well-known {
|
||||
access_log /logs/nginx_certbot_access;
|
||||
root /certs/;
|
||||
try_files $uri =404;
|
||||
}
|
||||
}
|
||||
|
||||
#~
|
||||
|
||||
#~domain
|
||||
# server {
|
||||
# listen 443 ssl http2;
|
||||
# server_name ;
|
||||
# ssl_certificate /certs/cert_public;
|
||||
# ssl_certificate_key /certs/cert_private;
|
||||
|
||||
# access_log /logs/nginx_domain_access;
|
||||
|
||||
# location / {
|
||||
# return 444;
|
||||
# }
|
||||
# location /adguard/ {
|
||||
# access_log /logs/nginx_adguard_access;
|
||||
# proxy_pass http://ad:80/;
|
||||
# proxy_redirect / /adguard/;
|
||||
# proxy_cookie_path / /adguard/;
|
||||
# }
|
||||
# location /pac {
|
||||
# access_log /logs/nginx_pac_access;
|
||||
# proxy_pass http://unit;
|
||||
# }
|
||||
# location ~\.well-known {
|
||||
# access_log /logs/nginx_certbot_access;
|
||||
# root /certs/;
|
||||
# try_files $uri =404;
|
||||
# }
|
||||
# location /v2ray {
|
||||
# access_log /logs/nginx_v2ray_access;
|
||||
# proxy_redirect off;
|
||||
# proxy_buffering off;
|
||||
# proxy_http_version 1.1;
|
||||
# proxy_pass http://ss:8388/;
|
||||
# proxy_set_header Host $http_host;
|
||||
# proxy_set_header Upgrade $http_upgrade;
|
||||
# proxy_set_header Connection "upgrade";
|
||||
# }
|
||||
|
||||
# # The DoH server block
|
||||
# location /dns-query {
|
||||
# access_log /logs/nginx_doh_access;
|
||||
# # Proxy HTTP/1.1, clear the connection header to enable Keep-Alive
|
||||
# proxy_http_version 1.1;
|
||||
# proxy_set_header Connection "";
|
||||
|
||||
# # Enable Cache, and set the cache_key to include the request_body
|
||||
# proxy_cache doh_cache;
|
||||
# proxy_cache_key $scheme$proxy_host$uri$is_args$args$request_body;
|
||||
|
||||
# # proxy pass to the dohloop upstream
|
||||
# proxy_pass http://dohloop;
|
||||
# }
|
||||
# }
|
||||
#~domain
|
||||
|
||||
# This upstream connects to a local Stream service which converts HTTP -> DNS
|
||||
upstream dohloop {
|
||||
zone dohloop 64k;
|
||||
server 127.0.0.1:8053;
|
||||
keepalive_timeout 60s;
|
||||
keepalive_requests 100;
|
||||
keepalive 10;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# DNS Stream Services
|
||||
stream {
|
||||
# DNS logging
|
||||
log_format dns '$remote_addr [$time_local] $protocol "$dns_qname"';
|
||||
access_log /logs/nginx_dns_access dns;
|
||||
|
||||
# Import the NJS module
|
||||
js_import /etc/nginx/njs.d/dns/dns.js;
|
||||
|
||||
# The $dns_qname variable can be populated by preread calls, and can be used for DNS routing
|
||||
js_set $dns_qname dns.get_qname;
|
||||
|
||||
# DNS upstream pool.
|
||||
upstream dns {
|
||||
zone dns 64k;
|
||||
server ad:53;
|
||||
}
|
||||
|
||||
# DNS(TCP) and DNS over TLS (DoT) Server
|
||||
# Terminate DoT and DNS TCP, and proxy onto standard DNS
|
||||
#~domain
|
||||
# server {
|
||||
# listen 53;
|
||||
# listen 853 ssl;
|
||||
# ssl_certificate /certs/cert_public;
|
||||
# ssl_certificate_key /certs/cert_private;
|
||||
# js_preread dns.preread_dns_request;
|
||||
# proxy_pass dns;
|
||||
# }
|
||||
#~domain
|
||||
|
||||
# DNS(UDP) Server
|
||||
# DNS UDP proxy onto DNS UDP
|
||||
server {
|
||||
listen 53 udp;
|
||||
proxy_responses 1;
|
||||
js_preread dns.preread_dns_request;
|
||||
proxy_pass dns;
|
||||
}
|
||||
|
||||
# DNS over HTTPS (gateway) Service
|
||||
# Upstream can be either DNS(TCP) or DoT. If upstream is DNS, proxy_ssl should be off.
|
||||
server {
|
||||
listen 8053;
|
||||
js_filter dns.filter_doh_request;
|
||||
proxy_pass dns;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
{
|
||||
"zapret": false,
|
||||
"excludelist": {
|
||||
"(?:v|w)ul(?:c|k)an": true,
|
||||
"^\\d": true,
|
||||
"^a\\w-": true,
|
||||
"^admiral": true,
|
||||
"^avtomaty": true,
|
||||
"^azart": true,
|
||||
"^azimob": true,
|
||||
"^baltplay": true,
|
||||
"a(?:s|z)ino": true,
|
||||
"adrenalin": true,
|
||||
"alco": true,
|
||||
"bet": true,
|
||||
"prostitut": true,
|
||||
"zenit": true,
|
||||
"zerkalo": true,
|
||||
"777": true
|
||||
},
|
||||
"includelist": {},
|
||||
"reverselist": {},
|
||||
"subzoneslist": {
|
||||
"3dn": false,
|
||||
"3nx": true,
|
||||
"akadns": true,
|
||||
"appspot": true,
|
||||
"azurewebsites": true,
|
||||
"beget": true,
|
||||
"berlogovo": true,
|
||||
"biz": true,
|
||||
"brightcove": true,
|
||||
"cc": true,
|
||||
"cloudfront": true,
|
||||
"co": true,
|
||||
"com": true,
|
||||
"cu": true,
|
||||
"ddns": true,
|
||||
"deviantart": true,
|
||||
"dn": true,
|
||||
"dp": true,
|
||||
"dyndns": true,
|
||||
"edgecastcdn": true,
|
||||
"edu": true,
|
||||
"eu": true,
|
||||
"fastly": true,
|
||||
"force": true,
|
||||
"github": true,
|
||||
"google": true,
|
||||
"googleusercontent": true,
|
||||
"gov": true,
|
||||
"herokuapp": true,
|
||||
"hldns": true,
|
||||
"ho": true,
|
||||
"hopto": true,
|
||||
"hwcdn": true,
|
||||
"i": true,
|
||||
"iboards": true,
|
||||
"in": true,
|
||||
"info": true,
|
||||
"int": true,
|
||||
"itch": true,
|
||||
"keenetic": true,
|
||||
"kiev": true,
|
||||
"kirov": true,
|
||||
"linode": true,
|
||||
"livejournal": true,
|
||||
"maryno": true,
|
||||
"mil": true,
|
||||
"msk": true,
|
||||
"my1": true,
|
||||
"mybb2": true,
|
||||
"ne": true,
|
||||
"net": true,
|
||||
"netdna-ssl": true,
|
||||
"nnov": true,
|
||||
"notion": true,
|
||||
"nov": true,
|
||||
"od": true,
|
||||
"org": true,
|
||||
"pp": true,
|
||||
"pximg": true,
|
||||
"pythonanywhere": true,
|
||||
"ru": true,
|
||||
"scaleway": true,
|
||||
"sl": true,
|
||||
"sl-reverse": true,
|
||||
"spb": true,
|
||||
"tilda": true,
|
||||
"trafficmanager": true,
|
||||
"tut": true,
|
||||
"u-stream": true,
|
||||
"ucoz": true,
|
||||
"v": true,
|
||||
"vercel": true,
|
||||
"wix": true,
|
||||
"wixmp": true
|
||||
}
|
||||
}
|
||||
@@ -1949,3 +1949,11 @@ ldap.max_links = -1
|
||||
; List of headers files to preload, wildcard patterns allowed.
|
||||
;ffi.preload=
|
||||
extension=ssh2
|
||||
extension=yaml
|
||||
zend_extension=opcache
|
||||
opcache.enable=1
|
||||
opcache.jit_buffer_size=128M
|
||||
opcache.enable_cli=1
|
||||
pcre.jit=1
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
logoutput: stderr
|
||||
internal: eth0 port = 1080
|
||||
external: eth0
|
||||
socksmethod: none
|
||||
user.privileged: root
|
||||
user.unprivileged: nobody
|
||||
|
||||
client pass {
|
||||
from: 0/0 to: 0/0
|
||||
log: connect disconnect error ioop
|
||||
}
|
||||
|
||||
socks pass {
|
||||
from: 0/0 to: 0/0
|
||||
log: connect disconnect error ioop
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"server": "ss",
|
||||
"server_port": 8388,
|
||||
"local_address": "0.0.0.0",
|
||||
"local_port": 1080,
|
||||
"password": "test",
|
||||
"timeout": 120,
|
||||
"method": "chacha20-ietf-poly1305",
|
||||
"no_delay": true,
|
||||
"fast_open": true,
|
||||
"reuse_port": true,
|
||||
"workers": 1,
|
||||
"nameserver": "10.10.0.5",
|
||||
"mode": "tcp_and_udp"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"server": "0.0.0.0",
|
||||
"server_port": 8388,
|
||||
"password": "test",
|
||||
"timeout": 120,
|
||||
"method": "chacha20-ietf-poly1305",
|
||||
"no_delay": true,
|
||||
"fast_open": true,
|
||||
"reuse_port": true,
|
||||
"workers": 1,
|
||||
"nameserver": "10.10.0.5",
|
||||
"mode": "tcp_and_udp"
|
||||
}
|
||||
+12
-12
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"listeners":{
|
||||
"*:443":{
|
||||
"pass": "applications/php",
|
||||
"tls": {
|
||||
"certificate": "cert"
|
||||
}
|
||||
"listeners": {
|
||||
"*:80": {
|
||||
"pass": "applications/php"
|
||||
}
|
||||
},
|
||||
"applications":{
|
||||
"php":{
|
||||
"type":"php",
|
||||
"root":"/app",
|
||||
"script":"index.php"
|
||||
}
|
||||
"applications": {
|
||||
"php": {
|
||||
"type": "php",
|
||||
"root": "/app",
|
||||
"script": "index.php",
|
||||
"user": "root",
|
||||
"group": "root"
|
||||
}
|
||||
},
|
||||
"access_log": "/logs/unit_access"
|
||||
}
|
||||
|
||||
+101
-25
@@ -1,55 +1,90 @@
|
||||
version: "3.7"
|
||||
|
||||
volumes:
|
||||
sshkey:
|
||||
|
||||
networks:
|
||||
default:
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 10.10.0.0/24
|
||||
volumes:
|
||||
adguard:
|
||||
|
||||
services:
|
||||
ng:
|
||||
build:
|
||||
context: dockerfile
|
||||
dockerfile: doh.dockerfile
|
||||
volumes:
|
||||
- ./config/.profile:/root/.bashrc:ro
|
||||
- ./config/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./scripts/start_ng.sh:/start_ng.sh
|
||||
- ./certs/:/certs/
|
||||
- ./ssh/:/ssh/
|
||||
- ./logs/:/logs/
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
hostname: nginx
|
||||
environment:
|
||||
TZ: ${TZ}
|
||||
stop_grace_period: 1s
|
||||
command: ["/bin/sh", "/start_ng.sh"]
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: 10.10.0.2
|
||||
unit:
|
||||
build:
|
||||
dockerfile: dockerfile/php.dockerfile
|
||||
args:
|
||||
IP: ${IP}
|
||||
ports:
|
||||
- 443:443
|
||||
volumes:
|
||||
- ./config/unit.json:/docker-entrypoint.d/config.json
|
||||
- ./config/php.ini:/usr/local/etc/php/php.ini
|
||||
- ./config/.profile:/root/.bashrc:ro
|
||||
- ./config/clients.json:/app/clients.json
|
||||
- ./app:/app
|
||||
- ./logs:/app/logs/
|
||||
- ./config/php.ini:/usr/local/etc/php/php.ini
|
||||
- ./config/clients.json:/config/clients.json
|
||||
- ./config/pac.json:/config/pac.json
|
||||
- ./config/unit.json:/config/unit.json
|
||||
- ./config/nginx.conf:/config/nginx.conf
|
||||
- ./config/ssserver.json:/config/ssserver.json
|
||||
- ./config/sslocal.json:/config/sslocal.json
|
||||
- ./certs/:/certs/
|
||||
- type: volume
|
||||
target: /ssh
|
||||
source: sshkey
|
||||
target: /config/adguard
|
||||
source: adguard
|
||||
- ./ssh/:/ssh/
|
||||
- ./app:/app
|
||||
- ./logs/:/logs/
|
||||
- ./scripts/start_unit.sh:/start_unit.sh
|
||||
environment:
|
||||
TZ: ${TZ}
|
||||
ADDRESS: ${ADDRESS}
|
||||
PORT_WG: ${PORT}
|
||||
ADDRESS: ${WGADDRESS}
|
||||
PORT_WG: ${WGPORT}
|
||||
hostname: unit
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- wg
|
||||
stop_grace_period: 1s
|
||||
command: bash -c 'chown -R www-data:www-data /app/logs && chown www-data:www-data /app/clients.json && php init.php && /usr/local/bin/docker-entrypoint.sh unitd --no-daemon'
|
||||
command: ["/bin/sh", "/start_unit.sh"]
|
||||
working_dir: /app
|
||||
depends_on:
|
||||
- ng
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: 10.10.0.7
|
||||
proxy:
|
||||
build:
|
||||
dockerfile: dockerfile/proxy.dockerfile
|
||||
dockerfile: dockerfile/shadowsocks.dockerfile
|
||||
ports:
|
||||
- 1080:1080
|
||||
volumes:
|
||||
- ./config/.profile:/root/.bashrc:ro
|
||||
- ./config/sockd.conf:/etc/sockd.conf
|
||||
- ./config/sslocal.json:/config.json
|
||||
- ./ssh:/ssh
|
||||
- ./scripts/start_proxy.sh:/start_proxy.sh
|
||||
hostname: proxy
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: 10.10.0.3
|
||||
environment:
|
||||
TZ: ${TZ}
|
||||
stop_grace_period: 1s
|
||||
command: ["/bin/sh", "/start_proxy.sh"]
|
||||
wg:
|
||||
build:
|
||||
dockerfile: dockerfile/wireguard.dockerfile
|
||||
@@ -58,16 +93,57 @@ services:
|
||||
- ./config/wg0.conf:/etc/wireguard/wg0.conf
|
||||
- ./scripts/start_wg.sh:/start_wg.sh
|
||||
- ./scripts/reset_wg.sh:/reset_wg.sh
|
||||
- type: volume
|
||||
target: /ssh
|
||||
source: sshkey
|
||||
- ./ssh:/ssh
|
||||
hostname: wireguard
|
||||
ports:
|
||||
- ${PORT}:${PORT}/udp
|
||||
- ${WGPORT}:${WGPORT}/udp
|
||||
environment:
|
||||
TZ: ${TZ}
|
||||
PORT_WG: ${PORT}
|
||||
ADDRESS: ${ADDRESS}
|
||||
PORT_WG: ${WGPORT}
|
||||
ADDRESS: ${WGADDRESS}
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
stop_grace_period: 1s
|
||||
command: ["/bin/sh", "/start_wg.sh"]
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: 10.10.0.4
|
||||
ad:
|
||||
build:
|
||||
dockerfile: dockerfile/adguard.dockerfile
|
||||
volumes:
|
||||
- ./config/.profile:/root/.bashrc:ro
|
||||
- type: volume
|
||||
target: /opt/adguardhome
|
||||
source: adguard
|
||||
- ./ssh:/ssh
|
||||
- ./logs/:/logs/
|
||||
- ./scripts/start_ad.sh:/start_ad.sh
|
||||
hostname: adguard
|
||||
environment:
|
||||
TZ: ${TZ}
|
||||
stop_grace_period: 1s
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: 10.10.0.5
|
||||
command: ["/bin/sh", "/start_ad.sh"]
|
||||
ss:
|
||||
build:
|
||||
dockerfile: dockerfile/shadowsocks.dockerfile
|
||||
volumes:
|
||||
- ./config/.profile:/root/.bashrc:ro
|
||||
- ./config/ssserver.json:/config.json
|
||||
- ./ssh:/ssh
|
||||
- ./scripts/start_ss.sh:/start_ss.sh
|
||||
hostname: shadowsocks
|
||||
ports:
|
||||
- 8388:8388/udp
|
||||
- 8388:8388/tcp
|
||||
environment:
|
||||
TZ: ${TZ}
|
||||
stop_grace_period: 1s
|
||||
command: ["/bin/sh", "/start_ss.sh"]
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: 10.10.0.6
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
from nginx:stable
|
||||
run apt update && \
|
||||
apt install -y git net-tools lsof ssh wget && \
|
||||
wget https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.21/AdGuardHome_linux_amd64.tar.gz && \
|
||||
tar -xf AdGuardHome_linux_amd64.tar.gz && \
|
||||
mkdir -p /opt/adguardhome && \
|
||||
mkdir /root/.ssh
|
||||
copy config/AdGuardHome.yaml /opt/adguardhome/AdGuardHome.yaml
|
||||
@@ -0,0 +1,6 @@
|
||||
from nginx:stable
|
||||
run apt update && \
|
||||
apt install -y git net-tools lsof ssh && \
|
||||
git clone https://github.com/TuxInvader/nginx-dns.git && \
|
||||
cp -r ./nginx-dns/njs.d /etc/nginx/ && \
|
||||
mkdir /root/.ssh
|
||||
@@ -1,9 +1,9 @@
|
||||
from nginx/unit:1.29.0-php8.1
|
||||
run apt update && apt install -y libssh2-1-dev && pecl install https://pecl.php.net/get/ssh2-1.3.1.tgz
|
||||
ARG IP
|
||||
run mkdir /cert && \
|
||||
openssl req -newkey rsa:2048 -sha256 -nodes \
|
||||
-keyout /cert/nginx_private.key -x509 -days 365 -out /cert/nginx_public.pem \
|
||||
-subj "/C=US/ST=New York/L=Brooklyn/O=Example Brooklyn Company/CN=$IP" && \
|
||||
cat /cert/nginx_private.key /cert/nginx_public.pem > /docker-entrypoint.d/cert.pem
|
||||
workdir /app
|
||||
arg IP
|
||||
run apt update && apt install -y wget libssh2-1-dev ssh libicu-dev libyaml-dev certbot && \
|
||||
pecl install https://pecl.php.net/get/ssh2-1.3.1.tgz && \
|
||||
pecl install https://pecl.php.net/get/yaml-2.2.2.tgz && \
|
||||
docker-php-ext-install intl && \
|
||||
wget https://github.com/ameshkov/dnslookup/releases/download/v1.8.1/dnslookup-linux-amd64-v1.8.1.tar.gz && \
|
||||
tar -xf dnslookup-linux-amd64-v1.8.1.tar.gz
|
||||
env PATH="$PATH:/linux-amd64"
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
from ubuntu:18.04
|
||||
run apt update && \
|
||||
apt install -y build-essential gcc make wget && \
|
||||
wget https://www.inet.no/dante/files/dante-1.4.3.tar.gz && \
|
||||
tar -xf dante-1.4.3.tar.gz && \
|
||||
cd dante-1.4.3 && \
|
||||
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-client --without-libwrap --without-bsdauth --without-gssapi --without-krb5 --without-upnp --without-pam && \
|
||||
make && \
|
||||
make install
|
||||
expose 1080
|
||||
cmd ["sockd"]
|
||||
@@ -0,0 +1,11 @@
|
||||
from ubuntu:18.04
|
||||
run apt update && \
|
||||
apt install -y ssh git net-tools
|
||||
run mkdir /root/.ssh && \
|
||||
mkdir /ssh && \
|
||||
touch /root/.ssh/authorized_keys && \
|
||||
wget https://github.com/shadowsocks/shadowsocks-rust/releases/download/v1.15.1/shadowsocks-v1.15.1.x86_64-unknown-linux-gnu.tar.xz && \
|
||||
tar -xf shadowsocks-v1.15.1.x86_64-unknown-linux-gnu.tar.xz && \
|
||||
wget https://github.com/teddysun/v2ray-plugin/releases/download/v5.1.0/v2ray-plugin-linux-amd64-v5.1.0.tar.gz && \
|
||||
tar xf v2ray-plugin-linux-amd64-v5.1.0.tar.gz && \
|
||||
mv v2ray-plugin_linux_amd64 /usr/local/bin/v2ray-plugin
|
||||
@@ -3,15 +3,8 @@ run apt update && \
|
||||
apt install -y wireguard \
|
||||
iproute2 \
|
||||
net-tools \
|
||||
lsof \
|
||||
iptables \
|
||||
linux-headers-$(uname -r) \
|
||||
ssh
|
||||
run mkdir /root/.ssh && \
|
||||
mkdir /ssh && \
|
||||
touch /root/.ssh/authorized_keys && \
|
||||
ssh-keygen -t rsa -f /ssh/key -N '' && \
|
||||
chmod 644 /ssh/key && \
|
||||
wg genkey > /etc/wireguard/privatekey
|
||||
copy ./scripts/start_wg.sh /start_wg.sh
|
||||
copy ./scripts/reset_wg.sh /reset_wg.sh
|
||||
cmd ["/bin/sh", "/start_wg.sh"]
|
||||
ssh && \
|
||||
mkdir /root/.ssh
|
||||
|
||||
@@ -6,10 +6,10 @@ unhosts:
|
||||
sed -i '/test.ru/d' /mnt/c/Windows/System32/drivers/etc/hosts
|
||||
u: # запуск контейнеров
|
||||
IP=$(shell curl https://ipinfo.io/ip) docker compose up -d --build --force-recreate
|
||||
sleep 1
|
||||
docker compose logs wg unit proxy
|
||||
# sleep 1
|
||||
# docker compose logs unit wg ss proxy
|
||||
d: # остановка контейнеров
|
||||
docker compose down -v
|
||||
docker compose down
|
||||
ps: # список контейнеров
|
||||
docker compose ps
|
||||
l: # логи из контейнеров
|
||||
@@ -20,3 +20,13 @@ proxy: # консоль сервиса
|
||||
docker compose exec proxy bash
|
||||
wg: # консоль сервиса
|
||||
docker compose exec wg bash
|
||||
ss: # консоль сервиса
|
||||
docker compose exec ss bash
|
||||
ng: # консоль сервиса
|
||||
docker compose exec ng bash
|
||||
doh: # консоль сервиса
|
||||
docker compose exec doh bash
|
||||
ad: # консоль сервиса
|
||||
docker compose exec ad bash
|
||||
proxy: # консоль сервиса
|
||||
docker compose exec proxy bash
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ apt install -y \
|
||||
make \
|
||||
git
|
||||
mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
||||
service ssh start
|
||||
/AdGuardHome/AdGuardHome -s install -c /opt/adguardhome/AdGuardHome.yaml -h 0.0.0.0 -w /opt/adguardhome/
|
||||
tail -f /dev/null
|
||||
@@ -0,0 +1,5 @@
|
||||
openssl req -newkey rsa:2048 -sha256 -nodes -x509 -days 365 -keyout /certs/self_private -out /certs/self_public -subj "/C=NN/ST=N/L=N/O=N/CN=$(curl https://ipinfo.io/ip)"
|
||||
ssh-keygen -m PEM -t rsa -f /ssh/key -N ''
|
||||
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
||||
service ssh start
|
||||
nginx -g "daemon off;"
|
||||
@@ -0,0 +1,4 @@
|
||||
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
||||
service ssh start
|
||||
/sslocal -v -d -c /config.json
|
||||
tail -f /dev/null
|
||||
@@ -0,0 +1,4 @@
|
||||
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
||||
service ssh start
|
||||
/ssserver -v -d -c /config.json
|
||||
tail -f /dev/null
|
||||
@@ -0,0 +1,5 @@
|
||||
php init.php
|
||||
unitd --log /logs/unit_error
|
||||
curl -X PUT --data-binary @/config/unit.json --unix-socket /var/run/control.unit.sock http://localhost/config
|
||||
kill -TERM $(/bin/cat /var/run/unit.pid)
|
||||
unitd --no-daemon --log /logs/unit_error
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
INTERFACE=$(route | grep '^default' | grep -o '[^ ]*$')
|
||||
PRIVATEKEY=$(cat /etc/wireguard/privatekey)
|
||||
if [ $(cat /etc/wireguard/wg0.conf | wc -c) -eq 0 ]
|
||||
then
|
||||
PRIVATEKEY=$(wg genkey | tee /etc/wireguard/privatekey)
|
||||
INTERFACE=$(route | grep '^default' | grep -o '[^ ]*$')
|
||||
echo "[Interface]" > /etc/wireguard/wg0.conf
|
||||
echo "PrivateKey = $PRIVATEKEY" >> /etc/wireguard/wg0.conf
|
||||
echo "Address = $ADDRESS" >> /etc/wireguard/wg0.conf
|
||||
|
||||
Reference in New Issue
Block a user