-
Notifications
You must be signed in to change notification settings - Fork 5
/
systemd-resolved-docker.spec
120 lines (96 loc) · 4.1 KB
/
systemd-resolved-docker.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
%global srcname systemd-resolved-docker
%global eggname systemd_resolved_docker
Name: %{srcname}
Version: 1.0.0
Release: 1%{?dist}
Summary: systemd-resolved and docker DNS integration
License: MIT
URL: https://github.com/flaktack/systemd-resolved-docker
# Sources can be obtained by
# git clone https://github.com/flaktack/systemd-resolved-docker
# cd systemd-resolved-docker
# tito build --tgz
Source0: %{srcname}-%{version}.tar.gz
Source1: %{srcname}.service
Source2: %{srcname}.sysconfig
BuildArch: noarch
%if 0%{?el6}
BuildRequires: python34-devel
BuildRequires: python34-setuptools
%else
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif
BuildRequires: systemd-rpm-macros
%description
Provides systemd-resolved and docker DNS integration.
A DNS server is configured to listen on each docker interface's IP address. This is used to:
1. expose the systemd-resolved DNS service (127.0.0.53) to docker containers by proxying DNS requests, since the systems
loopback IPs can't be accessed from containers.
2. adds the created DNS servers to the docker interface using systemd-resolved so that docker containers may be
referenced by hostname. This uses --hostname and --domainname, --network or a default of .docker to create the domains.
#-- PREP, BUILD & INSTALL -----------------------------------------------------#
%prep
%autosetup -n %{srcname}-%{version}
%build
%py3_build
%install
%py3_install
# SystemdD services
install -dp %{buildroot}%{_unitdir}
install -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}
# Sysconfig
install -dp %{buildroot}%{_sysconfdir}/sysconfig
install -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{srcname}
# %%check
# %%{python3} setup.py test
%post
%systemd_post %{srcname}.service
%preun
%systemd_preun %{srcname}.service
%postun
%systemd_postun_with_restart %{srcname}.service
#-- FILES ---------------------------------------------------------------------#
%files
%doc README.md
%{python3_sitelib}/%{eggname}-*.egg-info/
%{python3_sitelib}/%{eggname}/
%{_bindir}/%{srcname}
%{_unitdir}/%{srcname}.service
%config(noreplace) %{_sysconfdir}/sysconfig/%{srcname}
#-- CHANGELOG -----------------------------------------------------------------#
%changelog
* Mon Jul 04 2022 Zsombor Welker <[email protected]> 1.0.0-1
- Support for docker compose projects
- Use a dummy interface (`srd-dummy`) for integrating with systemd-resolved so that DNS resolving works if the `docker0` interfaces is `DOWN`
- Add handling for the host network using `DEFAULT_HOST_IP`
- Allow specifying both the listen IPs and ports explicitly
- Use `SetLinkDNSEx()` where possible so that ports other then 53 may be used
- Add support for wildcard `--hostname` values
- Don't allow top-level only domains in `ALLOWED_DOMAINS`
- Automatically `DEFAULT_DOMAIN` to `ALLOWED_DOMAINS` if it is not present
- Add integration tests and GitHub Actions
* Sun Jun 26 2022 Zsombor Welker <[email protected]> 0.5.0-1
- Generate names for docker-compose projects
- Don't allow top-level only domains in ALLOWED_DOMAINS
- Add the DEFAULT_DOMAIN to ALLOWED_DOMAINS if it is not contained
- Add explicit handling for the host network using DEFAULT_HOST_IP
- Create a dummy interface to intergate with systemd-resolved
- Allow specifying both the listen IPs and ports
- Use SetLinkDNSEx so that the ip:port may be specified
- Add support for wildcard domains
- Add integration tests and Github Actions
* Sun Apr 25 2021 Zsombor Welker <[email protected]> 0.4.0-1
- Document unmanaging the docker0 interface
- Explicitly disable DNSSEC in systemd-resolved
- Use an explicit prefix check for container ids
* Sun Mar 21 2021 Zsombor Welker 0.3.0-1
- Only return NXDOMAIN of no records exist for a domain
* Sun Mar 21 2021 Zsombor Welker 0.2.1-1
- Restart the service whenever docker/systemd-resolved is restarted
* Sun Mar 21 2021 Zsombor Welker 0.2.0-1
- Clarify domain name generating logic
* Fri Mar 19 2021 Zsombor Welker <[email protected]> 0.1.1-1
- Cleanup README and spec
* Fri Mar 19 2021 Zsombor Welker <[email protected]> 0.1.0-1
- Initial Version