Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Multiple Services on [poor solution found]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Percius
n00b
n00b


Joined: 13 Jul 2004
Posts: 47

PostPosted: Thu Jun 23, 2005 6:09 pm    Post subject: Multiple Services on [poor solution found] Reply with quote

Goal --> On Port n Allow Apache to Serve Webpages, Receive Emails Via Qmail, and If Possible Imap.

I know that apache can process non ssl encrypted messages so that subdomain.domain.org != domain.org when both are accessed at the same IP on the Same server with the same port. Is it possible to do somthing like that useing IP tables to allow email messages to sendmail.domain.org to be received by the server on port n then Piped to a different port on the server so that the dameon can handel the messages.

Request = IP, or Domain:n --> localhost:80
Request = imap.domain.org:n --> localhost:143
Request = sendmail.domain.org:n --> localhost:25

I know that by default external servers will not attempt to connect for sending mail on port N, but there are several low cost mail relays that will change port for you such as dyndns.org.

Thanks in advance.
_________________
Adopt an Unanswered Post
If you feel your problem has been solved, please add [solved] to the initial post's subject line.


Last edited by Percius on Fri Jun 24, 2005 1:15 am; edited 2 times in total
Back to top
View user's profile Send private message
Percius
n00b
n00b


Joined: 13 Jul 2004
Posts: 47

PostPosted: Thu Jun 23, 2005 6:27 pm    Post subject: Reply with quote

If anyone knows of a way that this is possible I would appriciate it, but I may have come up with an alternative.

Default action for all requests is to forword to Apache, but if the request comes from the 2 mail relays --> Qmail.

Besides running a hord style client on the website is their any way to get Pop or Imap into that mix?
_________________
Adopt an Unanswered Post
If you feel your problem has been solved, please add [solved] to the initial post's subject line.
Back to top
View user's profile Send private message
Ateo
Advocate
Advocate


Joined: 02 Jun 2003
Posts: 2022
Location: Vegas Baby!

PostPosted: Thu Jun 23, 2005 8:16 pm    Post subject: Reply with quote

I don't think this is possible. I've never seen a router than can forward port X to port Y and Z. I am also unable to find an RFC matching your request.

I could be wrong, but I've worked with high end cisco routers and have never heard such a thing.
Back to top
View user's profile Send private message
F.Ultra
Apprentice
Apprentice


Joined: 17 Mar 2004
Posts: 169
Location: Sweden

PostPosted: Thu Jun 23, 2005 8:52 pm    Post subject: Reply with quote

Are ypu saying that you would like people to send smtp to your ip at say port 80, let people surf to your ip at port 80 and connect with imap to your ip at port 80. And that this somehow then should be forwarded by your server to whatever port/machine that should take care of these requests?

What you are talking about would be a kind of proxy that would have to know how to tell which protocol is in use by the client, and while this can work for http it wouldn't work with say smtp since with smtp the server has to send an initial reply upon tcp connect so there this proxy cannot know wheter the client intended to do a smtp connect or not (and if my memory serves me correctly the same is true for imap).

Apache can do this kind of thing for http and htps since the client will send the domain that it was looking for in the GET header.
Back to top
View user's profile Send private message
Percius
n00b
n00b


Joined: 13 Jul 2004
Posts: 47

PostPosted: Thu Jun 23, 2005 10:22 pm    Post subject: Reply with quote

F.Ultra you are understanding what I wanted to do correctly. I couldn't think of a way to to it and was pretty sure it wasnt possible, but thought I would ask. The one redeaming Idea I had was that mabie iptables could be triggered by a Domainname since I knew it could not be triggered by the protocol.

And Yes I knew how apache was able to do it and why Apache could not do virtual hosts with SSL if they were all on the Same IP which is why I looked for a method of doing it before it ever got to a Dameon.


Anyone know how to do an IP tables Rule that says

IF Source IP = xxx.xxx.xxx.xxx:80 Forword to port 25
IF Source IP = yyy.yyy.yyy.yyy:80 Forword to port 25
else Let pass on port 80?
_________________
Adopt an Unanswered Post
If you feel your problem has been solved, please add [solved] to the initial post's subject line.
Back to top
View user's profile Send private message
Percius
n00b
n00b


Joined: 13 Jul 2004
Posts: 47

PostPosted: Fri Jun 24, 2005 12:42 am    Post subject: Reply with quote

Just incase anyone wants to know what I did here it goes.

1st off. I have not figured out a way to receive SMTP traffic + Be an Imap server + run apache all on the same port, but I have however figured out a way to use Iptables coupled with dyndns.orgs dns hop service to allow me to receive email for my domain on port 80 while still offering a website to the world. Since users currently cannot pop for now I will use Hord Imp to provide a web based interface for receiving the messages.

1. Build kernel with dummy nic support.
2. Configure Dummy nic with an IP (192.168.1.1 in my case0
3. Sign up for dyndns.orgs nethop service. Note: You need to know the static IPs for both of its servers. (I hope it provieds them)

4.
Code:
iptables -t nat -A PREROUTING -p tcp -i eth0 -s 192.168.2.3 -d 192.168.2.90 --dport 80 -j DNAT --to 192.168.1.1:25

Note: 192.168.2 --> test www for my network. replace 192.168.2.3 with dyndns.orgs mailhop servers.

I have tested this and it seems to function properly. That is to say that my test 3rd party smtp server is able to send mail to my smtp server which is successfully received, but anyone else that attempts to connect to my server on port 80 gets apache. I have no doubt that if I found a IMAP relay server that I could pay for or got another IP I could also use port 80 on that machine to allow for IMAP.
_________________
Adopt an Unanswered Post
If you feel your problem has been solved, please add [solved] to the initial post's subject line.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum