diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore index e69de29..271eb25 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/dnsconfd-1.0.2.tar.gz diff --git a/ci.fmf b/ci.fmf new file mode 100644 index 0000000..c5aa0e0 --- /dev/null +++ b/ci.fmf @@ -0,0 +1 @@ +resultsdb-testcase: separate diff --git a/dnsconfd.spec b/dnsconfd.spec new file mode 100644 index 0000000..19d357f --- /dev/null +++ b/dnsconfd.spec @@ -0,0 +1,199 @@ +%global modulename dnsconfd +%global selinuxtype targeted + +Name: dnsconfd +Version: 1.0.2 +Release: 1%{?dist} +Summary: Local DNS cache configuration daemon +License: MIT +URL: https://github.com/InfrastructureServices/dnsconfd +Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +Source1: dnsconfd.sysusers + +BuildArch: noarch + +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-setuptools +BuildRequires: python3-rpm-macros +BuildRequires: python3-pip +BuildRequires: systemd +BuildRequires: systemd-rpm-macros +%{?sysusers_requires_compat} + +Requires: (%{name}-selinux if selinux-policy-%{selinuxtype}) +Requires: python3-gobject-base +Requires: python3-pyyaml +Requires: dbus-common +Requires: %{name}-cache +Suggests: %{name}-unbound + +%?python_enable_dependency_generator + +%description +Dnsconfd configures local DNS cache services. + +# SELinux subpackage +%package selinux +Summary: dnsconfd SELinux policy +BuildArch: noarch +Requires: %{name} = %{version}-%{release} +Requires: selinux-policy-%{selinuxtype} +Requires(post): selinux-policy-%{selinuxtype} +BuildRequires: selinux-policy-devel +%{?selinux_requires} + +%description selinux +Dnsconfd SELinux policy module. + +%package unbound +Summary: dnsconfd unbound module +BuildArch: noarch +Requires: %{name} = %{version}-%{release} +Requires: unbound +Provides: %{name}-cache = %{version}-%{release} + +%description unbound +Dnsconfd management of unbound server + +%prep +%autosetup -n %{name}-%{version} + +%build +%py3_build + +%if %{defined fedora} && 0%{?fedora} < 40 || %{defined rhel} && 0%{?rhel} < 10 + echo '/var/run/dnsconfd(/.*)? gen_context(system_u:object_r:dnsconfd_var_run_t,s0)' >> distribution/dnsconfd.fc +%endif + +make -f %{_datadir}/selinux/devel/Makefile %{modulename}.pp +bzip2 -9 %{modulename}.pp + +%install +%py3_install +mkdir -m 0755 -p %{buildroot}%{_datadir}/dbus-1/system.d/ +mkdir -m 0755 -p %{buildroot}%{_sysconfdir}/unbound/conf.d/ +mkdir -m 0755 -p %{buildroot}%{_unitdir} +mkdir -m 0755 -p %{buildroot}%{_unitdir}/unbound.service.d +mkdir -m 0755 -p %{buildroot}%{_unitdir}/unbound-anchor.service.d +mkdir -m 0755 -p %{buildroot}%{_sysconfdir}/sysconfig +mkdir -m 0755 -p %{buildroot}%{_sbindir} +mkdir -m 0755 -p %{buildroot}/%{_mandir}/man8 +mkdir -m 0755 -p %{buildroot}%{_datadir}/polkit-1/rules.d/ +mkdir -m 0755 -p %{buildroot}%{_rundir}/dnsconfd +mkdir -m 0755 -p %{buildroot}%{_tmpfilesdir} + +install -m 0644 -p distribution/com.redhat.dnsconfd.conf %{buildroot}%{_datadir}/dbus-1/system.d/com.redhat.dnsconfd.conf +install -m 0644 -p distribution/dnsconfd.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/dnsconfd +install -m 0644 -p distribution/dnsconfd.service %{buildroot}%{_unitdir}/dnsconfd.service +install -m 0644 -p distribution/dnsconfd.conf %{buildroot}%{_sysconfdir}/dnsconfd.conf +install -m 0644 -p distribution/dnsconfd.rules %{buildroot}%{_datadir}/polkit-1/rules.d/dnsconfd.rules +install -m 0644 -p distribution/dnsconfd-tmpfiles.conf %{buildroot}%{_tmpfilesdir}/%{name}.conf +install -m 0644 -p distribution/dnsconfd-unbound-tmpfiles.conf %{buildroot}%{_tmpfilesdir}/%{name}-unbound.conf + +touch %{buildroot}%{_rundir}/dnsconfd/unbound.conf +chmod 0644 %{buildroot}%{_rundir}/dnsconfd/unbound.conf + +# hook to inform us about unbound stop +install -m 0644 -p distribution/dnsconfd.service.d-unbound.conf %{buildroot}%{_unitdir}/unbound.service.d/dnsconfd.conf +install -m 0644 -p distribution/dnsconfd.service.d-unbound-anchor.conf %{buildroot}%{_unitdir}/unbound-anchor.service.d/dnsconfd.conf + +install -m 0644 -p distribution/unbound-dnsconfd.conf %{buildroot}%{_sysconfdir}/unbound/conf.d/unbound.conf + +mv %{buildroot}%{_bindir}/dnsconfd %{buildroot}%{_sbindir}/dnsconfd + +install -D -m 0644 %{modulename}.pp.bz2 %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2 + +install -m 0644 -p distribution/dnsconfd.8 %{buildroot}/%{_mandir}/man8/dnsconfd.8 +install -m 0644 -p distribution/dnsconfd-config.8 %{buildroot}/%{_mandir}/man8/dnsconfd-config.8 +install -m 0644 -p distribution/dnsconfd-reload.8 %{buildroot}/%{_mandir}/man8/dnsconfd-reload.8 +install -m 0644 -p distribution/dnsconfd-status.8 %{buildroot}/%{_mandir}/man8/dnsconfd-status.8 + +install -p -D -m 0644 distribution/dnsconfd.sysusers %{buildroot}%{_sysusersdir}/dnsconfd.conf + +%pre selinux +%selinux_relabel_pre -s %{selinuxtype} + +%post selinux +%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2 + +%postun selinux +if [ $1 -eq 0 ]; then + %selinux_modules_uninstall -s %{selinuxtype} -p 200 %{modulename} +fi + +%posttrans selinux +%selinux_relabel_post -s %{selinuxtype} + +%pre +%sysusers_create_compat %{SOURCE1} + +%pre unbound +%sysusers_create_compat %{SOURCE1} + +%post +%systemd_post %{name}.service + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service + +%files +%license LICENSE +%{_sbindir}/dnsconfd +%{python3_sitelib}/dnsconfd/ +%{python3_sitelib}/dnsconfd-%{version}* +%{_datadir}/dbus-1/system.d/com.redhat.dnsconfd.conf +%config(noreplace) %{_sysconfdir}/sysconfig/dnsconfd +%config(noreplace) %{_sysconfdir}/dnsconfd.conf +%{_unitdir}/dnsconfd.service +%{_mandir}/man8/dnsconfd*.8* +%ghost %{_sysusersdir}/dnsconfd.conf +%doc README.md +%{_datadir}/polkit-1/rules.d/dnsconfd.rules +%dir %attr(755,dnsconfd,dnsconfd) %{_rundir}/dnsconfd +%{_tmpfilesdir}/%{name}.conf + +%files selinux +%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.* +%ghost %verify(not md5 size mode mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename} + +%files unbound +%{_unitdir}/unbound.service.d/dnsconfd.conf +%{_unitdir}/unbound-anchor.service.d/dnsconfd.conf +%config(noreplace) %attr(644,unbound,unbound) %{_sysconfdir}/unbound/conf.d/unbound.conf +%attr(644,dnsconfd,dnsconfd) %{_rundir}/dnsconfd/unbound.conf +%{_tmpfilesdir}/dnsconfd-unbound.conf + +%changelog +* Thu Jun 27 2024 Tomas Korbar - 1.0.2-1 +- Release 1.0.2 + +* Wed Jun 26 2024 Tomas Korbar - 1.0.1-2 +- Fix /var/run selinux rules + +* Wed Jun 26 2024 Tomas Korbar - 1.0.1-1 +- Release 1.0.1 + +* Fri Jun 07 2024 Python Maint - 1.0.0-2 +- Rebuilt for Python 3.13 + +* Mon May 27 2024 Tomas Korbar - 1.0.0-1 +- Release 1.0.0 + +* Fri May 17 2024 Tomas Korbar - 0.0.6-1 +- Release 0.0.6 + +* Fri May 03 2024 Tomas Korbar - 0.0.5-1 +- Release 0.0.5 + +* Tue Apr 30 2024 Tomas Korbar - 0.0.4-2 +- Fix dnsconfd user installation + +* Mon Apr 29 2024 Tomas Korbar - 0.0.4-1 +- Release 0.0.4 + +* Sun Jan 28 2024 Tomas Korbar - 0.0.2-1 +- Initial version of the package diff --git a/dnsconfd.sysusers b/dnsconfd.sysusers new file mode 100644 index 0000000..c418aed --- /dev/null +++ b/dnsconfd.sysusers @@ -0,0 +1,2 @@ +#Type Name ID GECOS Home directory Shell +u dnsconfd - "Dnsconfd local DNS cache configurator" - /sbin/nologin diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..7e2c91b --- /dev/null +++ b/gating.yaml @@ -0,0 +1,9 @@ +--- !Policy +product_versions: + - rhel-* +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional} + - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tedude.validation} + - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.acceptance-tier.functional} + - !PassingTestCaseRule {test_case_name: osci.brew-build./plans/public.functional} diff --git a/plans/upstream.fmf b/plans/upstream.fmf new file mode 100644 index 0000000..9a5f8ea --- /dev/null +++ b/plans/upstream.fmf @@ -0,0 +1,8 @@ +summary: + Run distribution upstream tests +discover: + how: fmf + url: https://github.com/InfrastructureServices/dnsconfd.git + filter: tag:distribution +execute: + how: tmt diff --git a/sources b/sources new file mode 100644 index 0000000..15ab8c0 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (dnsconfd-1.0.2.tar.gz) = 085f95fbdef95bc9e1ca92e5d924480bce13d99e11ed49f914692d218c5b0dcf1d92ce400155e3cb3af2e898bd2a7fd643c40792a785841ad9b4c8af3723a86c