diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ad1f69d --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2023 Red Hat, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/TODO b/TODO index 9828942..81dac3f 100644 --- a/TODO +++ b/TODO @@ -4,3 +4,4 @@ using root, because without it we can not access resolv.conf or any other stub resolv.conf location - Improve logging. Improve logging prefixes. +- Add option for altering behaviour while handling wireless interfaces. diff --git a/bin/dnsconfd b/bin/dnsconfd index 1cc7342..f320014 100755 --- a/bin/dnsconfd +++ b/bin/dnsconfd @@ -25,6 +25,7 @@ if __name__ == "__main__": print(dnsconfd_object.Status(dbus_interface='org.freedesktop.resolve1.Dnsconfd')) except DBusException as e: print("Was not able to call Status method, check your DBus policy") + exit(1) exit(0) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) diff --git a/distribution/dnsconfd.8 b/distribution/dnsconfd.8 new file mode 100644 index 0000000..aed7045 --- /dev/null +++ b/distribution/dnsconfd.8 @@ -0,0 +1,56 @@ +.TH "dnsconfd" "8" "10 Oct 2023" "dnsconfd-0.0.1" "" + +.SH NAME + +Dnsconfd - local DNS cache configuration daemon + +.SH SYNOPSIS + +dnsconfd [-h] [-s] [--dbus-name DBUS_NAME] [--log-level {DEBUG,INFO,WARN}] [--resolv-conf-path RESOLV_CONF_PATH] + +.SH DESCRIPTION + +Dnsconfd is a local cache configuration daemon. It implements DBus interface of systemd-resolved +and translates it's use to dns service's configuration. + +.SH OPTIONS + +.IP "-h, --help" +Show help message and exit +.IP "-s, --status" +Print status of already running instance if any +.IP "--dbus-name DBUS_NAME" +DBus name that dnsconfd should use +.IP "--log-level {DEBUG,INFO,WARN}" +Log level of dnsconfd +.IP "--resolv-conf-path RESOLV_CONF_PATH" +Path to resolv.conf that the dnsconfd should manage + +.SH "EXIT STATUS" +.IP 0 +No error has occured. When status was requested, dnsconfd has been able to retrieve it successfully. +.IP 1 +Error has occured or dnsconfd was not able to retrieve status successfully. + +.SH ENVIRONMENT +Environment variables are overriden if their argument counterparts are used. + +.IP DBUS_NAME +DBus name that dnsconfd should use +.IP RESOLV_CONF_PATH +Path to resolv.conf that the dnsconfd should manage +.IP LOG_LEVEL +Log level of dnsconfd + +.SH FILES +Dnsconfd manages resolv.conf to route domain name resolution to local cache service. + +.SH NOTES +The only currently supported backend is Unbound. + +.SH "REPORTING BUGS" +Please for reporting bugs use Github repository https://github.com/InfrastructureServices/dnsconfd + +.SH COPYRIGHT + +Copyright (c) 2023 Red Hat, Inc. \ No newline at end of file diff --git a/distribution/dnsconfd.spec b/distribution/dnsconfd.spec index a725f7f..47ce1d0 100644 --- a/distribution/dnsconfd.spec +++ b/distribution/dnsconfd.spec @@ -14,6 +14,8 @@ Source2: dnsconfd.service #Source3: dnsconfd.sysusers Source4: dnsconfd.fc Source5: dnsconfd.te +Source6: LICENSE +Source7: dnsconfd.8 BuildArch: noarch @@ -69,6 +71,7 @@ mkdir -m 0755 -p %{buildroot}%{_unitdir} mkdir -m 0755 -p %{buildroot}%{_sysconfdir}/sysconfig mkdir -m 0755 -p %{buildroot}%{_sbindir} mkdir -m 0755 -p %{buildroot}/var/log/dnsconfd +mkdir -m 0755 -p %{buildroot}/%{_mandir}/man8 install -m 0644 -p %{SOURCE1} %{buildroot}%{_sysconfdir}/dbus-1/system.d/com.redhat.dnsconfd.conf install -m 0644 -p %{SOURCE2} %{buildroot}%{_unitdir}/dnsconfd.service @@ -80,6 +83,8 @@ 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 %{SOURCE7} %{buildroot}/%{_mandir}/man8/dnsconfd.8 + #install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/dnsconfd.conf %pre selinux @@ -116,6 +121,7 @@ systemctl enable dnsconfd.service &>/dev/null %systemd_postun dnsconfd.service %files +%license LICENSE %{_sbindir}/dnsconfd %{python3_sitelib}/dnsconfd/ %{python3_sitelib}/dnsconfd-%{version}* @@ -123,6 +129,7 @@ systemctl enable dnsconfd.service &>/dev/null %config(noreplace) %{_sysconfdir}/sysconfig/dnsconfd %{_unitdir}/dnsconfd.service %attr(0755,root,root) /var/log/dnsconfd +%{_mandir}/man8/dnsconfd.8* #%{_sysusersdir}/dnsconfd.conf %files selinux diff --git a/tests/build_package.sh b/tests/build_package.sh index 3d850e6..5f5999c 100755 --- a/tests/build_package.sh +++ b/tests/build_package.sh @@ -3,6 +3,7 @@ set -e python3 setup.py sdist -d ./distribution +cp ./LICENSE distribution/LICENSE pushd distribution fedpkg local mv ./noarch/*.noarch.rpm ../tests