posts/Mini-sendmail... in bashBeuc's Bloghttps://blog.beuc.net/posts/Mini-sendmail..._in_bash/Beuc's Blogikiwiki2020-02-04T15:26:58Zexit 1https://blog.beuc.net/posts/Mini-sendmail..._in_bash/comment_1_a19014e677ebe32e8691e14f5b4a1c9e/Anonymous2020-02-04T15:26:58Z2012-02-14T01:07:10Z
<p>So, to make things really secure, they remove a standard reporting facility for alerting of configuration or security issues (the MTA)...</p>
<p>Instead, this script was needed, to allow any user to append an executable file owned by root, who would later read it with mutt running only as superuser (create 722 root mail)? Via the shell script, a user could insert extra From lines with spoofed date/time. Or writing directly to the file they could truncate it to delete old messages, and after all this leave no way to see which user ID really wrote any of them.</p>
<p>That aside, this was a nifty idea for scripting something useful with only basic tools.</p>
Nifty ideahttps://blog.beuc.net/posts/Mini-sendmail..._in_bash/comment_2_e98dc36b2f05f1c5158b3f265506728b/Anonymous2020-02-04T15:26:58Z2012-02-14T03:56:04Z
I've dealt with places like that before and share your pain. Sometimes an evil script is a much simpler solution than trying to bang your head against a wall convincing them otherwise.
Typohttps://blog.beuc.net/posts/Mini-sendmail..._in_bash/comment_3_3789c4dfe32829e92af1c4ce82763126/beuc2020-02-04T15:26:58Z2012-02-14T08:05:00Z
<p>722 should be 622, typo.</p>
<p>Indeed, even if though those systems do not offer local access, this isn't super-secure :P</p>
Better scriptinghttps://blog.beuc.net/posts/Mini-sendmail..._in_bash/comment_4_c53ac628a2c69abbbafde8e5d09f6a1d/Anonymous2020-02-04T15:26:58Z2012-02-14T10:33:02Z
<p>Instead of the subshell, consider this:</p>
<pre><code>#!/bin/bash
exec >> /var/mail/all
echo "From me $(LANG=C date)"
cat
echo
chmod 755 /usr/sbin/sendmail
</code></pre>
<p>– madduck</p>
sed s/cat/sed/https://blog.beuc.net/posts/Mini-sendmail..._in_bash/comment_6_b7391577106d2a8f28a0ad4c435eff7b/barak2020-02-04T15:26:58Z2012-02-14T16:47:33Z
<p>If the message body contains a line starting with "From " then this will fail a little bit. Suggest replacing "cat" with</p>
<p>sed -e 's/^([>]*From )/>\1/'</p>
Re: better scriptinghttps://blog.beuc.net/posts/Mini-sendmail..._in_bash/comment_5_91fd523ee64d995bb28b1d195a71d227/beuc2020-02-04T15:26:58Z2012-02-14T19:29:04Z
Nifty. I didn't know about "exec >> io-redirected.txt" <img src="https://blog.beuc.net/smileys/smile.png" alt=":)" />
You cna use cron without a MTAhttps://blog.beuc.net/posts/Mini-sendmail..._in_bash/comment_7_12e95d77d61c28eeca1e9dcca74c525a/Anonymous2020-02-04T15:26:58Z2012-02-14T20:54:16Z
<p>There was a rather long discussion about the topic of having no MTA on Fedora by default :
https://fedoraproject.org/wiki/Features/NoMTA</p>
<p>And the outcome was that cronie ( a cron daemon ) can be used without a mta. So maybe switching to this would help you ?</p>
Say no to "LANG=C"https://blog.beuc.net/posts/Mini-sendmail..._in_bash/comment_8_93b44e1a055b381f994f976f94a0b9c5/Anonymous2020-02-04T15:26:58Z2012-02-15T08:06:51Z
"LANG=C" is not a correct way to sanitize locale. Use "LC_ALL=C".
comment 9https://blog.beuc.net/posts/Mini-sendmail..._in_bash/comment_9_def9e9f11b157c4258a11703c51d53ea/Anonymous2020-02-04T15:26:58Z2012-02-16T13:41:05Z
Never ever use LC_ALL.