LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-15-2024, 11:49 AM   #1
BAcidEvil
Member
 
Registered: Dec 2003
Distribution: Slack 14.1 3.18.1
Posts: 294

Rep: Reputation: 10
Postfix “advanced” configuration NEED HELP


Hi so currently I am running a working email server postfix/dovecot. No relay simply has NAT/ACL on my Cisco.
What I am wanting to do on the Cisco is create a DMZ and in the DMZ making a email server to receive email from internet and then to relay (?) that to my LAN (existing) email.

I guess what I’m confused over is, what changes do I make on my existing non-DMZ postfix configuration. Would I enable relay? And that ip is now the DMZ email ip? Or does existing stay the same? Sorry I know it seems stupid but really I’m having major brain freeze.
 
Old 03-15-2024, 11:59 AM   #2
r1w1s1
Member
 
Registered: Mar 2004
Location: São Paulo - Brazil
Distribution: Slackware
Posts: 62
Blog Entries: 1

Rep: Reputation: 38
Quote:
Originally Posted by BAcidEvil View Post
Hi so currently I am running a working email server postfix/dovecot. No relay simply has NAT/ACL on my Cisco.
What I am wanting to do on the Cisco is create a DMZ and in the DMZ making a email server to receive email from internet and then to relay (?) that to my LAN (existing) email.

I guess what I’m confused over is, what changes do I make on my existing non-DMZ postfix configuration. Would I enable relay? And that ip is now the DMZ email ip? Or does existing stay the same? Sorry I know it seems stupid but really I’m having major brain freeze.
I'b a bit confused, do you have only ONE email server or SMTP Gateway also ? If you describe you setup will be better.
 
Old 03-15-2024, 12:06 PM   #3
BAcidEvil
Member
 
Registered: Dec 2003
Distribution: Slack 14.1 3.18.1
Posts: 294

Original Poster
Rep: Reputation: 10
Hmmm.

So I have a static ip, x.x.x.180 and a registered domain (WAN) that gets translated in the Cisco to 192.168.1.180 to my Slackware email server. Just one email server. Simple.

I am wanting to mess around on the Cisco ISR with “zone based firewall” and create a DMZ. I wanted to make an email server on the DMZ as an “out of network” server 172.16.1.180 and then as a relay to my existing email server 192.168.1.180. So I was wondering what all I needed to do in current email config. Currently it’s just listening to incoming smtp from the outside, but am wondering if I just add in the relay address 172.16.1.180?
Sorry I’m not good at explaining
 
Old 03-15-2024, 01:25 PM   #4
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 959

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
I suppose that the whole point of this is that your router has a static IP addres or at least some kind of dynamic DNS feature that allows you to have some official MX record on internet?

If this internet DNS MX record points to your routers public IP address your router can forward incoming traffic on port 25 to your SMTP server in your DMZ.

However, then I get the impression that you really would prefer to have mail routed from your DMZ SMTP server to the SMTP server of your LAN. That can of course also be accomplished if you configure your router to once again do port forwarding from the routers DMZ IP address to the machine of your choice in your LAN.

The next question is about outgoing mail, I suppose that both your DMZ SMTP server and your LAN SMTP server has free access to internet. It would be possible to configure your LAN SMTP server to use the DMZ SMTP server as a smart relay, but I don't really se the point of doing so.

Having your own SMTP server connected to internet might be fun, but it also comes with a great deal of responsibility. A misconfigured or hacked SMTP server will soon be used to relay spam. Relying on the mail server functionality of a Web Hotel is an easy way out of that responsibility.

regards Henrik
 
Old 03-15-2024, 01:54 PM   #5
BAcidEvil
Member
 
Registered: Dec 2003
Distribution: Slack 14.1 3.18.1
Posts: 294

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by henca View Post
I suppose that the whole point of this is that your router has a static IP addres or at least some kind of dynamic DNS feature that allows you to have some official MX record on internet?

If this internet DNS MX record points to your routers public IP address your router can forward incoming traffic on port 25 to your SMTP server in your DMZ.

However, then I get the impression that you really would prefer to have mail routed from your DMZ SMTP server to the SMTP server of your LAN. That can of course also be accomplished if you configure your router to once again do port forwarding from the routers DMZ IP address to the machine of your choice in your LAN.

The next question is about outgoing mail, I suppose that both your DMZ SMTP server and your LAN SMTP server has free access to internet. It would be possible to configure your LAN SMTP server to use the DMZ SMTP server as a smart relay, but I don't really se the point of doing so.

Having your own SMTP server connected to internet might be fun, but it also comes with a great deal of responsibility. A misconfigured or hacked SMTP server will soon be used to relay spam. Relying on the mail server functionality of a Web Hotel is an easy way out of that responsibility.

regards Henrik
I am sorry I am terrible at explaining.
I have a block of 8 static ips [6 usable] and have one of them, x.x.x.180 assigned a domain name from dotster. All the Mx, reverse and forward dns all set up. At home I have my Cisco ISR which connects to my Cisco FPR and then to my SG Switch; 192.168.1.180 resides there and hosts my own email server, all of it, from there.
What I was wanting to do, more so out of curiosity and boredom, was to move the server from my SG LAN and create a DMZ email server (172.16.1.180) on the ISR. Have that be the first point of contact and then my current/existing email server connect to that new one (on DMZ) via relay address 172.16.1.180
That way DMZ email server is locked down completely and only has Internet access for email, but my current email server is LAN side and connects to email with this new relay/dmz server.

Or am I missing how this works?
 
Old 03-16-2024, 07:30 AM   #6
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 959

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
I agree that it might be a good idea to have your internet facing SMTP server in a DMZ, and that it should be fully possible to use it as a relay from your LAN SMTP server.

If your LAN seems to come from another public IP address than your DMZ it might be a really good idea to use your DMZ SMTP server as outgoing relay to not confuse internet SMTP servers about how valid your LAN SMTP server is.

regards Henrik
 
Old 03-16-2024, 09:53 AM   #7
BAcidEvil
Member
 
Registered: Dec 2003
Distribution: Slack 14.1 3.18.1
Posts: 294

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by henca View Post
I agree that it might be a good idea to have your internet facing SMTP server in a DMZ, and that it should be fully possible to use it as a relay from your LAN SMTP server.

If your LAN seems to come from another public IP address than your DMZ it might be a really good idea to use your DMZ SMTP server as outgoing relay to not confuse internet SMTP servers about how valid your LAN SMTP server is.

regards Henrik
Morning. I think that may be some of where I get confused... CURRENTLY [Non-DMZ] email server is on LAN 192.168.1.180 with a WAN STATIC IP x.x.x.180 with simple NAT translation. IN creating this DMZ w/ email Server 172.16.1.180... Does DMZ use the same x.x.x.180 WAN IP or does the existing 192.168.1.180 use it, or can I NAT Both? This is sort of what confuses me.
 
Old 03-16-2024, 05:26 PM   #8
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 959

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Quote:
Originally Posted by BAcidEvil View Post
I think that may be some of where I get confused... CURRENTLY [Non-DMZ] email server is on LAN 192.168.1.180 with a WAN STATIC IP x.x.x.180 with simple NAT translation. IN creating this DMZ w/ email Server 172.16.1.180... Does DMZ use the same x.x.x.180 WAN IP or does the existing 192.168.1.180 use it, or can I NAT Both? This is sort of what confuses me.
As simple NAT firewall/router will allow machines in a LAN or DMZ to reach servers on internet through a public IP address on the firewall/router. However, machines on internet will not be able to initiate connections to machines in LAN or DMZ, they will only be able to reach the public IP address(es) of the firewall/router.

For machines on internet to be able to connect to machines in LAN or DMZ you will need to configure port forwarding in the firewall/router. This port forwarding makes your firewall/router listen on chosen tcp and/or udp ports on the internet interface and then forwards any connections to your chosen internal LAN or DMZ IP address(es) and possibly another port number on that machine.

Example: I have a public IP address xxx.xxx.xxx.47 on my Asus router. This asus router has an internal IP address 192.168.67.1 on a network with both some wired equipment and WLAN. As I don't trust wlan as much I have a second wired firewall with external IP address 192.168.67.2.

Any connection to tcp port 2222 on my public xxx.xxx.xxx.47 address is forwarded to port 2222 on my internal firewall with IP 192.168.67.1.

My internal firewall has two more NICS, 192.168.43.1 is for my LAN and 192.168.17.2 is for my DMZ. Any connection to port 2222 on 192.168.43.1 is forwarded to port 22 on 192.168.17.1 which is a raspberry pi in my DMZ.

This raspberry pi monitors any attempts to connect by ssh to the non standard port 2222. At the time of this writing 56351 different IP addresses on internet has failed connecting by ssh. Some typical attempts looks something like this:

Code:
Mar 16 21:43:59 igor sshd[20907]: Invalid user apple from 2.57.122.80
Mar 16 21:43:59 igor sshd[20907]: input_userauth_request: invalid user apple [preauth]
Mar 16 21:43:59 igor sshd[20907]: pam_unix(sshd:auth): check pass; user unknown
Mar 16 21:43:59 igor sshd[20907]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=2.57.122.80 
Mar 16 21:44:01 igor sshd[20907]: Failed password for invalid user apple from 2.57.122.80 port 38512 ssh2
Mar 16 21:44:01 igor sshd[20907]: Connection closed by 2.57.122.80 [preauth]
Mar 16 21:45:19 igor sshd[20909]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=159.75.122.191  user=root
Mar 16 21:45:21 igor sshd[20909]: Failed password for root from 159.75.122.191 port 44888 ssh2
Mar 16 21:45:22 igor sshd[20909]: Received disconnect from 159.75.122.191: 11: Bye Bye [preauth]
Mar 16 21:48:14 igor sshd[20911]: Connection closed by 159.75.122.191 [preauth]
An attempt to draw a one-line "image" of the setup:

xxx.xxx.xxx.47:2222 -> 192.168.67.1:2222 -> 192.168.17.1:22

I am not familiar with your cisco systems and cant say for sure if also you like me will need to configure port forwarding on two different NAT firewalls.

regards Henrik
 
Old 03-17-2024, 09:18 PM   #9
BAcidEvil
Member
 
Registered: Dec 2003
Distribution: Slack 14.1 3.18.1
Posts: 294

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by henca View Post
As simple NAT firewall/router will allow machines in a LAN or DMZ to reach servers on internet through a public IP address on the firewall/router. However, machines on internet will not be able to initiate connections to machines in LAN or DMZ, they will only be able to reach the public IP address(es) of the firewall/router.

For machines on internet to be able to connect to machines in LAN or DMZ you will need to configure port forwarding in the firewall/router. This port forwarding makes your firewall/router listen on chosen tcp and/or udp ports on the internet interface and then forwards any connections to your chosen internal LAN or DMZ IP address(es) and possibly another port number on that machine.

Example: I have a public IP address xxx.xxx.xxx.47 on my Asus router. This asus router has an internal IP address 192.168.67.1 on a network with both some wired equipment and WLAN. As I don't trust wlan as much I have a second wired firewall with external IP address 192.168.67.2.

Any connection to tcp port 2222 on my public xxx.xxx.xxx.47 address is forwarded to port 2222 on my internal firewall with IP 192.168.67.1.

My internal firewall has two more NICS, 192.168.43.1 is for my LAN and 192.168.17.2 is for my DMZ. Any connection to port 2222 on 192.168.43.1 is forwarded to port 22 on 192.168.17.1 which is a raspberry pi in my DMZ.

This raspberry pi monitors any attempts to connect by ssh to the non standard port 2222. At the time of this writing 56351 different IP addresses on internet has failed connecting by ssh. Some typical attempts looks something like this:

Code:
Mar 16 21:43:59 igor sshd[20907]: Invalid user apple from 2.57.122.80
Mar 16 21:43:59 igor sshd[20907]: input_userauth_request: invalid user apple [preauth]
Mar 16 21:43:59 igor sshd[20907]: pam_unix(sshd:auth): check pass; user unknown
Mar 16 21:43:59 igor sshd[20907]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=2.57.122.80 
Mar 16 21:44:01 igor sshd[20907]: Failed password for invalid user apple from 2.57.122.80 port 38512 ssh2
Mar 16 21:44:01 igor sshd[20907]: Connection closed by 2.57.122.80 [preauth]
Mar 16 21:45:19 igor sshd[20909]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=159.75.122.191  user=root
Mar 16 21:45:21 igor sshd[20909]: Failed password for root from 159.75.122.191 port 44888 ssh2
Mar 16 21:45:22 igor sshd[20909]: Received disconnect from 159.75.122.191: 11: Bye Bye [preauth]
Mar 16 21:48:14 igor sshd[20911]: Connection closed by 159.75.122.191 [preauth]
An attempt to draw a one-line "image" of the setup:

xxx.xxx.xxx.47:2222 -> 192.168.67.1:2222 -> 192.168.17.1:22

I am not familiar with your cisco systems and cant say for sure if also you like me will need to configure port forwarding on two different NAT firewalls.

regards Henrik
I have my NAT/Firewall set to allow [outside -to- in] access to my Email Server in the "DMZ". Where I am failing to grasp is the Internal LAN Email Server. Does this get configured to 'relay 172.16.1.179:Port' for it to receive email fro DMZ to LAN?
 
Old 03-18-2024, 01:45 AM   #10
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 959

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Quote:
Originally Posted by BAcidEvil View Post
Where I am failing to grasp is the Internal LAN Email Server. Does this get configured to 'relay 172.16.1.179:Port' for it to receive email fro DMZ to LAN?
If you want emails to your domain to end up in your LAN server you will need to configure your DMZ SMTP server to relay incoming emails to your domain to yor LAN SMTP server and you will need to configure your firewall(s) to somehow (possibly with port forwardning) allow such a connection.

If you want your LAN SMTP server to send outgoing mails through your DMZ SMTP server you will need to configure it to relay outgoing emails to your DMZ SMTP server. Your firewall is probably configured to allow all traffic from your LAN to your DMZ.

Both of these configurations are kind of optional. Maybe you would prefer to have your email clients reading mail from the DMZ server instead of opening up port 25 in your firewall from the DMZ to your LAN. Maybe you would prefer to let your LAN SMTP server send emails directly to internet SMTP servers.

regards Henrik
 
Old 03-18-2024, 11:32 AM   #11
BAcidEvil
Member
 
Registered: Dec 2003
Distribution: Slack 14.1 3.18.1
Posts: 294

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by henca View Post
If you want emails to your domain to end up in your LAN server you will need to configure your DMZ SMTP server to relay incoming emails to your domain to yor LAN SMTP server and you will need to configure your firewall(s) to somehow (possibly with port forwardning) allow such a connection.

If you want your LAN SMTP server to send outgoing mails through your DMZ SMTP server you will need to configure it to relay outgoing emails to your DMZ SMTP server. Your firewall is probably configured to allow all traffic from your LAN to your DMZ.

Both of these configurations are kind of optional. Maybe you would prefer to have your email clients reading mail from the DMZ server instead of opening up port 25 in your firewall from the DMZ to your LAN. Maybe you would prefer to let your LAN SMTP server send emails directly to internet SMTP servers.

regards Henrik
I really don’t know what I want, or which option to choose. It all started “you should run your email server in a DMZ separate from your LAN”. So now googling this and that am I’m like, well, ok, but still missing some components in theory and topology. I guess the issue is, I don’t know what I want or the correct way to implement. I mean, do I want to relay I coming and outgoing through the DMZ? Like I feel I’m getting a hammer to my head cause I’m not grasping WHAT I should do, or just leave it as it is. Email server on LAN.
 
Old 03-18-2024, 12:11 PM   #12
elcore
Senior Member
 
Registered: Sep 2014
Distribution: Slackware
Posts: 1,753

Rep: Reputation: Disabled
Quote:
Originally Posted by BAcidEvil View Post
I really don’t know what I want, or which option to choose. It all started “you should run your email server in a DMZ separate from your LAN”
If you want a secure server, then you use port forwarding on the router and firewall rules on the server to only allow what ports/addresses you need.
DMZ by definition allows all. But that's just my opinion, you do what you want with your server.
 
Old 03-18-2024, 01:28 PM   #13
BAcidEvil
Member
 
Registered: Dec 2003
Distribution: Slack 14.1 3.18.1
Posts: 294

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by elcore View Post
If you want a secure server, then you use port forwarding on the router and firewall rules on the server to only allow what ports/addresses you need.
DMZ by definition allows all. But that's just my opinion, you do what you want with your server.
Well that is how it currently is. The Email resides in the LAN and ONLY, ONLY mail server port and ssh are open to it. LAN of course has access as it’s on LAN. So really by moving it to DMZ I’d be opening it.
 
Old 03-18-2024, 01:30 PM   #14
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 959

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Again, I would recommend to rely on the SMTP service of some Web hotel. But if you feel confident on how to configure a secure SMTP server which does not end up relaying spam on internet or becoming a backdoor to your network and also think that it is a nice hobby to 24/7 be prepared to quickly apply security patches then running your own email server might be a good idea.

regards Henrik
 
Old 03-18-2024, 06:27 PM   #15
viel
Member
 
Registered: Jul 2021
Location: Arcadia
Distribution: Slackware
Posts: 46

Rep: Reputation: Disabled
Quote:
Originally Posted by BAcidEvil View Post
I really don’t know what I want, or which option to choose. It all started “you should run your email server in a DMZ separate from your LAN”. So now googling this and that am I’m like, well, ok, but still missing some components in theory and topology. I guess the issue is, I don’t know what I want or the correct way to implement. I mean, do I want to relay I coming and outgoing through the DMZ? Like I feel I’m getting a hammer to my head cause I’m not grasping WHAT I should do, or just leave it as it is. Email server on LAN.
Hi,

I am not the best security expert but, the purpose of running in a DMZ is in case of compromise don't affect entire LAN.
It is recommended to run servers on separated DMZ's and isolated to minimize the compromise of others servers in the same DMZ or LAN ...

Different config different purpose, price, work, ...

You can put your server in a DMZ and only have it. Like now in LAN but isolated from LAN. Or isolate it with VLANS. Seems not you are looking for.

You can put a relay front-end on DMZ and a back-end on LAN. If DMZ compromised they can relay but no all mail data affected. But if you can't early detect the compromised relay ... , you know.

So running a relay can be dangerous, you need to relay only for your domains and to inside and block OUTSIDE. Then the back-end can send emails from Lan to internet directly, from more secure to less secure, same config like now.

Not to much knowledge on manage SMTP but just add the relay address on the back-end will work.

From Internet --> Relay on DMZ --> SMPT on LAN.

FRom SMPT LAN --> To Internet.

EDIT: SMPT on Lan, different from users LAN if possible.

Tip: Different systems,distributions on relay and SMPT for best security. Like openbsd and slackware.

Hope that help.

Viel.

Last edited by viel; 03-18-2024 at 06:50 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix ports configuration in the 4MLinux Server 23.0 (for advanced users) zk1234 4MLinux 0 10-21-2017 11:53 PM
[SOLVED] ACPI (Advanced Configuration And Power Configuration) not present on 2.6.38.8? Aquarius_Girl Linux - Newbie 8 05-30-2012 07:52 AM
need help on advanced printer configuration jackandking Linux - Newbie 5 03-22-2008 01:00 PM
LXer: Advanced SSH configuration and tunneling: We don’t need no stinking VPN softw LXer Syndicated Linux News 0 11-28-2007 10:50 AM
Better buying "advanced linux prog" or "unix advanced prog" Dominik Programming 3 12-31-2003 01:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration