Norbert Preining
2009-Aug-10 00:21 UTC
[Pkg-exim4-users] Configuring smarthost based on the network
Hi everyone, (please Cc) I guess that has been asked before, but I couldn''t find any answer, which is strange since I guess many people have to fight with that: I am working on a laptop and switching networks permanently, from University to home (cable modem) to hotspots to wwan access. All of these logins usually force me to use a different smart host for sending emails. Most of the times I just circumvent that by fixing one smart host (at the university) together with user authentication so that I can send from anywhere in the world via that smart host. Unfortunately sometimes the port 25 is blocked (even outgoing) in some networks and smtp sending can *only* be done via their mail router. Now, is there a solution to the changing smart host problem? Best would be a solution that incorporates with e.g. wicd (which I am using), or NetworkManager (which I never touched), and of course with /etc/network/interfaces. Thanks a lot for any suggestion and all the best Norbert ------------------------------------------------------------------------------- Dr. Norbert Preining <preining at logic.at> Vienna University of Technology Debian Developer <preining at debian.org> Debian TeX Group gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094 ------------------------------------------------------------------------------- FAIRYMOUNT (vb.n.) Polite word for buggery. --- Douglas Adams, The Meaning of Liff
Mike Cardwell
2009-Aug-10 08:45 UTC
[Pkg-exim4-users] Configuring smarthost based on the network
Norbert Preining wrote:> Hi everyone, > > (please Cc) > > I guess that has been asked before, but I couldn''t find any answer, which > is strange since I guess many people have to fight with that: > > I am working on a laptop and switching networks permanently, from > University to home (cable modem) to hotspots to wwan access. > > All of these logins usually force me to use a different smart host for > sending emails. > > Most of the times I just circumvent that by fixing one smart host > (at the university) together with user authentication so that I can send > from anywhere in the world via that smart host. > > Unfortunately sometimes the port 25 is blocked (even outgoing) in some > networks and smtp sending can *only* be done via their mail router. > > Now, is there a solution to the changing smart host problem? > > Best would be a solution that incorporates with e.g. wicd (which I am > using), or NetworkManager (which I never touched), and of course with > /etc/network/interfaces. > > Thanks a lot for any suggestion and all the bestThese days it is common for people who run mail servers that relay, to listen on port 587 as well as port 25 to deal with exactly this problem. 587 has become the mail submission port. See the RFC description here: http://www.ietf.org/rfc/rfc2476.txt If your smtp relay isn''t listening on port 587 already, you could perhaps ask your IT department to add it? -- Mike Cardwell - IT Consultant and LAMP developer Cardwell IT Ltd. (UK Reg''d Company #06920226) http://cardwellit.com/
Nigel Metheringham
2009-Aug-10 08:50 UTC
[Pkg-exim4-users] Configuring smarthost based on the network
On 10 Aug 2009, at 01:21, Norbert Preining wrote:> Unfortunately sometimes the port 25 is blocked (even outgoing) in some > networks and smtp sending can *only* be done via their mail router.Blocking port 25 is absolutely best practice. Your MUA or MSA (if you are using exim in this sort of config), should instead be connecting to the MSA port (587) using an authenticated (and probably encrypted) session. 587 should be universally allowed through. If your mail provider does not provide an MSA service on 587 then they are incompetent. Beat them until they do. Nigel. -- [ Nigel Metheringham Nigel.Metheringham at InTechnology.com ] [ - Comments in this message are my own and not ITO opinion/policy - ]
Marc Haber
2009-Aug-10 10:38 UTC
[Pkg-exim4-users] Configuring smarthost based on the network
On Mon, Aug 10, 2009 at 02:21:55AM +0200, Norbert Preining wrote:> Unfortunately sometimes the port 25 is blocked (even outgoing) in some > networks and smtp sending can *only* be done via their mail router. > > Now, is there a solution to the changing smart host problem? > > Best would be a solution that incorporates with e.g. wicd (which I am > using), or NetworkManager (which I never touched), and of course with > /etc/network/interfaces.If you have an /etc/network/interface entry per network, you just add an "exim4-smarthost" setting in the stanza and use this /etc/network/if-up.d/exim4-smarthost: #!/bin/bash # Environment: # MODE = { start | stop } # IF_EXIM4_SMARTHOST = hostname port SMARTHOSTFILE="/etc/exim4/conf.d/main/00_local_DCsmarthost" if [ -z "$IF_EXIM4_SMARTHOST" ]; then exit 0 fi if [ "$MODE" = ''stop'' ]; then rm -f $SMARTHOSTFILE /etc/init.d/exim4 reload > /dev/null || true exit 0 fi if [ "$IF_EXIM4_SMARTHOST" = "none" ]; then rm -f $SMARTHOSTFILE /etc/init.d/exim4 reload > /dev/null || true exit 0 fi echo "DCsmarthost = ${IF_EXIM4_SMARTHOST}" > $SMARTHOSTFILE /etc/init.d/exim4 reload > /dev/null || true /usr/sbin/exim4 -qqf This works only with split config. I didn''t find any Networkmanager docs which would allow me to understand it, so I do not have a solution for this. Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don''t trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190
Norbert Preining
2009-Aug-10 10:49 UTC
[Pkg-exim4-users] Configuring smarthost based on the network
Hi Marc, On Mo, 10 Aug 2009, Marc Haber wrote:> If you have an /etc/network/interface entry per network, you just add > an "exim4-smarthost" setting in the stanza and use this > /etc/network/if-up.d/exim4-smarthost:Ahh thanks a lot, that helps already. I didn''t know what is the relation between /e/n/interfaces stanzas and the files in /e/n/if-up.d/. I had something similar with post-up or so, that tried to deduce from the IP the correct smarthost and wrote it into a lsearch-able file, but your solution is much better.> I didn''t find any Networkmanager docs which would allow me to > understand it, so I do not have a solution for this.I will check with wicd what can be done there. Would be nice. Again, thanks a lot and all the best Norbert ------------------------------------------------------------------------------- Dr. Norbert Preining <preining at logic.at> Vienna University of Technology Debian Developer <preining at debian.org> Debian TeX Group gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094 ------------------------------------------------------------------------------- HASTINGS (pl.n.) Things said on the spur of the moment to explain to someone who comes into a room unexpectedly precisely what it is you are doing. --- Douglas Adams, The Meaning of Liff
Marc Haber
2009-Aug-10 13:46 UTC
[Pkg-exim4-users] Configuring smarthost based on the network
On Mon, Aug 10, 2009 at 12:49:23PM +0200, Norbert Preining wrote:> On Mo, 10 Aug 2009, Marc Haber wrote: > > If you have an /etc/network/interface entry per network, you just add > > an "exim4-smarthost" setting in the stanza and use this > > /etc/network/if-up.d/exim4-smarthost: > > Ahh thanks a lot, that helps already. I didn''t know what is the > relation between /e/n/interfaces stanzas and the files in /e/n/if-up.d/.What you write in an interface stanze into /e/n/i, gets put capitalized and IF_-prefixed in the environment of the scripts that get called from /e/n/if-(pre-)?(up|down).d. exim4-smarthost => IF_EXIM4_SMARTHOST. Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don''t trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190