Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

ssmtp & remote auth

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
9 posts • Page 1 of 1
Author
Message
keschrich
n00b
n00b
Posts: 69
Joined: Tue Apr 09, 2002 10:11 pm
Location: Branford, CT

ssmtp & remote auth

  • Quote

Post by keschrich » Mon Aug 26, 2002 8:39 pm

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: Select all

/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?
Top
wibblefrog
n00b
n00b
Posts: 4
Joined: Wed Jan 08, 2003 12:49 pm
Location: Birmingham, England

Relaying denied

  • Quote

Post by wibblefrog » Thu Jan 09, 2003 1:44 pm

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.
Top
FTC
n00b
n00b
User avatar
Posts: 28
Joined: Sun Feb 16, 2003 8:58 pm
Location: London, UK

  • Quote

Post by FTC » Tue Jun 15, 2004 7:18 pm

Hi,

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

Code: Select all

#       $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
Top
reeder
n00b
n00b
User avatar
Posts: 45
Joined: Wed Apr 02, 2003 9:53 pm
Location: Plano, TX

  • Quote

Post by reeder » Tue Nov 23, 2004 5:51 pm

FTC wrote:Hi,

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

Code: Select all

#       $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
Top
reeder
n00b
n00b
User avatar
Posts: 45
Joined: Wed Apr 02, 2003 9:53 pm
Location: Plano, TX

Slightly more secure mailer.conf containing login/password

  • Quote

Post by reeder » Tue Nov 23, 2004 9:14 pm

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: Select all

mailwrap:x:101:
I then put both /usr/sbin/sendmail and /etc/mail/mailer.conf in that group:

Code: Select all

# chgrp mailwrap /usr/sbin/sendmail /etc/mail/mailer.conf
Finally, I adjusted the permissions on /usr/sbin/sendmail and /etc/mail/mailer.conf:

Code: Select all

# 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: Select all

Subject: test

testing, 1, 2, 3.
And pipe that into sendmail like so (as a normal user):

Code: Select all

% cat test.msg | /usr/lib/sendmail myemail@my.isp
Of course, replace "myemail@my.isp" with your real email address. -- WPR
Top
hobo2
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 87
Joined: Sun May 08, 2005 5:52 am
Location: San Diego, CA & Miami, FL

  • Quote

Post by hobo2 » Thu May 12, 2005 4:08 am

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
Top
reeder
n00b
n00b
User avatar
Posts: 45
Joined: Wed Apr 02, 2003 9:53 pm
Location: Plano, TX

  • Quote

Post by reeder » Fri May 13, 2005 2:29 am

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
Top
hobo2
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 87
Joined: Sun May 08, 2005 5:52 am
Location: San Diego, CA & Miami, FL

  • Quote

Post by hobo2 » Fri May 13, 2005 3:55 pm

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?
Top
reeder
n00b
n00b
User avatar
Posts: 45
Joined: Wed Apr 02, 2003 9:53 pm
Location: Plano, TX

  • Quote

Post by reeder » Fri May 13, 2005 7:32 pm

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: Select all

foo 2>&1 | /usr/sbin/sendmail me@isp.net
Good luck,
-- William
Top
Post Reply

9 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic