AdGuardHome from docker image
This commit is contained in:
+2
-1
@@ -13,4 +13,5 @@
|
||||
/todo.todo
|
||||
/app/zapretlists/*
|
||||
!/app/zapretlists/.gitkeep
|
||||
.vscode/sftp.json
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
+19
-17
@@ -3,6 +3,7 @@
|
||||
class Bot
|
||||
{
|
||||
public $input;
|
||||
public $adguard;
|
||||
|
||||
public function __construct($key, $i18n)
|
||||
{
|
||||
@@ -16,6 +17,7 @@ class Bot
|
||||
$this->language = $this->getPacConf()['language'] ?: 'en';
|
||||
$this->dns = '1.1.1.1, 8.8.8.8';
|
||||
$this->limit = $this->getPacConf()['limitpage'] ?: 5;
|
||||
$this->adguard = '/config/AdGuardHome.yaml';
|
||||
}
|
||||
|
||||
public function input()
|
||||
@@ -757,7 +759,7 @@ class Bot
|
||||
],
|
||||
'ss' => $this->getSSConfig(),
|
||||
'sl' => $this->getSSLocalConfig(),
|
||||
'ad' => yaml_parse_file('/config/adguard/AdGuardHome.yaml'),
|
||||
'ad' => yaml_parse_file($this->adguard),
|
||||
'pac' => $this->getPacConf(),
|
||||
'ssl' => file_exists('/certs/cert_private') && preg_match('~BEGIN PRIVATE KEY~', file_get_contents('/certs/cert_private')) ? [
|
||||
'private' => file_get_contents('/certs/cert_private'),
|
||||
@@ -825,7 +827,7 @@ class Bot
|
||||
$out[] = 'update adguard';
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
$this->stopAd();
|
||||
yaml_emit_file('/config/adguard/AdGuardHome.yaml', $json['ad']);
|
||||
yaml_emit_file($this->adguard, $json['ad']);
|
||||
$this->startAd();
|
||||
}
|
||||
// ss
|
||||
@@ -1159,10 +1161,10 @@ class Bot
|
||||
$this->update($this->input['chat'], $this->input['message_id'], $u);
|
||||
$u .= $this->stopAd();
|
||||
$this->update($this->input['chat'], $this->input['message_id'], $u);
|
||||
$c = yaml_parse_file('/config/adguard/AdGuardHome.yaml');
|
||||
$c = yaml_parse_file($this->adguard);
|
||||
$c['tls']['enabled'] = false;
|
||||
$c['tls']['server_name'] = '';
|
||||
yaml_emit_file('/config/adguard/AdGuardHome.yaml', $c);
|
||||
yaml_emit_file($this->adguard, $c);
|
||||
$u .= $this->startAd();
|
||||
$this->update($this->input['chat'], $this->input['message_id'], $u);
|
||||
unlink('/certs/cert_private');
|
||||
@@ -1225,10 +1227,10 @@ class Bot
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
$out[] = $this->stopAd();
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
$c = yaml_parse_file('/config/adguard/AdGuardHome.yaml');
|
||||
$c = yaml_parse_file($this->adguard);
|
||||
$c['tls']['enabled'] = true;
|
||||
$c['tls']['server_name'] = $conf['domain'];
|
||||
yaml_emit_file('/config/adguard/AdGuardHome.yaml', $c);
|
||||
yaml_emit_file($this->adguard, $c);
|
||||
$out[] = $this->startAd();
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
} else {
|
||||
@@ -1438,9 +1440,9 @@ class Bot
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
$out[] = $this->stopAd();
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
$c = yaml_parse_file('/config/adguard/AdGuardHome.yaml');
|
||||
$c = yaml_parse_file($this->adguard);
|
||||
$c['users'][0]['password'] = password_hash($pass, PASSWORD_DEFAULT);
|
||||
yaml_emit_file('/config/adguard/AdGuardHome.yaml', $c);
|
||||
yaml_emit_file($this->adguard, $c);
|
||||
$p = $this->getPacConf();
|
||||
$p['adpswd'] = $pass;
|
||||
$this->setPacConf($p);
|
||||
@@ -1456,8 +1458,8 @@ class Bot
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
$out[] = $this->stopAd();
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
$c = yaml_parse_file('/config/AdGuardHome.yaml');
|
||||
yaml_emit_file('/config/adguard/AdGuardHome.yaml', $c);
|
||||
$c = yaml_parse_file($this->adguard);
|
||||
yaml_emit_file($this->adguard, $c);
|
||||
$out[] = $this->startAd();
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
sleep(3);
|
||||
@@ -1524,9 +1526,9 @@ DNS-over-HTTPS with IP:
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
$out[] = $this->stopAd();
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
$c = yaml_parse_file('/config/adguard/AdGuardHome.yaml');
|
||||
$c = yaml_parse_file($this->adguard);
|
||||
$c['dns']['upstream_dns'][] = $url;
|
||||
yaml_emit_file('/config/adguard/AdGuardHome.yaml', $c);
|
||||
yaml_emit_file($this->adguard, $c);
|
||||
$out[] = $this->startAd();
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
sleep(3);
|
||||
@@ -1538,21 +1540,21 @@ DNS-over-HTTPS with IP:
|
||||
$out[] = 'Restart Adguard Home';
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
$this->stopAd();
|
||||
$c = yaml_parse_file('/config/adguard/AdGuardHome.yaml');
|
||||
$c = yaml_parse_file($this->adguard);
|
||||
unset($c['dns']['upstream_dns'][$k]);
|
||||
yaml_emit_file('/config/adguard/AdGuardHome.yaml', $c);
|
||||
yaml_emit_file($this->adguard, $c);
|
||||
$this->startAd();
|
||||
$this->menu('adguard');
|
||||
}
|
||||
|
||||
public function startAd()
|
||||
{
|
||||
return $this->ssh('/AdGuardHome/AdGuardHome --pidfile /AdGuardHome/pid -c /opt/adguardhome/AdGuardHome.yaml -h 0.0.0.0 -w /opt/adguardhome/ > /dev/null 2>&1 &', 'ad', false);
|
||||
return $this->ssh('/opt/adguardhome/AdGuardHome --no-check-update --pidfile /opt/adguardhome/pid -c /config/AdGuardHome.yaml -h 0.0.0.0 -w /opt/adguardhome/work > /dev/null 2>&1 &', 'ad', false);
|
||||
}
|
||||
|
||||
public function stopAd()
|
||||
{
|
||||
return $this->ssh('kill -15 $(cat /AdGuardHome/pid)', 'ad');
|
||||
return $this->ssh('kill -15 $(cat /opt/adguardhome/pid)', 'ad');
|
||||
}
|
||||
|
||||
public function selfsslInstall()
|
||||
@@ -2802,7 +2804,7 @@ DNS-over-HTTPS with IP:
|
||||
'callback_data' => "/addupstream",
|
||||
],
|
||||
];
|
||||
$upstreams = yaml_parse_file('/config/adguard/AdGuardHome.yaml')['dns']['upstream_dns'];
|
||||
$upstreams = yaml_parse_file($this->adguard)['dns']['upstream_dns'];
|
||||
if (!empty($upstreams)) {
|
||||
foreach ($upstreams as $k => $v) {
|
||||
$data[] = [
|
||||
|
||||
+4
-144
@@ -1,160 +1,20 @@
|
||||
bind_host: 0.0.0.0
|
||||
bind_port: 80
|
||||
http:
|
||||
address: 0.0.0.0:80
|
||||
users:
|
||||
- name: admin
|
||||
password:
|
||||
auth_attempts: 5
|
||||
block_auth_min: 15
|
||||
http_proxy: ""
|
||||
language: ""
|
||||
theme: auto
|
||||
debug_pprof: false
|
||||
web_session_ttl: 720
|
||||
statistics:
|
||||
interval: 24h
|
||||
querylog:
|
||||
enabled: true
|
||||
file_enabled: true
|
||||
interval: 2160h
|
||||
size_memory: 1000
|
||||
dns:
|
||||
bind_hosts:
|
||||
- 0.0.0.0
|
||||
port: 53
|
||||
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: 200
|
||||
ratelimit_whitelist: []
|
||||
refuse_any: true
|
||||
upstream_dns:
|
||||
- 1.1.1.1
|
||||
- 8.8.8.8
|
||||
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:
|
||||
enabled: false
|
||||
use_custom: false
|
||||
custom_ip: ''
|
||||
max_goroutines: 300
|
||||
handle_ddr: true
|
||||
ipset: []
|
||||
ipset_file: ""
|
||||
filtering_enabled: true
|
||||
filters_update_interval: 24
|
||||
parental_enabled: false
|
||||
safe_search:
|
||||
enabled: false
|
||||
bing: true
|
||||
duckduckgo: true
|
||||
google: true
|
||||
pixabay: true
|
||||
yandex: true
|
||||
youtube: true
|
||||
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: []
|
||||
use_dns64: false
|
||||
dns64_prefixes: []
|
||||
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: /certs/cert_public
|
||||
private_key_path: /certs/cert_private
|
||||
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: "/logs/adguard"
|
||||
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: 20
|
||||
log:
|
||||
file: /logs/adguard
|
||||
|
||||
+4
-16
@@ -80,21 +80,8 @@ services:
|
||||
volumes:
|
||||
- ./config/.profile:/root/.ashrc:ro
|
||||
- ./config/php.ini:/etc/php82/php.ini
|
||||
- ./config/clients.json:/config/clients.json
|
||||
- ./config/pac.json:/config/pac.json
|
||||
- ./config/unit.json:/config/unit.json
|
||||
- ./config/AdGuardHome.yaml:/config/AdGuardHome.yaml
|
||||
- ./config/nginx.conf:/config/nginx.conf
|
||||
- ./config/upstream.conf:/config/upstream.conf
|
||||
- ./config/nginx_default.conf:/config/nginx_default.conf
|
||||
- ./config/ssserver.json:/config/ssserver.json
|
||||
- ./config/sslocal.json:/config/sslocal.json
|
||||
- ./config/mtprotosecret:/config/mtprotosecret
|
||||
- ./config/xray.json:/config/xray.json
|
||||
- ./config/:/config/
|
||||
- ./certs/:/certs/
|
||||
- type: volume
|
||||
target: /config/adguard
|
||||
source: adguard
|
||||
- ./ssh:/ssh
|
||||
- ./app:/app
|
||||
- ./logs/:/logs/
|
||||
@@ -187,10 +174,11 @@ services:
|
||||
volumes:
|
||||
- ./config/.profile:/root/.ashrc:ro
|
||||
- type: volume
|
||||
target: /opt/adguardhome
|
||||
target: /opt/adguardhome/work
|
||||
source: adguard
|
||||
- ./ssh:/ssh
|
||||
- ./config/sshd_config:/etc/ssh/sshd_config
|
||||
- ./config/:/config/
|
||||
- ./certs/:/certs/
|
||||
- ./logs/:/logs/
|
||||
- ./scripts/start_ad.sh:/start_ad.sh
|
||||
@@ -206,7 +194,7 @@ services:
|
||||
ipv4_address: 10.10.0.5
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
command: ["/bin/sh", "/start_ad.sh"]
|
||||
entrypoint: ["/bin/sh", "/start_ad.sh"]
|
||||
logging: *default-logging
|
||||
ss:
|
||||
build:
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
FROM alpine:3.18.2
|
||||
FROM adguard/adguardhome
|
||||
RUN apk add --no-cache --update openssh \
|
||||
&& wget https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.39/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
|
||||
ENV ENV="/root/.ashrc"
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ route add -net 10.0.1.0 netmask 255.255.255.0 gw wg
|
||||
cat /ssh/key.pub > /root/.ssh/authorized_keys
|
||||
ssh-keygen -A
|
||||
exec /usr/sbin/sshd -D -e "$@" &
|
||||
/AdGuardHome/AdGuardHome --pidfile /AdGuardHome/pid -c /opt/adguardhome/AdGuardHome.yaml -h 0.0.0.0 -w /opt/adguardhome/
|
||||
/opt/adguardhome/AdGuardHome --no-check-update --pidfile /opt/adguardhome/pid -c /config/AdGuardHome.yaml -h 0.0.0.0 -w /opt/adguardhome/work
|
||||
tail -f /dev/null
|
||||
|
||||
Reference in New Issue
Block a user