* Sat Mar 01 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-6.sme
- move to full systemd units [SME: 12878]
This commit is contained in:
6
root/etc/e-smith/templates/etc/rsyslog.conf/32dnscache
Normal file
6
root/etc/e-smith/templates/etc/rsyslog.conf/32dnscache
Normal file
@@ -0,0 +1,6 @@
|
||||
#dnscache
|
||||
:programname, isequal, "dnscache" /var/log/dnscache/dnscache.log
|
||||
& stop
|
||||
:programname, isequal, "dnscache.forwarder" /var/log/dnscache.forwarder/dnscache.forwarder.log
|
||||
& stop
|
||||
|
@@ -0,0 +1,10 @@
|
||||
[Service]
|
||||
{
|
||||
my $datalimit = $dnscache{'DataLimit'} || "12000000";
|
||||
my $c = $dnscache{'CacheSize'} || 10000000;
|
||||
my $forwarder = (defined $dnscache{'Forwarder'} && $dnscache{'Forwarder'}) ? "FORWARDONLY=1" : "";
|
||||
$OUT = "LimitDATA=$datalimit\n";
|
||||
$OUT .= 'Environment=\n";
|
||||
$OUT .= 'Environment="DATALIMIT='.$datalimit.'" "IP=127.0.0.2" IPSEND=0.0.0.0 '.$forwarder.' CACHESIZE='.$c.' GID=410 UID=410 "ROOT=/var/service/dnscache.forwarder/root"';
|
||||
}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
i[Service]
|
||||
{
|
||||
my $datalimit = $dnscache{'DataLimit'} || "3000000";
|
||||
my $localip = $config->get('LocalIP');
|
||||
my $ListenIP= $dnscache->prop('ListenIP') || $localip->value || "127.0.0.3";
|
||||
$OUT = "LimitDATA=$datalimit\n";
|
||||
$OUT .= 'Environment="DATALIMIT='.$datalimit.'" "IP='.$ListenIP.'" IPSEND=0.0.0.0 GID=410 UID=410 "ROOT=/var/service/dnscache/root"';
|
||||
}
|
||||
|
@@ -1,4 +0,0 @@
|
||||
{
|
||||
my $c = $dnscache{'CacheSize'} || 10000000;
|
||||
"export CACHESIZE=$c"
|
||||
}
|
@@ -1,4 +0,0 @@
|
||||
{
|
||||
my $datalimit = $dnscache{'DataLimit'} || 12000000;
|
||||
"DATALIMIT=$datalimit";
|
||||
}
|
@@ -1,4 +0,0 @@
|
||||
{
|
||||
(defined $dnscache{'Forwarder'} && $dnscache{'Forwarder'}) ?
|
||||
"export FORWARDONLY=1" : "";
|
||||
}
|
@@ -1 +0,0 @@
|
||||
export IP=127.0.0.2
|
@@ -1 +0,0 @@
|
||||
export IPSEND=0.0.0.0
|
@@ -1 +0,0 @@
|
||||
export ROOT=/var/service/dnscache.forwarder/root
|
16
root/etc/logrotate.d/dnscache
Normal file
16
root/etc/logrotate.d/dnscache
Normal file
@@ -0,0 +1,16 @@
|
||||
/var/log/dnscache.forwarder/dnscache.forwarder.log
|
||||
/var/log/dnscache/dnscache.log{
|
||||
weekly
|
||||
rotate 4
|
||||
missingok
|
||||
notifempty
|
||||
compress
|
||||
delaycompress
|
||||
sharedscripts
|
||||
su root root
|
||||
create 600 root root
|
||||
postrotate
|
||||
/usr/bin/systemctl try-restart dnscache.service dnscache.forwarder.service >/dev/null 2>&1 || true
|
||||
endscript
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ unless (-f "/var/service/dnscache/seed")
|
||||
or warn("Could not create seed file");
|
||||
}
|
||||
|
||||
open(STDIN, "<./seed") or warn "Failed to redirect input from seed file: $!";
|
||||
open(STDIN, "</var/service/dnscache/seed") or warn "Failed to redirect input from seed file: $!";
|
||||
open(STDERR, ">&STDOUT") or warn "Failed to redirect stderr to stdout: $!";;
|
||||
|
||||
my $config = esmith::ConfigDB->open or die "Could not open config db.";
|
||||
@@ -71,7 +71,7 @@ $ENV{FORWARDONLY} = '1';
|
||||
$ENV{IP} = $dnscache->prop('ListenIP') || $localip->value;
|
||||
$ENV{IPSEND} = $dnscache->prop('SendIP') || '0.0.0.0';
|
||||
$ENV{CACHESIZE} = 200000;
|
||||
$ENV{ROOT} = '/service/dnscache/root';
|
||||
$ENV{ROOT} = '/var/service/dnscache/root';
|
||||
|
||||
my $domains = esmith::DomainsDB->open or die "Could not open Domains db.";
|
||||
my $nets = esmith::NetworksDB->open or die "Could not open Networks db.";
|
||||
@@ -119,18 +119,18 @@ delegate_domains_2DNS(
|
||||
$domains->get_all_by_prop('type', 'domain-remote')
|
||||
));
|
||||
|
||||
my $datalimit = $dnscache->prop('DataLimit') || 3000000;
|
||||
|
||||
# Ensure that forwarder instance is started
|
||||
system("sv", "u", "/service/dnscache.forwarder");
|
||||
|
||||
# http://marc.theaimsgroup.com/?l=djbdns&m=104812086607532&w=2
|
||||
$SIG{'PIPE'} = 'IGNORE';
|
||||
exec("envuidgid", "dnscache", "softlimit", "-o250", "-d", "$datalimit",
|
||||
"/usr/local/bin/dnscache")
|
||||
or die "failed to execute envuidgid/softlimit/dnscache: $!";
|
||||
# NOTREACHED
|
||||
exit (1);
|
||||
#my $datalimit = $dnscache->prop('DataLimit') || 3000000;
|
||||
#
|
||||
## Ensure that forwarder instance is started
|
||||
#system("sv", "u", "/service/dnscache.forwarder");
|
||||
/usr/bin/systemctl restart dnscache.forwarder
|
||||
#
|
||||
## http://marc.theaimsgroup.com/?l=djbdns&m=104812086607532&w=2
|
||||
#$SIG{'PIPE'} = 'IGNORE';
|
||||
#exec("envuidgid", "dnscache", "softlimit", "-o250", "-d", "$datalimit",
|
||||
# "/usr/local/bin/dnscache")
|
||||
# or die "failed to execute envuidgid/softlimit/dnscache: $!";
|
||||
exit (0);
|
||||
|
||||
sub allow_networks_2access_cache
|
||||
{
|
7
root/var/service/dnscache.forwarder/run → root/sbin/e-smith/systemd/dnscache.forwarder-pre
Normal file → Executable file
7
root/var/service/dnscache.forwarder/run → root/sbin/e-smith/systemd/dnscache.forwarder-pre
Normal file → Executable file
@@ -1,12 +1,9 @@
|
||||
#! /bin/sh
|
||||
exec 2>&1
|
||||
. ./config
|
||||
|
||||
cd /var/service/dnscache.forwarder/
|
||||
# Ensure that dnscache has source of randomness to initialise its source
|
||||
# port RNG
|
||||
test -f ./seed || /bin/dd if=/dev/urandom bs=128 count=1 of=seed
|
||||
exec<./seed
|
||||
exit 0
|
||||
|
||||
# http://marc.theaimsgroup.com/?l=djbdns&m=104812086607532&w=2
|
||||
trap "" SIGPIPE
|
||||
exec envuidgid dnscache softlimit -o250 -d "$DATALIMIT" /usr/local/bin/dnscache
|
@@ -1 +0,0 @@
|
||||
/var/service/dnscache
|
@@ -1 +0,0 @@
|
||||
/var/service/dnscache.forwarder
|
@@ -1,15 +1,24 @@
|
||||
[Unit]
|
||||
Description=dnscache.forwarder,
|
||||
Description=dnscache.forwarder, An iterative DNS forwarder resolver daemon
|
||||
Documentation=man:dnscache(8)
|
||||
After=network.target
|
||||
Requires=runit.service
|
||||
After=networking.service
|
||||
Requires=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Type=simple
|
||||
PermissionsStartOnly=true
|
||||
LimitDATA=12000000
|
||||
LimitNOFILE=250
|
||||
WorkingDirectory=/var/service/dnscache.forwarder/root
|
||||
Environment="DATALIMIT=12000000" "IP=127.0.0.2" FORWARDONLY=1 IPSEND=0.0.0.0 CACHESIZE=10000000 GID=410 UID=410 "ROOT=/var/service/dnscache.forwarder/root"
|
||||
ExecStartPre=/sbin/e-smith/service-status dnscache.forwarder
|
||||
ExecStart=/usr/bin/sv u /service/dnscache.forwarder
|
||||
ExecStop=/usr/bin/sv stop /service/dnscache.forwarder
|
||||
ExecReload=/usr/bin/sv t /service/dnscache.forwarder
|
||||
RemainAfterExit=yes
|
||||
ExecStartPre=/sbin/e-smith/systemd/dnscache.forwarder-pre
|
||||
ExecStart=/usr/local/bin/dnscache
|
||||
|
||||
Restart=always
|
||||
RestartSec=20s
|
||||
SyslogIdentifier=dnscache.forwarder
|
||||
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
||||
|
@@ -1,15 +1,26 @@
|
||||
[Unit]
|
||||
Description=dnscache,
|
||||
Description=dnscache, An iterative DNS resolver daemon
|
||||
Documentation=man:dnscache(8)
|
||||
After=network.target
|
||||
Requires=runit.service
|
||||
After=networking.service
|
||||
Requires=network.target
|
||||
Wants=dnscache.forwarder.service
|
||||
#BindsTo= > Requires= > Wants= > Requisite=
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Type=simple
|
||||
PermissionsStartOnly=true
|
||||
LimitDATA=3000000
|
||||
LimitNOFILE=250
|
||||
WorkingDirectory=/var/service/dnscache/root
|
||||
Environment="DATALIMIT=3000000" "IP=192.168.233.1" FORWARDONLY=1 IPSEND=0.0.0.0 CACHESIZE=200000 GID=410 UID=410 "ROOT=/var/service/dnscache/root"
|
||||
ExecStartPre=/sbin/e-smith/service-status dnscache
|
||||
ExecStart=/usr/bin/sv u /service/dnscache
|
||||
ExecStop=/usr/bin/sv stop /service/dnscache
|
||||
ExecReload=/usr/bin/sv t /service/dnscache
|
||||
RemainAfterExit=yes
|
||||
ExecStartPre=/sbin/e-smith/systemd/dnscache-pre
|
||||
ExecStart=/usr/local/bin/dnscache
|
||||
|
||||
Restart=always
|
||||
RestartSec=20s
|
||||
SyslogIdentifier=dnscache
|
||||
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
||||
|
1
root/var/service/dnscache.forwarder/env/ROOT
vendored
1
root/var/service/dnscache.forwarder/env/ROOT
vendored
@@ -1 +0,0 @@
|
||||
/var/service/dnscache/root
|
@@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 2005 Mitel Networks Corporation
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Technical support for this program is available from Mitel Networks
|
||||
# Please visit our web site www.mitel.com/sme/ for details.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
exec \
|
||||
/usr/bin/setuidgid dnslog \
|
||||
/usr/bin/multilog t s5000000 \
|
||||
/var/log/dnscache.forwarder
|
||||
|
1
root/var/service/dnscache/env/ROOT
vendored
1
root/var/service/dnscache/env/ROOT
vendored
@@ -1 +0,0 @@
|
||||
/var/service/dnscache/root
|
@@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 1999-2003 Mitel Networks Corporation
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Technical support for this program is available from Mitel Networks
|
||||
# Please visit our web site www.mitel.com/sme/ for details.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
exec \
|
||||
/usr/bin/setuidgid dnslog \
|
||||
/usr/bin/multilog t s5000000 \
|
||||
/var/log/dnscache
|
||||
|
Reference in New Issue
Block a user