SMRSH(8)
π SMRSH β restricted shell for sendmail π
Okay so first things first, bestie: this is from the System Manager's Manual, and it's giving "security guard for your mail server" energy. Let's get into it. β¨
πΈ NAME πΈ
smrsh β the restricted shell for sendmail, and no, it's not here to play games. π
π SYNOPSIS π
smrsh -c command
That's the whole vibe. One flag, one argument, zero drama. π
π¦ DESCRIPTION π¦
So smrsh is literally intended as a replacement for sh when you're using the "prog" mailer in your sendmail(8) config files. Periodt. It sharply limits which commands can be run through the "|program" syntax in sendmail, all to improve the overall security of your system. π‘οΈ
Like, briefly: even if a "bad guy" somehow gets sendmail to run a program without going through an alias or forward file, smrsh limits the set of programs they can execute. It's giving "you shall not pass" energy, fr fr. π
ββοΈ
Here's the tea: smrsh limits programs to a single directory β by default /etc/smrsh β which lets the system administrator choose the set of acceptable commands. It also only allows the shell builtin commands exec, exit, and echo. That's it. That's the whole list. π
It also rejects any commands containing these characters on the command line, to prevent "end run" attacks:
'<>;$()\r(carriage return)\n(newline)
β οΈ Bestie, those characters are banned on the command line. Not "maybe banned." Banned. π
But it does allow || and && so you can still enable commands like this iconic little number:
"|exec /usr/local/bin/filter || exit 75"
See? Not a total hater. It gets it. π
Initial pathnames on programs are stripped, so like⦠all of these actually forward to /etc/smrsh/vacation:
/usr/ucb/vacation
/usr/bin/vacation
/home/server/mydir/bin/vacation
vacation
The path is not the moment. The directory is the moment. π―
System administrators should be conservative about populating the /etc/smrsh directory. For example, a reasonable addition is vacation(1) and the like. But no matter how brow-beaten you may be, never include any shell or shell-like program (such as perl(1)) in the /etc/smrsh directory. π«
π Note: this does not restrict the use of shell or perl scripts in thesm.bindirectory (using the#!syntax). It simply disallows execution of arbitrary programs. Big difference, iykyk.
Also? Including mail filtering programs such as procmail(1) is a very bad idea. Why? Because procmail(1) allows users to run arbitrary programs in their procmailrc(5). So likeβ¦ yeah. Don't do that. Not today, not ever. π
π FILES π
/etc/smrshβ directory for restricted programs
That's the one. That's the directory. Protect it. π«Ά
π SEE ALSO π
β¨ And that's the whole manual, bestie. Stay safe, stay restricted, and never put perl in /etc/smrsh. π
$Date: 2013-11-22 20:52:00 $βSMRSH(8)out. Slay. π π
π¦ where this page comes from
- centos-stream 9: sendmail 8.16.1-13.el9 Β· Sendmail
- epel 10: sendmail 8.18.1-4.el10_0 Β· sendmail-8.23 AND MIT AND MIT-CMU AND BSD-3-Clause AND CDDL-1.0 AND BSD-4-Clause AND BSD-4-Clause-UC AND PostgreSQL AND ISC AND HPND-sell-variant AND mailprio
- fedora 43: sendmail 8.18.1-13.fc43 Β· sendmail-8.23 AND MIT AND MIT-CMU AND BSD-3-Clause AND CDDL-1.0 AND BSD-4-Clause AND BSD-4-Clause-UC AND PostgreSQL AND ISC AND HPND-sell-variant AND mailprio
- fedora 44: sendmail 8.18.2-2.fc44 Β· sendmail-8.23 AND MIT AND MIT-CMU AND BSD-3-Clause AND CDDL-1.0 AND BSD-4-Clause AND BSD-4-Clause-UC AND PostgreSQL AND ISC AND HPND-sell-variant AND mailprio
- fedora 44: sendmail 8.18.2-4.fc44 Β· sendmail-8.23 AND MIT AND MIT-CMU AND BSD-3-Clause AND CDDL-1.0 AND BSD-4-Clause AND BSD-4-Clause-UC AND PostgreSQL AND ISC AND HPND-sell-variant AND mailprio
- Copyright (c) 1998-2004 Proofpoint, Inc. and its suppliers
- Copyright (c) 1993 Eric P. Allman. All rights reserved
- Copyright (c) 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms