Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ssmtp message size limit?
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
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 992

PostPosted: Sun Dec 16, 2012 11:04 pm    Post subject: ssmtp message size limit? Reply with quote

My crontab isn't sending some messages and I think it's because they're too large. Is there a size limit for messages sent by ssmtp? If so, can I change it or should I switch to another mailer?
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10342
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Dec 16, 2012 11:54 pm    Post subject: Reply with quote

There shouldn't be any unreasonably small limit. Just out of curiosity, how large are these messages?

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 992

PostPosted: Mon Dec 17, 2012 12:44 am    Post subject: Reply with quote

They're around 1.5MB. It's the output from stuff like eix-test-obsolete and eix-sync.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10342
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Dec 17, 2012 12:51 am    Post subject: Reply with quote

You know that two newlines in a row will terminate the mail message, right? If your input contains that, then the mail will be truncated. A simple filter can be written in sed, AWK or Perl that will fix that. Simplest one is
Code:
sed 's/^$/ /'
- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 992

PostPosted: Mon Dec 17, 2012 9:43 pm    Post subject: Reply with quote

I'm running identical commands on several machines in a crontab, and the only one that is sending the mail as it should is the machine that runs postfix instead of ssmtp. It seems dangerous to run ssmtp with a size limit in case there is a massive amount of error output from an important (backup) command.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10342
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Dec 17, 2012 9:44 pm    Post subject: Reply with quote

So try the solution I proposed in my previous post. It may not be size limitations.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 992

PostPosted: Mon Dec 17, 2012 10:00 pm    Post subject: Reply with quote

OK, but the commands they're running are identical. The output could vary a bit I suppose. Can your script be integrated on the crontab line?

0 0 * * * root /etc/cron.d/script.sh
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10342
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Dec 17, 2012 10:04 pm    Post subject: Reply with quote

That depends on what the script.sh contains. Care to share?

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 992

PostPosted: Mon Dec 17, 2012 10:30 pm    Post subject: Reply with quote

Of course, it's not very interesting:
Code:
#!/bin/bash

SYSTEM=laptop
MAILTO=me@example.com

layman -S
eix-sync
eix-remote update
eclean -t 3m distfiles
eclean -t 3m packages
eix-test-obsolete 2>&1| mail -s "$SYSTEM: eix-test-obsolete" $MAILTO
revdep-rebuild -ip 2>&1| mail -s "$SYSTEM: revdep-rebuild -ip" $MAILTO
emerge -pvDuN world 2>&1| mail -s "$SYSTEM: emerge -pvDuN world" $MAILTO
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10342
Location: Somewhere over Atlanta, Georgia

PostPosted: Tue Dec 18, 2012 2:04 am    Post subject: Reply with quote

Sure. That would be
Code:
#!/bin/bash

SYSTEM=laptop
MAILTO=me@example.com

layman -S
eix-sync
eix-remote update
eclean -t 3m distfiles
eclean -t 3m packages
eix-test-obsolete 2>&1| sed 's/^$/ /' | mail -s "$SYSTEM: eix-test-obsolete" $MAILTO
revdep-rebuild -ip 2>&1| sed 's/^$/ /' | mail -s "$SYSTEM: revdep-rebuild -ip" $MAILTO
emerge -pvDuN world 2>&1| sed 's/^$/ /' | mail -s "$SYSTEM: emerge -pvDuN world" $MAILTO
:wink:

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 992

PostPosted: Tue Dec 18, 2012 2:07 am    Post subject: Reply with quote

Thank you John!
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 992

PostPosted: Wed Dec 26, 2012 10:51 pm    Post subject: Reply with quote

I was about to put this together for testing but I realized I didn't explain it properly. The mail command in my script is sending mail just fine. The mail I'm not getting is the STDERR stuff I should be getting from crontab due to:

0 4 * * * root /etc/cron.d/update.sh > /dev/null

I'm running this on 5 machines and I only get mail from the machine which runs postfix instead of ssmtp. Can you show me how to use sed in my script to make sure none of its lines are generating "end of message" characters, not just the lines running 'mail'?
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