
Proxmox Mail Gateway is an open-source email security solution that acts as a layer between users and your origin mail server. It helps eliminate incoming or outgoing spam or email threats. In addition, it comes with a user-friendly web-based management interface that allows you to control everything easily.
This article explains the installation of Proxmox Mail Gateway, using Nginx as a reverse proxy to serve the management interface & securing the management interface with an SSL certificate on a Debian 11 machine.
To complete this guide, you will need to:
You are required to point a subdomain to your server using A record. The same subdomain will be used throughout the article. For example, mailgateway.domain.tld. Add hostname in /etc/hostname.
Overwrite the existing content with your subdomain and save the file using Ctrl + X then Enter. Add hostname in /etc/hosts.
Paste the following line below 127.0.0.1 localhost and save the file using Ctrl + X then Enter.
Reboot the server to ensure everything works.
After your server is up and running, run the following command and check if the output matches with your subdomain
Expected output
Add repository in /etc/apt/sources.list.
Add the following line and save the file using Ctrl + X then Enter.
Add GPG key to the APT sources keyring.
Refresh the package information.
Install the proxmox-mailgateway package.
Select "Internet with smarthost" in Postfix installation wizard & leave the rest set as default.
Reboot the server to ensure everything works
After your server is up and running, you can verify if the installation was done successfully by opening the following link in your web browser
You can log into the management interface using the same credentials you use for SSH
Some environments do not allow connections to non-standard ports and it is not recommended to change PMG's port configuration. Using Nginx is the best solution for port standardization and handling high traffic.
Install Nginx
Add a vhost file to the sites-available directory.
Paste the following content (replace your_subdomain with your actual subdomain) and save the file using Ctrl + X then Enter
Add a soft link of the vhost file in sites-enabled directory
Test the configuration.
Expected output:
Reload Nginx.
Verify the Accessibility. You can verify if the reverse proxy is working properly or not by opening the following link in your web browser.
Restrict Direct Access. After you've verified that your reverse proxy works, you can change the listener IP of the management interface to restrict direct access. Add a listener IP in /etc/default/pmgproxy.
Paste the following line and save the file using Ctrl + X then Enter
Restart the pmgproxy service
We will use Let's Encrypt to obtain an SSL Certificate for free. Please make sure you have pointed your subdomain to the server's IP address. The steps given below will only work if you are serving the management interface using Nginx.
Install Certbot.
Install Certificate on Nginx. You will be asked to enter your email address when you run the following command, please enter your email address and leave the rest set as default.
Verify the accessibility. You can verify if the SSL Certificate is configured properly or not by opening the following link in your web browser.
Test auto-renewal. Let's Encrypt certificates are only valid for 90 days, but since we are using certbot, it will handle auto-renewals for us. You can verify if the auto-renewal works by running the following command.
If the above command doesn't throw an error, it means your SSL certificate will be renewed automatically without any issues.
In this article, you installed Proxmox Mail Gateway, used Nginx as a reverse proxy for PMG's management interface & installed an SSL Certificate using certbot. If you're new to Proxmox Mail Gateway and don't know how it works, their official documentation is a good place to start.
0 Comments
Be the first to comment and share your perspective with the community.