Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Port Numbers

Status
Not open for further replies.

PigskinReferee

Technical User
Apr 29, 2006
3
US
I am presently using Sendmail; however, I want to change over to QMail. My Sendmail program is configured to receive mail on Port 25, but send on Port 10025. That is because my ISP is blocking Port 25. I am using DynDNS to relay mail to my domain to me on Port 10025. I am using my regular ISP's SMTP program to sent out on (Port 25), via Sendmail's 'Smart_Host' feature.

Is it possible to configure QMail to send on one Port, but receive on another? I have not been able to locate that information.

Thanks!
 
The short answer is yes, you can configure qmail in such a manner. However, I'm going to ask you to restate your problem because I'm not sure I understand it as you described.

Do you have an email server running behind an ISP that blocks port 25 or do you have a mail client that cannot reach your mail server external to the ISP?

D.E.R. Management - IT Project Management Consulting
 
OK, I will try to explain it in a simpler fashion.

My ISP is blocking Port 25. I could get them to open it, but that would cost an additional $25 per month, which I believe is excessive. Because of this, I cannot run my email server.

I have my own domain, which I host on one of the machines that I have networked together at my home. I am employing DynDNS to redirect requests to 'foobar.com' on port 80 to ' on port 9545. A similar technique is use with my email. Mail sent to 'foobar.com' on port 25 is relayed to me via port 10025 by DynDNS.

I use Sendmail's 'SMART_HOST' feature to send mail through my ISP's regular SMTP engine. I could send mail via a different port through DynDNS, but that would involve additional costs that I do not want to spend at this time.

I would like to configure QMail to receive mail on ports 10025 and 25 but send on port 25. Obviously, it must still handle any mail sent locally via the internal network.

Is this possible? How would I go about it?

Thanks!
 
Code:
I use Sendmail's 'SMART_HOST' feature to send mail through my ISP's regular SMTP engine. I could send mail via a different port through DynDNS, but that would involve additional costs that I do not want to spend at this time.

I would like to configure QMail to receive mail on ports 10025 and 25 but send on port 25. Obviously, it must still handle any mail sent locally via the internal network.

OK, so outgoing is untouched using port25 outbound.
Incoming listening on post 10025 and ALSO port25?
I assume incoming port 25 to support local LAN email transit?

For outbound you need not change anything. qmail's outgoing requests will be generated from ANY high level port number randomly selected by the daemon to the remote ISP SMTP server at 25. You appear comfortable with using the ISP as a relay at port 25 so enough said. Just get yourself familiar with the 'smtproutes' file and you'll be all set there.

Incoming port 25 is typically configured as a normal process using Life with Qmail or any other configuration guide for qmail that I've seen. You CAN run qmail-smtpd on different concurrent ports by creating different instances of qmail-smtpd. I'll assume that you're going to use daemontools and other DJB tools, again as are commonly referred to by LWQ, etc.

Thus you'll go ahead and prepare your 'run' file for port 25 in typical fashion under /var/qmail/supervise/qmail-smtpd/run and will symlink that folder under /service. At that point you're listening on port 25. Again, all very typical stuff, well documented elsewhere.

Now to create the high port instance of smtpd, in /var/qmail/supervise create a new folder called qmail-smtpd10025 and create the same scripts and environments for the 'run' file and associated logging as you did before.

HOWEVER in this new instance of the 'run' file, you'll need to make a modification to the new port!

Your original qmail-smtpd/run file:
Code:
<snip>
      -c 30 -R -u "$VPOPMAILUID" -g "$VPOPMAILGID" 0 smtp \
      /usr/local/bin/rblsmtpd -b -C \
</snip>

Your modified qmail-smtpd/run file for port 10025:
Code:
<snip>
      -c 30 -R -u "$VPOPMAILUID" -g "$VPOPMAILGID" 0 10025 \
      /usr/local/bin/rblsmtpd -b -C \
</snip>

(don't worry if I've got other variables or different order of appearance)

As you'll note, the net of this change was to replace the string 'stmp' with the port number '10025'. If you're a smarty you'll note that the 'smtp' reference is looking at /etc/services to figure out which port 'smtp' corresponds to.

Again, go ahead and symlink this new folder under /service and you should be listening on port 10025 ALSO.

I THINK it's also legal to register a new value in /etc/services and place that string (such as 'myhighsmtp') into the 'run' file instead of hard coding the value for the port number directly. However, there's not much point IMHO.

Did I answer your query?








D.E.R. Management - IT Project Management Consulting
 
OK, so outgoing is untouched using port25 outbound.

Outbound on port 25 can connect to my ISP only. It is blocked from that point forward. I have to insure that mail outbound is directed to my ISP's MTA via port 25.

Would what you have stated above work? Sendmail has a feature: 'SMART_HOST' that does just that.

Thanks for your assistance.
 
Code:
Just get yourself familiar with the 'smtproutes' file and you'll be all set there.

from

Code:
     smtproutes
          Artificial  SMTP  routes.   Each  route  has  the  form
          domain:relay,  without  any  extra  spaces.   If domain
          matches host, qmail-remote will connect to relay, as if
          host  had  relay  as  its only MX.  (It will also avoid
          doing any CNAME lookups on sender and recip.)  host may
          include a colon and a port number to use instead of the
          normal SMTP port, 25:

             inside.af.mil:firewall.af.mil:26

          relay may be empty; this tells qmail-remote to look  up
          MX records as usual.  smtproutes may include wildcards:

             .af.mil:
             :heaven.af.mil

          Here any address ending with .af.mil  (but  not  af.mil
          itself)  is routed by its MX records; any other address
          is artificially routed to heaven.af.mil.

          The qmail system does not protect you if you create  an
          artificial  mail  loop  between machines.  However, you
          are always safe using smtproutes if you do  not  accept
          mail from the network.

D.E.R. Management - IT Project Management Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top