postal icon indicating copy to clipboard operation
postal copied to clipboard

IP pool not being used

Open PCL-CrisKolkman opened this issue 2 years ago • 4 comments

Hello,

I've setup a new Postal server running Postal v2.1.1. The server has 3 interfaces, 1 is the main interface and the other 2 are for the IP pool. All the interfaces have internet connection with different external IPs (this has been tested and confirmed working).

I have added an IP pool and assigned it to an organization, but the main interface is always being used to send out the messages. I have the exact same setup on a Postal v1 server but on that server it's working like it should.

What could be wrong?

PCL-CrisKolkman avatar Apr 08 '22 12:04 PCL-CrisKolkman

Are you using host networking on your container? In order for Postal to be able to "see" all of your external interfaces, you'll need to pass them through to the container using host networking.

jduncanator avatar Apr 14 '22 05:04 jduncanator

Hi @jduncanator , May I ask your expert advise on how to enable host networking for Postal. Appreciate it. Thanks.

jazer143 avatar May 18 '22 08:05 jazer143

The default docker-compose file should have host network set already, I don't know why IP Pools would behave differently though.

https://github.com/postalserver/install/blob/ce3ddfa66e18a7509ebec9c7aebf84fcd70675df/templates/docker-compose.yml#L6

willpower232 avatar May 18 '22 12:05 willpower232

It works for me. I created 8 virtual IPs which is with local IPs address and NATed to our FW. Priority values works accurately and also using the rules is superb.

jazer143 avatar May 29 '22 06:05 jazer143

The default docker-compose file should have host network set already, I don't know why IP Pools would behave differently though.

https://github.com/postalserver/install/blob/ce3ddfa66e18a7509ebec9c7aebf84fcd70675df/templates/docker-compose.yml#L6

While not understanding why postal is not using the IP pools, the issue is still present.

What can I do to check/fix this?

PCL-CrisKolkman avatar Oct 29 '22 08:10 PCL-CrisKolkman

The only thing I can suggest is double checking the output of ip a and making sure those IP addresses have been entered into the configuration.

If you need to go deeper, you could postal bash smtp to verify that your updated config file is definitely present.

willpower232 avatar Oct 31 '22 10:10 willpower232

The only thing I can suggest is double checking the output of ip a and making sure those IP addresses have been entered into the configuration.

If you need to go deeper, you could postal bash smtp to verify that your updated config file is definitely present.

Hello @willpower232,

The IP addresses for the pool are showing up in ip a and the command postal bash smtp just shows me the postal menu:

postal@SERVERNAME:~/app$ postal bash smtp
Usage: postal [command]

Server components:

 * web-server - run the web server
 * smtp-server - run the SMTP server
 * worker - run a worker
 * cron - run the cron process
 * requeuer - run the message requeuer

Setup/upgrade tools:

 * initialize - create and load the DB schema
 * upgrade - upgrade the DB schema

Other tools:

 * version - show the current Postal version
 * make-user - create a new global admin user
 * default-dkim-record - display the default DKIM record
 * console - open an interactive console
 * test-app-smtp - send a test message through Postal

PCL-CrisKolkman avatar Dec 12 '22 09:12 PCL-CrisKolkman

it looks like postal on your $PATH is still v1 so maybe that is related to what is going wrong if you have both hanging around?

willpower232 avatar Dec 12 '22 10:12 willpower232

it looks like postal on your $PATH is still v1 so maybe that is related to what is going wrong if you have both hanging around?

Hello @willpower232,

Thank you for the fast response! I don't think that is possible, when I switched over to v2 I created a complete new server and followed all the steps in the documentation (https://docs.postalserver.io/install/prerequisites/).

PCL-CrisKolkman avatar Dec 12 '22 10:12 PCL-CrisKolkman

Well the help output differs for both so something is wrong

image

willpower232 avatar Dec 12 '22 11:12 willpower232

Well the help output differs for both so something is wrong

image

Okay that's strange. Is there any way to check this because like I said, I installed v2 on a complete new server.

PCL-CrisKolkman avatar Dec 12 '22 11:12 PCL-CrisKolkman

Well the help output differs for both so something is wrong

image

Not sure what happened, I only rebooted the server (but that wasn't the first time) and now I seem to be getting the correct help output (only not the output I would expect when running the command postal version)?

root@SERVERNAME:~# postal version
Usage: postal [command]

Running postal:

 * start - start Postal
 * stop - stop Postal
 * status - view current process status
 * logs [service] - view logs from services

Setup/upgrade tools:

 * initialize - create and load the DB schema
 * upgrade - upgrade the DB schema

Other tools:

 * version - show the current Postal version
 * make-user - create a new global admin user
 * default-dkim-record - display the default DKIM record
 * console - open an interactive console
 * test-app-smtp - send a test message through Postal
 * bootstrap hostname [path] - create a new set of config
 * bash [service] - access a bash console for a running process

root@SERVERNAME:~# postal bash smtp
postal@SERVERNAME:~/app$

And as you can see above, when I run the command postal bash smtp I just get logged in as the postal user? Running the postal bash smtp again as postal user it shows me the "old" help output again?

postal@SERVERNAME:~/app$ postal bash smtp
Usage: postal [command]

Server components:

 * web-server - run the web server
 * smtp-server - run the SMTP server
 * worker - run a worker
 * cron - run the cron process
 * requeuer - run the message requeuer

Setup/upgrade tools:

 * initialize - create and load the DB schema
 * upgrade - upgrade the DB schema

Other tools:

 * version - show the current Postal version
 * make-user - create a new global admin user
 * default-dkim-record - display the default DKIM record
 * console - open an interactive console
 * test-app-smtp - send a test message through Postal

And running postal version as postal user shows the correct version...

postal@SERVERNAME:~/app$ postal version
2.1.2

PCL-CrisKolkman avatar Dec 12 '22 12:12 PCL-CrisKolkman

@willpower232 Maybe worth mentioning, I have disabled using netplan on the Ubuntu (18.04) server because of the routes I needed for the interfaces (as I remember is that I did not get that working using netplan).

nano /etc/network/interfaces

# ifupdown has been replaced by netplan(5) on this system.  See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
#    sudo apt install ifupdown

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens160
iface ens160 inet static
hostname postal.domain.com
address 192.168.200.52
netmask 255.255.255.0
gateway 192.168.200.250
dns-nameservers 8.8.8.8 8.8.4.4

# The secondary network interface
auto ens224
iface ens224 inet static
hostname smtp1.domain.com
address 10.0.1.1
netmask 255.255.255.0
dns-nameservers 8.8.8.8 8.8.4.4
post-up ip route add 10.0.1.0/24 dev ens224 src 10.0.1.1 table rt1
post-up ip route add default via 10.0.1.250 dev ens224 table rt1
post-up ip rule add from 10.0.1.1/32 table rt1
post-up ip rule add to 10.0.1.1/32 table rt1

# The third network interface
auto ens256
iface ens256 inet static
hostname smtp2.domain.com
address 10.0.2.1
netmask 255.255.255.0
dns-nameservers 8.8.8.8 8.8.4.4
post-up ip route add 10.0.2.0/24 dev ens256 src 10.0.2.1 table rt2
post-up ip route add default via 10.0.2.250 dev ens256 table rt2
post-up ip rule add from 10.0.2.1/32 table rt2
post-up ip rule add to 10.0.2.1/32 table rt2

PCL-CrisKolkman avatar Dec 12 '22 12:12 PCL-CrisKolkman

Well the help output differs for both so something is wrong image

Not sure what happened, I only rebooted the server (but that wasn't the first time) and now I seem to be getting the correct help output (only not the output I would expect when running the command postal version)?

root@SERVERNAME:~# postal version
Usage: postal [command]

Running postal:

 * start - start Postal
 * stop - stop Postal
 * status - view current process status
 * logs [service] - view logs from services

Setup/upgrade tools:

 * initialize - create and load the DB schema
 * upgrade - upgrade the DB schema

Other tools:

 * version - show the current Postal version
 * make-user - create a new global admin user
 * default-dkim-record - display the default DKIM record
 * console - open an interactive console
 * test-app-smtp - send a test message through Postal
 * bootstrap hostname [path] - create a new set of config
 * bash [service] - access a bash console for a running process

root@SERVERNAME:~# postal bash smtp
postal@SERVERNAME:~/app$

And as you can see above, when I run the command postal bash smtp I just get logged in as the postal user? Running the postal bash smtp again as postal user it shows me the "old" help output again?

postal@SERVERNAME:~/app$ postal bash smtp
Usage: postal [command]

Server components:

 * web-server - run the web server
 * smtp-server - run the SMTP server
 * worker - run a worker
 * cron - run the cron process
 * requeuer - run the message requeuer

Setup/upgrade tools:

 * initialize - create and load the DB schema
 * upgrade - upgrade the DB schema

Other tools:

 * version - show the current Postal version
 * make-user - create a new global admin user
 * default-dkim-record - display the default DKIM record
 * console - open an interactive console
 * test-app-smtp - send a test message through Postal

And running postal version as postal user shows the correct version...

postal@SERVERNAME:~/app$ postal version
2.1.2

I have the exact same behaviour on a new Ubuntu 22.04 server.

PCL-CrisKolkman avatar Dec 12 '22 15:12 PCL-CrisKolkman

Oh I misread your output, after you execute postal bash smtp as your root user you're now in the right place so you can check the config file with less or cat and confirm that it shows the IP Pools are enabled etc but it sounds like it is okay

willpower232 avatar Dec 12 '22 15:12 willpower232

Oh I misread your output, after you execute postal bash smtp as your root user you're now in the right place so you can check the config file with less or cat and confirm that it shows the IP Pools are enabled etc but it sounds like it is okay

IP pools are enabled in the postal.yml file.

PCL-CrisKolkman avatar Dec 12 '22 15:12 PCL-CrisKolkman