ლ(ಠ益ಠლ)

Exim: Disable Listening on IPv6 Address (Debian)

Observed that Exim4 was listening on the IPv6 address. If you’re not accepting incoming IPv6 traffic, there’s little sense in having support enabled.

Per the Exim man page:

1
2
3
4
5
6
$ man update-exim4.conf

# dc_local_interfaces
#      List of IP addresses the Exim daemon should listen on. If this is left empty,
#      Exim listens on all interfaces. Sets macro MAIN_LOCAL_INTERFACES only if
#      there is a non-empty value.
1
2
$ grep dc_local_interfaces /etc/exim4/update-exim4.conf.conf
dc_local_interfaces='127.0.0.1 ; ::1'

What’s the ::1? Per the IPv6 Wikipedia article regarding Address representation:

The 128 bits of an IPv6 address are represented in 8 groups of 16 bits each. Each group is written as 4 hexadecimal digits and the groups are separated by colons (:). The loopback address, 0000:0000:0000:0000:0000:0000:0000:0001, may be abbreviated to ::1.

Therefore, remove the semicolon and the ::1 from the “dc_local_interfaces” declaration from the file /etc/exim4/update-exim4.conf.conf, to effectively disable IPv6.

The following is a differential comparison (‘diff’) to clarify the required change:

1
2
3
4
5
6
# diff -U0 /etc/exim4/update-exim4.conf.conf.backup /etc/exim4/update-exim4.conf.conf
--- /etc/exim4/update-exim4.conf.conf.backup
+++ /etc/exim4/update-exim4.conf.conf
@@ -21 +21 @@
-dc_local_interfaces='127.0.0.1 ; ::1'
+dc_local_interfaces='127.0.0.1'

Restart Exim:

1
$ service exim4 restart

Confirm only 127.0.0.1 (IPv4) is listening, by dumping socket information:

1
2
# ss -ntlp | grep ":25"
LISTEN     0      20                127.0.0.1:25                       *:*      users:(("exim4",4998,3))

Comments