Hi,
I have a docker host that runs nagios and postfix containers. The nagios server uses nginx for reverse proxy. Nagios is unable to use my postfix server to send email. Using docker compose up
and watching the console, I see this when nagios attempts to send email:
nagios_1 | nagios: HOST NOTIFICATION: mtaylor;host09.lygos.com;CUSTOM (DOWN);notify-host-by-email;CRITICAL - Host Unreachable (10.50.135.42);Nagios Admin;testing testing....
nagios_1 | postfix/pickup[46]: 20D601BA01C2: uid=999 from=<nagios>
nagios_1 | postfix/cleanup[776]: 20D601BA01C2: message-id=<20220613190801.20D601BA01C2@8ca7e2108df8>
nagios_1 | postfix/qmgr[47]: 20D601BA01C2: from=<nagios@8ca7e2108df8>, size=630, nrcpt=1 (queue active)
nagios_1 | postfix/pickup[46]: 21E271BA01C4: uid=999 from=<nagios>
nagios_1 | postfix/cleanup[776]: 21E271BA01C4: message-id=<20220613190801.21E271BA01C4@8ca7e2108df8>
nagios_1 | postfix/qmgr[47]: 21E271BA01C4: from=<nagios@8ca7e2108df8>, size=630, nrcpt=1 (queue active)
nagios_1 | postfix/smtpd[781]: connect from unknown[127.0.0.1]
nagios_1 | postfix/smtp[778]: warning: host postfix.lygos.com[127.0.1.1]:25 greeted me with my own hostname 8ca7e2108df8
nagios_1 | postfix/smtp[778]: warning: host postfix.lygos.com[127.0.1.1]:25 replied to HELO/EHLO with my own hostname 8ca7e2108df8
nagios_1 | postfix/smtp[778]: 20D601BA01C2: to=<mtaylor@lygos.com>, relay=postfix.lygos.com[127.0.1.1]:25, delay=0.04, delays=0.01/0.01/0.01/0, dsn=5.4.6, status=bounced (mail for postfix.lygos.com loops back to myself)
nagios_1 | postfix/smtpd[781]: disconnect from unknown[127.0.0.1] ehlo=1 quit=1 commands=2
I interpret this as meaning that the nagios container is connecting to itself on port 25, seeing that it is doing so and therefore correctly disconnecting.
These are my docker networks:
mtaylor@docker03:/opt/docker/nagios$ sudo docker network ls
NETWORK ID NAME DRIVER SCOPE
0ace896850d1 bridge bridge local
2c63645c4944 host host local
7fa26410c5a2 nagios_default bridge local
a10acdff3b6e none null local
df73a4bd5211 postfix_default bridge local
Inspecting the nagios and postfix networks shows:
mtaylor@docker03:/opt/docker/nagios$ sudo docker network inspect nagios_default
[
{
"Name": "nagios_default",
"Id": "7fa26410c5a2265a78e27fee0d7faab782ef0d91b915d0049996f6789be4048e",
"Created": "2022-05-13T17:54:36.853506681-07:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"8ca7e2108df8f6d3cc59211067216394d4f29af712666e910d65812a98040884": {
"Name": "nagios_nagios_1",
"EndpointID": "109e67871cf0251a7aed0f04681700d14d84c9d4c4cc9d431d2094d87b95711a",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""
},
"efaaa10e14acf14d4f00b73891802a5837c3a68bf70cdb5878da060d09344cca": {
"Name": "nginx-reverse-proxy_proxy_1",
"EndpointID": "f46a8c4dbbe5a08d3bce07ca63ba935c09a42d35c65b351b81dd1ce1d68275fa",
"MacAddress": "02:42:ac:12:00:03",
"IPv4Address": "172.18.0.3/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "nagios",
"com.docker.compose.version": "2.5.0"
}
}
]
mtaylor@docker03:/opt/docker/nagios$ sudo docker network inspect postfix_default
[
{
"Name": "postfix_default",
"Id": "df73a4bd52112702c62b14850ce32d40190f4c5cc3cb825ff9b61e6fa399e0e3",
"Created": "2022-05-27T11:46:38.582114868-07:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "192.168.32.0/20",
"Gateway": "192.168.32.1"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"e09b06d82aff94f01ddb2c018d52804097bb29fff7237c0df307cd3196b96504": {
"Name": "postfix_postfix_1",
"EndpointID": "22bce93b746a25662ac95f7f0992e0ea16feabc470bec1fafc6fb2a63565344a",
"MacAddress": "02:42:c0:a8:20:02",
"IPv4Address": "192.168.32.2/20",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "postfix",
"com.docker.compose.version": "1.25.0"
}
}
]
I am using two separate docker compose YAML files for creating my nagios and postfix containers. How can I get my nagios container to not loop back on itself for mail service, but instead reach my postfix container?
Thanks,
Marshall