6 smrsh - restricted shell for sendmail
8 S
\bSY
\bYN
\bNO
\bOP
\bPS
\bSI
\bIS
\bS
9 s
\bsm
\bmr
\brs
\bsh
\bh -
\b-c
\bc command
11 D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
12 The _
\bs_
\bm_
\br_
\bs_
\bh program is intended as a replacement for _
\bs_
\bh for use in the
13 ``prog'' mailer in _
\bs_
\be_
\bn_
\bd_
\bm_
\ba_
\bi_
\bl(8) configuration files. It sharply limits
14 the commands that can be run using the ``|program'' syntax of _
\bs_
\be_
\bn_
\bd_
\bm_
\ba_
\bi_
\bl
15 in order to improve the over all security of your system. Briefly,
16 even if a ``bad guy'' can get sendmail to run a program without going
17 through an alias or forward file, _
\bs_
\bm_
\br_
\bs_
\bh limits the set of programs that
18 he or she can execute.
20 Briefly, _
\bs_
\bm_
\br_
\bs_
\bh limits programs to be in a single directory, by default
21 /usr/adm/sm.bin, allowing the system administrator to choose the set of
22 acceptable commands, and to the shell builtin commands ``exec'',
23 ``exit'', and ``echo''. It also rejects any commands with the charac-
24 ters ``', `<', `>', `;', `$', `(', `)', `\r' (carriage return), or `\n'
25 (newline) on the command line to prevent ``end run'' attacks. It
26 allows ``||'' and ``&&'' to enable commands like: ``"|exec
27 /usr/local/bin/filter || exit 75"''
29 Initial pathnames on programs are stripped, so forwarding to
30 ``/usr/ucb/vacation'', ``/usr/bin/vacation'',
31 ``/home/server/mydir/bin/vacation'', and ``vacation'' all actually for-
32 ward to ``/usr/adm/sm.bin/vacation''.
34 System administrators should be conservative about populating the
35 sm.bin directory. For example, a reasonable additions is _
\bv_
\ba_
\bc_
\ba_
\bt_
\bi_
\bo_
\bn(1),
36 and the like. No matter how brow-beaten you may be, never include any
37 shell or shell-like program (such as _
\bp_
\be_
\br_
\bl(1)) in the sm.bin directory.
38 Note that this does not restrict the use of shell or perl scripts in
39 the sm.bin directory (using the ``#!'' syntax); it simply disallows
40 execution of arbitrary programs. Also, including mail filtering pro-
41 grams such as _
\bp_
\br_
\bo_
\bc_
\bm_
\ba_
\bi_
\bl(1) is a very bad idea. _
\bp_
\br_
\bo_
\bc_
\bm_
\ba_
\bi_
\bl(1) allows users
42 to run arbitrary programs in their _
\bp_
\br_
\bo_
\bc_
\bm_
\ba_
\bi_
\bl_
\br_
\bc(5).
44 C
\bCO
\bOM
\bMP
\bPI
\bIL
\bLA
\bAT
\bTI
\bIO
\bON
\bN
45 Compilation should be trivial on most systems. You may need to use
46 -DSMRSH_PATH=\"_
\bp_
\ba_
\bt_
\bh\" to adjust the default search path (defaults to
47 ``/bin:/usr/bin:/usr/ucb'') and/or -DSMRSH_CMDDIR=\"_
\bd_
\bi_
\br\" to change the
48 default program directory (defaults to ``/usr/adm/sm.bin'').
51 /usr/adm/sm.bin - default directory for restricted programs on most OSs
53 /var/adm/sm.bin - directory for restricted programs on HP UX and
56 /usr/libexec/sm.bin - directory for restricted programs on FreeBSD (>=
57 3.3) and DragonFly BSD
60 S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
65 $Date: 2004/08/06 03:55:35 $ SMRSH(8)