Smarthost question

noPa$$word

Renowned Member
Feb 12, 2010
358
42
93
I have just installed ProxmoxMailGateway and am testing it. I became aware of the menu item "MailProxy/Relaying/Smarthost".

I can only enter an IP or a domain name here. What can I do if the Smarthost needs a login? Where do I enter these data?

Or did I misunderstand something?

K.W.
 
I can only enter an IP or a domain name here. What can I do if the Smarthost needs a login? Where do I enter these data?

That is currently not supported. Although I guess it can be implemented by editing the postfix configuration template.
 
something like this *should* work. as my smarthosts are in lan, not (yet) tested.


A) Install dependencies:

apt-get install libsasl2-modules

B) Postfix :

1. Create a password file in /etc/postfix/relay_password containing SMTP host, username and password (used for submission authentication) as shown:

smtp.relaydomain.ext USERNAME :pASSWORD


2. Secure the file against unwanted modifications and readings:

chmod 600 /etc/postfix/relay_password


3. Hash the file in order to create a passwords.db file

postmap /etc/postfix/relay_passwords

4. Configure Postfix, by editing /etc/postfix/main.cf
smtp_tls_security_level = encrypt
relayhost = [smtp.relaydomain.ext]:587
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_passwords
smtp_sasl_security_options =

(for googlemail: smtp_tls_security_level = encrypt)

5. Restart postfix

if it works for you

Edit /var/lib/pmg/templates/main.cf.in instead of /etc/postfix/main.cf so it survives config changes.
 
Last edited:
something like this *should* work. as my smarthosts are in lan, not (yet) tested.


A) Install dependencies:

apt-get install libsasl2-modules

B) Postfix :

1. Create a password file in /etc/postfix/relay_password containing SMTP host, username and password (used for submission authentication) as shown:

smtp.relaydomain.ext USERNAME :pASSWORD


2. Secure the file against unwanted modifications and readings:

chmod 600 /etc/postfix/relay_password


3. Hash the file in order to create a passwords.db file

postmap /etc/postfix/relay_passwords

4. Configure Postfix, by editing /etc/postfix/main.cf
smtp_tls_security_level = encrypt
relayhost = [smtp.relaydomain.ext]:587
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_passwords
smtp_sasl_security_options =

(for googlemail: smtp_tls_security_level = encrypt)

5. Restart postfix

if it works for you

Edit /var/lib/pmg/templates/main.cf.in instead of /etc/postfix/main.cf so it survives config changes.

Hi! I know this is a zombie thread but it's the best one I've found on this subject.

At present, I'm trying to set up external SMTP relay from PMG, with an internal postfix server being proxied by PMG.

I've configured it successfully on barebones postfix before, but am at a bit of a loss for how to digest the PMG template files.

Looking at /etc/pmg/templates, there are only some of these parameters present.

I see template tags surrounding blocks of template parameters, eg:

Bash:
[% IF pmg.mail.tls %]smtp_tls_security_level = may
smtp_tls_policy_maps = hash:/etc/pmg/tls_policy
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtpd_tls_security_level = may     
smtpd_tls_cert_file = /etc/pmg/pmg-tls.pem
smtpd_tls_key_file = $smtpd_tls_cert_file

lmtp_tls_security_level = $smtp_tls_security_level
lmtp_tls_policy_maps = $smtp_tls_policy_maps
lmtp_tls_CAfile = $smtp_tls_CAfile 
[% IF pmg.mail.tlslog %]
smtpd_tls_loglevel = 1
smtp_tls_loglevel = 1
lmtp_tls_loglevel = $smtp_tls_loglevel
[% END %]
[% IF pmg.mail.tlsheader %]
smtpd_tls_received_header = yes     
[% END %]
[% END %]

Is it safe to put postfix parameters wherever is desired in the file, assuming they're somewhere in the proxmox template wrappers?

Not really understanding how to edit this. The admin manual for PMG doesn't go very deep on it.

Thanks for any advice.
 
Is it safe to put postfix parameters wherever is desired in the file, assuming they're somewhere in the proxmox template wrappers?

Not really understanding how to edit this. The admin manual for PMG doesn't go very deep on it.

Thanks for any advice.

Ok. Adding here for anyone wondering in the future.

Figured it out. I just added my stuff at the end of the template file, and then ran the command to regenerate main.cf from the template.

Any duplicate parameters present in the Proxmox config above get overridden by your ones at the bottom.

All good!
 

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!