Este conteúdo não está disponível no idioma selecionado.
Chapter 5. Securing system DNS traffic with encrypted DNS
You can enable encrypted DNS to secure DNS communication that uses DNS-over-TLS (DoT) protocol. Encrypted DNS (eDNS) encrypts all DNS traffic end-to-end, with no fallback to insecure protocols, and aligns with the principles of zero trust architecture (ZTA).
			The current implementation of eDNS in RHEL uses only the DoT protocol. There are two primary methods to install RHEL with eDNS enabled. You can perform an interactive installation from local media, or you can build a custom bootable ISO to ensure eDNS is configured with an enforce policy during and after installation. Alternatively, you can convert an existing RHEL installation to use eDNS.
		
Encrypted DNS is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
5.1. Overview of components for eDNS in RHEL
The following components comprise the eDNS setup in RHEL and interact in a layered fashion:
- NetworkManager
- 
							NetworkManager enables eDNS and enforces the use of encrypted DNS protocols based on the configured policy. It is set to use dnsconfdas its backend DNS resolver.
- dnsconfd
- 
							dnsconfdis a local DNS cache configuration daemon. It simplifies the setup of DNS caching, split DNS, and DNS over TLS (DoT).
- unbound
- 
							unboundis a validating, recursive, and caching DNS resolver. In the eDNS setup, it serves as the runtime cache service fordnsconfd.unbounduses TLS for upstream DNS queries, which is essential for encrypting DNS traffic to external DoT servers.unboundalso manages various caches to store DNS responses, which reduces the need for repeated external queries and improves performance.
5.1.1. eDNS resolution process and core interactions
- An application requests to resolve a hostname.
- 
							The system reads the /etc/resolv.conffile and sends the query to the localunboundservice.
- 
							unboundfirst checks its internal caches for a valid, cached response.
- 
							If the request record is not found, unboundencrypts the DNS query by using TLS and sends it to the configured upstream DoT enabled DNS server.
- 
							The upstream DoT server processes the query and sends an encrypted DNS response back to unbound.
- 
							unbounddecrypts, validates, and caches the response.
- 
							Finally, unboundsends the resolved DNS response back to the application.
5.2. Installing RHEL with eDNS enabled from a local installation media
				Install a RHEL system with an eDNS enforce policy that ensures that all DNS queries are private and secure during and after installation. If you require a custom CA certificate bundle, you must install it by using the %certificate section in the Kickstart file.
			
During the installation, you must provide both the RHEL installation content and the Kickstart file from local media. You cannot download the Kickstart file from a remote HTTP server because the installer would need to use DNS to resolve the server’s hostname. If your environment allows a fallback to unencrypted DNS, you can perform a standard RHEL installation and configure eDNS afterwards.
Prerequisites
- 
						Commands that start with the #command prompt require administrative privileges provided bysudoor root user access. For information on how to configuresudoaccess, see Enabling unprivileged users to run certain commands.
- You have the RHEL installation media available locally.
- 
						If you require a custom CA bundle, have your Kickstart file with a %certificatesection available locally.
Procedure
- Optional: Create a Kickstart file with a - %certificatesection. Ensure the certificate is saved in a file named- tls-ca-bundle.pem.- %certificate --dir /etc/pki/dns/extracted/pem/ --filename tls-ca-bundle.pem -----BEGIN CERTIFICATE----- <Base64-encoded_certificate_content> -----END CERTIFICATE----- %end - %certificate --dir /etc/pki/dns/extracted/pem/ --filename tls-ca-bundle.pem -----BEGIN CERTIFICATE----- <Base64-encoded_certificate_content> -----END CERTIFICATE----- %end- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Prepare your bootable installation media, and include the Kickstart file if you need a custom CA bundle.
- Boot the installation media.
- 
						From the boot menu window, select the required option and press the ekey to edit the boot parameters.
- Add the eDNS kernel arguments: - linux ($root)/vmlinuz-6.12.0-0.el10_0.x86_64 root=/dev/mapper/rhel-root ro crashkernel=2G-64G:256M,64G-:512M resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet emergency ip=dhcp rd.net.dns=dns+tls://<server_ip>#<dns_server_hostname> rd.net.dns-resolve-mode=exclusive rd.net.dns-backend=dnsconfd inst.ks=hd:/dev/sdb1/mykickstart.ks - linux ($root)/vmlinuz-6.12.0-0.el10_0.x86_64 root=/dev/mapper/rhel-root ro crashkernel=2G-64G:256M,64G-:512M resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet emergency ip=dhcp rd.net.dns=dns+tls://<server_ip>#<dns_server_hostname> rd.net.dns-resolve-mode=exclusive rd.net.dns-backend=dnsconfd inst.ks=hd:/dev/sdb1/mykickstart.ks- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- 
						When you finish editing, press Ctrl+Xto start the installation using the specified options.
Verification
- Verify your eDNS configuration: - dnsconfd status - $ dnsconfd status- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Expected output: - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Verify that DNS server is responsive by using - nslookup:- nslookup <domain_name> - $ nslookup <domain_name>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Replace the - <domain_name>with the domain that you want to query.
Troubleshooting
- Enable detailed logging in - unbound:- unbound-control verbosity 5 - # unbound-control verbosity 5- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Review logs for the relevant service: - journalctl -xe -u <service_name> - $ journalctl -xe -u <service_name>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Replace - <service_name>with- NetworkManager,- dnsconfd, or- unbound.
5.3. Installing RHEL with eDNS enabled using a custom bootable ISO
				Create a custom bootable ISO to install RHEL with an eDNS enforce policy that ensures that all DNS queries are private and secure during and after installation. If you require a custom CA certificate bundle, you must install it by using the %certificate section in the Kickstart file. You then reference this Kickstart file in a script to build a new ISO, which includes kernel arguments to enforce a strict DoT policy. If your environment allows a fallback to unencrypted DNS, you can perform a standard RHEL installation and configure eDNS afterwards.
			
Prerequisites
- 
						Commands that start with the #command prompt require administrative privileges provided bysudoor root user access. For information on how to configuresudoaccess, see Enabling unprivileged users to run certain commands.
- You have downloaded the minimal installation Boot ISO image from the Product Downloads page.
- 
						You have a Kickstart file ready with a %certificatesection if you need a custom CA bundle.
- 
						The loraxpackage is installed.
Procedure
- Optional: Create a Kickstart file with a - %certificatesection. Ensure the certificate is saved in a file named- tls-ca-bundle.pem.- %certificate --dir /etc/pki/dns/extracted/pem/ --filename tls-ca-bundle.pem -----BEGIN CERTIFICATE----- <Base64-encoded_certificate_content> -----END CERTIFICATE----- %end - %certificate --dir /etc/pki/dns/extracted/pem/ --filename tls-ca-bundle.pem -----BEGIN CERTIFICATE----- <Base64-encoded_certificate_content> -----END CERTIFICATE----- %end- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Add the Kickstart file and kernel arguments into the ISO: - The following script example demonstrates how to create a custom bootable ISO with eDNS enabled. You must create a script file to automate this process. - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Run the script. - sh <script_filename> - sh <script_filename>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Install RHEL using the customized ISO file.
Verification
- Verify your eDNS configuration: - dnsconfd status - $ dnsconfd status- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Expected output: - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Verify that DNS server is responsive by using - nslookup:- nslookup <domain_name> - $ nslookup <domain_name>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Replace the - <domain_name>with the domain that you want to query.
Troubleshooting
- Enable detailed logging in - unbound:- unbound-control verbosity 5 - # unbound-control verbosity 5- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Review logs for the relevant service: - journalctl -xe -u <service_name> - $ journalctl -xe -u <service_name>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Replace - <service_name>with- NetworkManager,- dnsconfd, or- unbound.
5.4. Enabling eDNS on an existing RHEL installation
You can enable encrypted DNS (eDNS) on an existing RHEL installation to handle all DNS traffic by using DNS-over-TLS.
Prerequisites
- 
						Commands that start with the #command prompt require administrative privileges provided bysudoor root user access. For information on how to configuresudoaccess, see Enabling unprivileged users to run certain commands.
- Have an existing RHEL installation.
- The following packages are installed on your system: - 
								dnsconfd
- 
								dnsconfd-dracut
- 
								grubby
 
- 
								
- 
						If on an IBM Z system, the ziplutility is installed.
Procedure
- Configure NetworkManager in the - /etc/NetworkManager/conf.d/global-dot.conffile:- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - For more details on global DNS options, see the - GLOBAL-DNS SECTIONin- NetworkManager.conf(5)man page on your system.
- Optional: To use a custom CA bundle for validating upstream DoT servers, copy the PEM-formatted file to the - /etc/pki/dns/extracted/pem/tls-ca-bundle.pemfile.Note- After adding or removing certificates in - /etc/pki/dns/extracted/pem, restart the- dnsconfdservice to apply the changes.
- Enable the - dnsconfdservice:- systemctl enable --now dnsconfd - # systemctl enable --now dnsconfd- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Reload NetworkManager: - systemctl reload NetworkManager - # systemctl reload NetworkManager- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Regenerate - initramfsfor all installed kernels to include- dnsconfdand its configuration:- for kernel in `rpm -q kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n'`; do dracut -f --kver="$kernel" done- # for kernel in `rpm -q kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n'`; do dracut -f --kver="$kernel" done- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Set kernel arguments to the current and newly installed kernel version: - grubby --args="rd.net.dns=dns+tls://<server_ip>#<dns_server_hostname> rd.net.dns-resolve-mode=exclusive rd.net.dns-backend=dnsconfd" --update-kernel=ALL - # grubby --args="rd.net.dns=dns+tls://<server_ip>#<dns_server_hostname> rd.net.dns-resolve-mode=exclusive rd.net.dns-backend=dnsconfd" --update-kernel=ALL- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - If on IBM Z, update the boot menu: - zipl - # zipl- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
 
Verification
- Verify your eDNS configuration: - dnsconfd status - $ dnsconfd status- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Expected output: - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Verify that the DNS server is responsive by using - nslookup:- nslookup <domain_name> - $ nslookup <domain_name>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Replace the - <domain_name>with the domain that you want to query.
Troubleshooting
- Enable detailed logging in - unbound:- unbound-control verbosity 5 - # unbound-control verbosity 5- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Review logs for the relevant service: - journalctl -xe -u <service_name> - $ journalctl -xe -u <service_name>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Replace - <service_name>with- NetworkManager,- dnsconfd, or- unbound.
5.5. Kernel parameters for DNS configuration
You can use kernel arguments to enable DNS over TLS (DoT) at boot time and set DNS resolution behavior for your system.
rd.net.dns-resolve-mode
					Defines how DNS servers from global configuration are used during resolution. The following modes are relevant for both kernel arguments and NetworkManager.conf global configuration:
				
- exclusive
- 
							Uses only the DNS servers specified by kernel arguments or in NetworkManager.conf. Forbids fallback to DNS servers retrieved from connections. This mode is currently relevant only fordnsconfdplugin.
- prefer
- Forbids using DNS servers from connections for general queries unless the queries are subdomains of domains set by connection.
- backup
- Merges and uses DNS servers from both the global configuration and network connections for the same purposes.
rd.net.dns-servers
					Configure the list of DNS servers to use. To define multiple DNS servers, set rd.net.dns multiple times:
				
rd.net.dns=dns+tls://<server_ip_1>#<dns_server_hostname_1> rd.net.dns=dns+tls://<server_ip_2>#<dns_server_hostname_2>
rd.net.dns=dns+tls://<server_ip_1>#<dns_server_hostname_1> rd.net.dns=dns+tls://<server_ip_2>#<dns_server_hostname_2>For example:
rd.net.dns=dns+tls://198.51.100.143#dot.dns.example.com rd.net.dns=dns+tls://203.0.113.1#dot.dns.example.net
rd.net.dns=dns+tls://198.51.100.143#dot.dns.example.com rd.net.dns=dns+tls://203.0.113.1#dot.dns.example.netrd.net.dns-backend
					Specifies the backend DNS resolver. When set to dnsconfd, the system uses dnsconfd as a local DNS cache configuration daemon.