* 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:
parent
0caf31efad
commit
ece8bff7f3
15
createlinks
15
createlinks
@ -2,13 +2,15 @@
|
|||||||
|
|
||||||
use esmith::Build::CreateLinks qw(:all);
|
use esmith::Build::CreateLinks qw(:all);
|
||||||
|
|
||||||
foreach (qw(root/servers/@ config))
|
templates2events("/var/service/dnscache.forwarder/root/servers/@",
|
||||||
{
|
|
||||||
templates2events("/var/service/dnscache.forwarder/$_",
|
|
||||||
qw(bootstrap-console-save console-save dns-update smeserver-dnscache-update));
|
qw(bootstrap-console-save console-save dns-update smeserver-dnscache-update));
|
||||||
}
|
|
||||||
templates2events('/var/service/dnscache/root/servers/@',
|
templates2events('/var/service/dnscache/root/servers/@',
|
||||||
qw(bootstrap-console-save console-save dns-update smeserver-dnscache-update));
|
qw(bootstrap-console-save console-save dns-update smeserver-dnscache-update));
|
||||||
|
templates2events("/usr/lib/systemd/system/dnscache.forwarder.service.d/51koozali.conf",
|
||||||
|
qw(bootstrap-console-save console-save dns-update smeserver-dnscache-update));
|
||||||
|
templates2events("/usr/lib/systemd/system/dnscache.service.d/51koozali.conf",
|
||||||
|
qw(bootstrap-console-save console-save dns-update smeserver-dnscache-update));
|
||||||
|
event_link("systemd-reload", qw(console-save dns-update), "89")
|
||||||
|
|
||||||
foreach my $event (qw(
|
foreach my $event (qw(
|
||||||
console-save
|
console-save
|
||||||
@ -41,6 +43,9 @@ event_link("initialize-default-databases", "domain-modify", "00");
|
|||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
$event = "smeserver-dnscache-update";
|
$event = "smeserver-dnscache-update";
|
||||||
templates2events("/etc/systemd/system-preset/49-koozali.preset", $event);
|
templates2events("/etc/systemd/system-preset/49-koozali.preset", $event);
|
||||||
|
templates2events("/usr/lib/systemd/system/dnscache.forwarder.service.d/51koozali.conf", $event);
|
||||||
|
templates2events("/usr/lib/systemd/system/dnscache.service.d/51koozali.conf", $event);
|
||||||
|
templates2events("/etc/rsyslog.conf", $event);
|
||||||
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/rsyslog");
|
||||||
event_link("systemd-reload", $event, "89");
|
event_link("systemd-reload", $event, "89");
|
||||||
|
|
||||||
|
|
||||||
|
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");
|
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: $!";;
|
open(STDERR, ">&STDOUT") or warn "Failed to redirect stderr to stdout: $!";;
|
||||||
|
|
||||||
my $config = esmith::ConfigDB->open or die "Could not open config db.";
|
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{IP} = $dnscache->prop('ListenIP') || $localip->value;
|
||||||
$ENV{IPSEND} = $dnscache->prop('SendIP') || '0.0.0.0';
|
$ENV{IPSEND} = $dnscache->prop('SendIP') || '0.0.0.0';
|
||||||
$ENV{CACHESIZE} = 200000;
|
$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 $domains = esmith::DomainsDB->open or die "Could not open Domains db.";
|
||||||
my $nets = esmith::NetworksDB->open or die "Could not open Networks 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')
|
$domains->get_all_by_prop('type', 'domain-remote')
|
||||||
));
|
));
|
||||||
|
|
||||||
my $datalimit = $dnscache->prop('DataLimit') || 3000000;
|
#my $datalimit = $dnscache->prop('DataLimit') || 3000000;
|
||||||
|
#
|
||||||
# Ensure that forwarder instance is started
|
## Ensure that forwarder instance is started
|
||||||
system("sv", "u", "/service/dnscache.forwarder");
|
#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';
|
## http://marc.theaimsgroup.com/?l=djbdns&m=104812086607532&w=2
|
||||||
exec("envuidgid", "dnscache", "softlimit", "-o250", "-d", "$datalimit",
|
#$SIG{'PIPE'} = 'IGNORE';
|
||||||
"/usr/local/bin/dnscache")
|
#exec("envuidgid", "dnscache", "softlimit", "-o250", "-d", "$datalimit",
|
||||||
or die "failed to execute envuidgid/softlimit/dnscache: $!";
|
# "/usr/local/bin/dnscache")
|
||||||
# NOTREACHED
|
# or die "failed to execute envuidgid/softlimit/dnscache: $!";
|
||||||
exit (1);
|
exit (0);
|
||||||
|
|
||||||
sub allow_networks_2access_cache
|
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
|
#! /bin/sh
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
. ./config
|
cd /var/service/dnscache.forwarder/
|
||||||
|
|
||||||
# Ensure that dnscache has source of randomness to initialise its source
|
# Ensure that dnscache has source of randomness to initialise its source
|
||||||
# port RNG
|
# port RNG
|
||||||
test -f ./seed || /bin/dd if=/dev/urandom bs=128 count=1 of=seed
|
test -f ./seed || /bin/dd if=/dev/urandom bs=128 count=1 of=seed
|
||||||
exec<./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]
|
[Unit]
|
||||||
Description=dnscache.forwarder,
|
Description=dnscache.forwarder, An iterative DNS forwarder resolver daemon
|
||||||
|
Documentation=man:dnscache(8)
|
||||||
After=network.target
|
After=network.target
|
||||||
Requires=runit.service
|
After=networking.service
|
||||||
|
Requires=network.target
|
||||||
|
|
||||||
[Service]
|
[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
|
ExecStartPre=/sbin/e-smith/service-status dnscache.forwarder
|
||||||
ExecStart=/usr/bin/sv u /service/dnscache.forwarder
|
ExecStartPre=/sbin/e-smith/systemd/dnscache.forwarder-pre
|
||||||
ExecStop=/usr/bin/sv stop /service/dnscache.forwarder
|
ExecStart=/usr/local/bin/dnscache
|
||||||
ExecReload=/usr/bin/sv t /service/dnscache.forwarder
|
|
||||||
RemainAfterExit=yes
|
Restart=always
|
||||||
|
RestartSec=20s
|
||||||
|
SyslogIdentifier=dnscache.forwarder
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=sme-server.target
|
WantedBy=sme-server.target
|
||||||
|
@ -1,15 +1,26 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=dnscache,
|
Description=dnscache, An iterative DNS resolver daemon
|
||||||
|
Documentation=man:dnscache(8)
|
||||||
After=network.target
|
After=network.target
|
||||||
Requires=runit.service
|
After=networking.service
|
||||||
|
Requires=network.target
|
||||||
|
Wants=dnscache.forwarder.service
|
||||||
|
#BindsTo= > Requires= > Wants= > Requisite=
|
||||||
|
|
||||||
[Service]
|
[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
|
ExecStartPre=/sbin/e-smith/service-status dnscache
|
||||||
ExecStart=/usr/bin/sv u /service/dnscache
|
ExecStartPre=/sbin/e-smith/systemd/dnscache-pre
|
||||||
ExecStop=/usr/bin/sv stop /service/dnscache
|
ExecStart=/usr/local/bin/dnscache
|
||||||
ExecReload=/usr/bin/sv t /service/dnscache
|
|
||||||
RemainAfterExit=yes
|
Restart=always
|
||||||
|
RestartSec=20s
|
||||||
|
SyslogIdentifier=dnscache
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=sme-server.target
|
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
|
|
||||||
|
|
@ -4,7 +4,7 @@ Summary: smeserver module to configure dnscache
|
|||||||
%define name smeserver-dnscache
|
%define name smeserver-dnscache
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
%define version 11.0.0
|
%define version 11.0.0
|
||||||
%define release 5
|
%define release 6
|
||||||
Version: %{version}
|
Version: %{version}
|
||||||
Release: %{release}%{?dist}
|
Release: %{release}%{?dist}
|
||||||
License: GPL
|
License: GPL
|
||||||
@ -24,6 +24,9 @@ smeserver server enhancement to configure and run dnscache as a
|
|||||||
caching nameserver
|
caching nameserver
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Mar 01 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-6.sme
|
||||||
|
- move to full systemd units [SME: 12878]
|
||||||
|
|
||||||
* Thu Apr 04 2024 Brian Read <brianr@koozali.org> 11.0.0-5.sme
|
* Thu Apr 04 2024 Brian Read <brianr@koozali.org> 11.0.0-5.sme
|
||||||
- Update createlinks to create smeserver-package-update event[SME: 12579]
|
- Update createlinks to create smeserver-package-update event[SME: 12579]
|
||||||
|
|
||||||
@ -506,6 +509,19 @@ perl createlinks
|
|||||||
/sbin/e-smith/create-system-user dnslog 411 \
|
/sbin/e-smith/create-system-user dnslog 411 \
|
||||||
"DNS log user" /var/log /bin/false
|
"DNS log user" /var/log /bin/false
|
||||||
|
|
||||||
|
if [ $1 -gt 1 ] ; then
|
||||||
|
if [ -e /var/service/dnscache/run ] ; then
|
||||||
|
/usr/bin/sv d dnscache
|
||||||
|
/usr/bin/sv d dnscache/log
|
||||||
|
fi
|
||||||
|
if [ -e /var/service/dnscache.forwarder/run ] ; then
|
||||||
|
/usr/bin/sv d dnscache.forwarder
|
||||||
|
/usr/bin/sv d dnscache.forwarder/log
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
%post
|
%post
|
||||||
# Remove any left over env/FORWARDONLY file
|
# Remove any left over env/FORWARDONLY file
|
||||||
rm -f /var/service/dnscache/env/FORWARDONLY
|
rm -f /var/service/dnscache/env/FORWARDONLY
|
||||||
@ -515,14 +531,11 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
|
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
|
||||||
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
|
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
|
||||||
--dir /var/service/dnscache 'attr(0755,root,root)' \
|
--dir /var/service/dnscache 'attr(0755,root,root)' \
|
||||||
--dir /var/service/dnscache/log 'attr(0755,root,root)' \
|
|
||||||
--file /var/service/dnscache/run 'attr(0750,root,root)' \
|
|
||||||
--file /var/service/dnscache/dnscache-log.pl 'attr(0750,root,root)' \
|
--file /var/service/dnscache/dnscache-log.pl 'attr(0750,root,root)' \
|
||||||
--file /var/service/dnscache/log/run 'attr(0750,root,root)' \
|
|
||||||
--dir /var/log/dnscache 'attr(02755,dnslog,dnslog)' \
|
--dir /var/log/dnscache 'attr(02755,dnslog,dnslog)' \
|
||||||
--dir /var/log/dnscache.forwarder 'attr(02755,dnslog,dnslog)' \
|
--dir /var/log/dnscache.forwarder 'attr(02755,dnslog,dnslog)' \
|
||||||
--file /var/service/dnscache.forwarder/run 'attr(0750,root,root)' \
|
--file /sbin/e-smith/systemd/dnscache-pre 'attr(0750,root,root)' \
|
||||||
--file /var/service/dnscache.forwarder/log/run 'attr(0750,root,root)' \
|
--file /sbin/e-smith/systemd/dnscache.forwarder-pre 'attr(0750,root,root)' \
|
||||||
> %{name}-%{version}-%{release}-filelist
|
> %{name}-%{version}-%{release}-filelist
|
||||||
echo "%doc COPYING" >> %{name}-%{version}-%{release}-filelist
|
echo "%doc COPYING" >> %{name}-%{version}-%{release}-filelist
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user