From 7e18382f9f452d92439a78b96f15606e555ae75c5b185f6faf14c440ca685897 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Mon, 12 Feb 2018 10:43:27 +0000 Subject: [PATCH] - Own the config zones directory OBS-URL: https://build.opensuse.org/package/show/server:dns/nsd?expand=0&rev=37 --- nsd.changes | 1 + nsd.spec | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/nsd.changes b/nsd.changes index 5adf361..f29ca65 100644 --- a/nsd.changes +++ b/nsd.changes @@ -4,6 +4,7 @@ Mon Feb 12 08:54:46 UTC 2018 - adam.majer@suse.de - Create a system user, not a regular user - Check if user/group already exists and are in system range - Do not ignore return values from user/group creation +- Own the config zones directory ------------------------------------------------------------------- Mon Feb 5 10:26:02 UTC 2018 - adam.majer@suse.de diff --git a/nsd.spec b/nsd.spec index fd34110..d6ca87d 100644 --- a/nsd.spec +++ b/nsd.spec @@ -103,6 +103,7 @@ install -d -m 0700 %{buildroot}%{home} \ # install -d -m 0755 %{buildroot}/%{_localstatedir}/log/nsd/ touch %{buildroot}%{home}/{nsd.db,ixfr.db,xfrd.state} %{buildroot}/%{_localstatedir}/log/nsd/nsd.log +mkdir -m 0750 %{buildroot}%{zonesdir} %if %{with systemd} install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/nsd.service @@ -117,10 +118,12 @@ ln -s -f %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name} # # adding user and group, if it doesn't exist yet # -if ! ${_bindir}/id _nsd > /dev/null 2> /dev/null; then +if ! %{_bindir}/id _nsd > /dev/null 2> /dev/null +then echo "Creating _nsd:_nsd" && \ %{_sbindir}/groupadd -r _nsd && \ - %{_sbindir}/useradd -r -g _nsd -s /bin/false -r -c "user for %{name}" -d %{home} _nsd + %{_sbindir}/useradd -r -g _nsd -s /bin/false -r -c "user for %{name}" -d %{home} _nsd || \ + exit $? fi %if %{with systemd} %service_add_pre %{name}.service @@ -196,6 +199,7 @@ fi # %config(noreplace) %attr(-,root,_nsd) %{configdir} %ghost %config %attr(640,_nsd,_nsd) %{configdir}/nsd.conf +%dir %attr(750,root,_nsd) %{zonesdir} # %dir %attr(750,_nsd,_nsd) %{home} %ghost %config %attr(640,_nsd,_nsd) %{home}/nsd.db