Fetchmail config not changed after IP change of Default Relay

laurensb

Member
Mar 9, 2020
15
2
8
After I changed the IP address of the Default Relay host (Configuration -> Mail Proxy -> Relaying -> Default Relay) I noticed fetchmail didn't work. It still had the old relay-host IP address in it's config, apparently it wasn't re-generated after changing the Default Relay. Changing a setting of a fetchmail entry back and forth (toggle Use SSL) did re-generate the config from the template with the new Default Relay IP address.

Shouldn't changing the Default Relay IP address under Configuration -> Mail Proxy -> Relaying -> Default Relay also trigger a re-generate of the fetchmail config?
 
Not sure I understand the problem completely - but AFAICT fetchmail is configured to fetch _from_ a particular server (which usually does not have anything to do with your default downstream server (default relay)), and then the mail gets send through the pmg filtering chain and is delivered as all other mail ...

Would you have some logs/config examples which show the problem (maybe I missed something)

Thanks!
 
After I changed the IP address of the internal mail server behind PMG, I updated the IP address of the Default Relay host (Configuration -> Mail Proxy -> Relaying -> Default Relay) in PMG accordingly. I tested sending a mail from outside and PMG correctly passed it through to the mail server.

I noticed however, that fetchmail didn't fetch mails. Restarted the service, but it hung on it's first job. After inspecting the config files in /etc/pmg I noticed that the config file "fetchmailrc" still contained a line with the old mail server IP address: "smtphost" on line 10:

Code:
# auto-generated using template fetchmailrc.tt

set daemon 300
set no bouncemail

defaults:
  antispam -1
  batchlimit 100

smtphost xxx.xxx.xxx.xxx/25

# proxmox settings (Do not delete this marker!!)

(...)

After changing back and forth a setting in a fetchmail entry (toggle SSL) PMG did update the "smtphost"-line in /etc/pmg/fetchmailrc to the new IP address of the downstream mail server and fetchmail correctly fetched mails again.

But shouldn't this line being updated by PMG directly when changing the IP address of the mail server (Configuration -> Mail Proxy -> Relaying -> Default Relay)?
It shouldn't be necessary to change a fetchmail setting back and forth to get the config updated to the new mail server IP, imho.
 
smtphost xxx.xxx.xxx.xxx/25
in the default template this gets rendered as PMG's address (not the default relay address) (also there's no '/' but a space between IP and port)?
 
Aaah, you're right, it is PMG's address indeed.

Sorry for the confusion.

Btw, there's definitively a slash, exactly like I posted above. I haven't customized it's template, so this is from the stock template in /var/lib/pmg:

Code:
smtphost [% ipconfig.int_ip %]/[% pmg.mail.ext_port %]

Hmmm, well, problem of not updating the fetchmail config still exists. I changed the subnet used in the LAN here, so PMG also got a new IP as well as the mail server.
I run PMG as a PVE-container, so I updated it's IP via PVE container network settings, and the new IP showed correctly in the PMG settings (Configuration -> Network/Time), so I assumed it has been rendered everywhere in PMG.
 
Btw, there's definitively a slash, exactly like I posted above. I haven't customized it's template, so this is from the stock template in /var/lib/pmg:
Sorry for the confusion from my side! - you're right (i misread the template)

I run PMG as a PVE-container, so I updated it's IP via PVE container network settings, and the new IP showed correctly in the PMG settings (Configuration -> Network/Time), so I assumed it has been rendered everywhere in PMG.
Hmm - does running `pmgconfig sync` after booting the container help?
 
Hmm - does running `pmgconfig sync` after booting the container help?
Nope. Changed IP via PVE, rebooted ct, ran `pmgconfig sync` and fetchmail config still has the old IP. Only "touching" a setting in a fetchmail entry (change, OK, change back, OK) seems to update the fetchmail config.

Btw, also tried changing IP via PMG interface, but that doesn't work. PVE apparently overrules IP changes made from within the container, guess that makes sense.

Edit: Could be a nice polishment to detect that PMG is running as a PVE container and then make a note about changing IP settings from PVE in the PMG interface under Configuration -> Network/Time.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!