Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ssmtp & remote auth
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
keschrich
n00b
n00b


Joined: 09 Apr 2002
Posts: 69
Location: Branford, CT

PostPosted: Mon Aug 26, 2002 8:39 pm    Post subject: ssmtp & remote auth Reply with quote

I'm trying to set up ssmtp so that I can send mail from my pda when I sync it, and everything is set up and working except for one problem: my remote smtp server requires that I authenticate myself.

Since I see no other way to authenticate with ssmtp in the config file, only through the command line, I tried doing this: I deleted /usr/sbin/sendmail, which was a link to /usr/sbin/ssmtp, and replaced it with the followig script:

Code:
/usr/sbin/ssmtp -au username -ap pass $*


but when I watch the system log as I'm syncing, it still comes up saying that relaying is denyed.. I did try sending a message just from the command line using my name and pass, and it did work fine. Anybody know why this isn't working, or know of anything else I can do?
Back to top
View user's profile Send private message
wibblefrog
n00b
n00b


Joined: 08 Jan 2003
Posts: 4
Location: Birmingham, England

PostPosted: Thu Jan 09, 2003 1:44 pm    Post subject: Relaying denied Reply with quote

If ssmtp is anything like sendmail relaying is denied by default. As such you need to allow it. BUT only allow it for machines you want to relay NOT all machines, otherwise you may be used as a spam source. The info for it should be available on the appropriate website.

Again just looking at this from a sendmail perspective.
_________________
I see! said the blind man to his deaf daughter.
Back to top
View user's profile Send private message
FTC
n00b
n00b


Joined: 16 Feb 2003
Posts: 28
Location: London, UK

PostPosted: Tue Jun 15, 2004 7:18 pm    Post subject: Reply with quote

Hi,

You just need to edit /etc/mailer.conf like this:

Code:

#       $OpenBSD: mailer.conf,v 1.3 2000/04/06 18:24:19 millert Exp $
#
# Execute the "real" sendmail program from ssmtp,
# named /usr/sbin/ssmtp
#
sendmail        /usr/sbin/ssmtp -au USER -ap PASSWORD
send-mail       /usr/sbin/ssmtp -au USER -ap PASSWORD
mailq           /usr/sbin/ssmtp
newaliases      /usr/sbin/ssmtp


_________________
Athlon64 3200+ | MSI K8Neo2 Deluxe | XFX GF6800GT | 1GB DDR400 (dual channel) | Sound Blaster Audigy 2
2x Xeon 2.4GHz | Intel SE7505VB2 | XFX FX5700LE | 1.5GB DDR266 Reg ECC | 2x 80GB SATA (RAID0) | Adaptec 2610SA | 5x 200GB SATA
Back to top
View user's profile Send private message
reeder
n00b
n00b


Joined: 02 Apr 2003
Posts: 45
Location: Plano, TX

PostPosted: Tue Nov 23, 2004 5:51 pm    Post subject: Reply with quote

FTC wrote:
Hi,

You just need to edit /etc/mailer.conf like this:

Code:

#       $OpenBSD: mailer.conf,v 1.3 2000/04/06 18:24:19 millert Exp $
#
# Execute the "real" sendmail program from ssmtp,
# named /usr/sbin/ssmtp
#
sendmail        /usr/sbin/ssmtp -au USER -ap PASSWORD
send-mail       /usr/sbin/ssmtp -au USER -ap PASSWORD
mailq           /usr/sbin/ssmtp
newaliases      /usr/sbin/ssmtp



The unstated assumption is that mailwrapper is installed. It wasn't installed on my system.

And when I installed mailwrapper (0.2) it created (and reads) /etc/mail/mailer.conf, not /etc/mailer.conf. Otherwise, your solution works just fine.

One last nit, /etc/mail/mailer.conf is world readable, so the password is there in the clear. :-(

-- William
Back to top
View user's profile Send private message
reeder
n00b
n00b


Joined: 02 Apr 2003
Posts: 45
Location: Plano, TX

PostPosted: Tue Nov 23, 2004 9:14 pm    Post subject: Slightly more secure mailer.conf containing login/password Reply with quote

Scenario: personal system with a few cron jobs that might send email (as cronjobs are often want to do). I want such email to show up in my normal email account at my ISP, but they require authentication (login/password) to send email. My normal email client works fine (it is easy to configure), but how do I get cron (in my case it's vixie-cron) to send the email?

As described in previous postings in this thread, using the combo of ssmtp and mailwrap you can pass a username and password to the remote MTA by modifying /etc/mail/mailer.conf. Unfortunately, this file is world readable because it is read by mailwrap (/usr/sbin/sendmail) and because mailwrap is running with an effective uid of potentially any user.

My solution to this world readable file was to make it not world readable and to make mailwrap setgid.

I added a new group to /etc/group:
Code:
mailwrap:x:101:

I then put both /usr/sbin/sendmail and /etc/mail/mailer.conf in that group:
Code:
# chgrp mailwrap /usr/sbin/sendmail /etc/mail/mailer.conf

Finally, I adjusted the permissions on /usr/sbin/sendmail and /etc/mail/mailer.conf:
Code:
# chmod g+s /usr/sbin/sendmail
# chmod 640 /etc/mail/mailer.conf

Cron and other apps can still send email by feeding them into /usr/lib/sendmail, but users cannot see the login/password info in /etc/mail/mailer.conf.

Is this perfect? No. For one thing, my login and password are on the command line for ssmtp where they can be seen by ps(1). This may also interfere with mail clients which invoke sendmail for delivery and want to pass their own -au and -ap parameters. But for a single user system with a mail client like mozilla or thunderbird (or any with a built in smtp capabilities) it might work.

YMMV,
-- William

PS. You'll need to edit /etc/ssmtp/ssmtp.conf for some basic ssmtp configuration. The comments help you do it. To test, create a file named "test.msg" with something like this:
Code:
Subject: test

testing, 1, 2, 3.

And pipe that into sendmail like so (as a normal user):
Code:
% cat test.msg | /usr/lib/sendmail myemail@my.isp

Of course, replace "myemail@my.isp" with your real email address. -- WPR
Back to top
View user's profile Send private message
hobo2
Tux's lil' helper
Tux's lil' helper


Joined: 08 May 2005
Posts: 87
Location: San Diego, CA & Miami, FL

PostPosted: Thu May 12, 2005 4:08 am    Post subject: Reply with quote

how do you specify in the cron job output the "To:" account where the output should be sent?

I got the manual cat test.msg to email just fine, only my cron jobs are being sent according to logs but are not received in my isp email account
Back to top
View user's profile Send private message
reeder
n00b
n00b


Joined: 02 Apr 2003
Posts: 45
Location: Plano, TX

PostPosted: Fri May 13, 2005 2:29 am    Post subject: Reply with quote

hobo2 wrote:
how do you specify in the cron job output the "To:" account where the output should be sent?

I got the manual cat test.msg to email just fine, only my cron jobs are being sent according to logs but are not received in my isp email account
In vixie-cron the crontab files can include environment variables as well as lines defining cronjobs. One such variable is MAILTO. As it says in the man page (man 5 crontab), if MAILTO is defined and non-empty mail is sent to the user named. If MAILTO is defined but empty (MAILTO="") then no mail is sent. If MAILTO is missing then mail is sent to the owner of the crontab.

My guess is that you don't have the MAILTO variable defined so the cron daemon is sending email to the local user which owns the crontab and this is probably failing. So add MAILTO="joe@foo.bar" to your crontab. Another alternative is to use a mailer which does aliases or processes .forward files and handle the redirection to an internet style email address there.

For more information read the man pages for cron(8), crontab(1), and crontab(5).

-- William
Back to top
View user's profile Send private message
hobo2
Tux's lil' helper
Tux's lil' helper


Joined: 08 May 2005
Posts: 87
Location: San Diego, CA & Miami, FL

PostPosted: Fri May 13, 2005 3:55 pm    Post subject: Reply with quote

I use fcron and it emails me the "header" from the log, as in the output from any job I schedule and it does this without any environment variables

what I was wondering is how to also have it email me the log it creates?
Back to top
View user's profile Send private message
reeder
n00b
n00b


Joined: 02 Apr 2003
Posts: 45
Location: Plano, TX

PostPosted: Fri May 13, 2005 7:32 pm    Post subject: Reply with quote

hobo2 wrote:
I use fcron and it emails me the "header" from the log, as in the output from any job I schedule and it does this without any environment variables

what I was wondering is how to also have it email me the log it creates?
I don't understand what you are describing and/or wanting. Your use of the word "header" makes it should like you're getting some sort of output (emailed to your ISP account?) but not what you want, or not all of it. Your use of "log" confuses me even more.

In my experience crons of various flavors (note: I've never used fcron) will send no email if the job produces no output and exits with a status of zero. Each cron daemon probably has its own way of configuring it to customize how and when and to where it sends email. I would recommend reading the manual pages for your version of cron (fcron) as well as looking for info pages and other documentation (in /usr/share/doc or on the homepage of the source package).

Also, it is possible to pipe the output (including redirection of multiple file descriptors) of a cron job into mail in exactly the same way that you would pipe the output of any program into mail. For example:
Code:
foo 2>&1 | /usr/sbin/sendmail me@isp.net
Good luck,
-- William
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