]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - smrsh/smrsh.0
Import sendmail 8.16.1
[FreeBSD/FreeBSD.git] / smrsh / smrsh.0
1 SMRSH(8)                                                              SMRSH(8)
2
3
4
5 \e[1mNAME\e[0m
6        smrsh - restricted shell for sendmail
7
8 \e[1mSYNOPSIS\e[0m
9        \e[1msmrsh -c \e[22mcommand
10
11 \e[1mDESCRIPTION\e[0m
12        The  \e[4msmrsh\e[24m  program  is intended as a replacement for \e[4msh\e[24m for use in the
13        ``prog'' mailer in \e[4msendmail\e[24m(8) configuration files.  It sharply  limits
14        the  commands that can be run using the ``|program'' syntax of \e[4msendmail\e[0m
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, \e[4msmrsh\e[24m limits the set of programs that
18        he or she can execute.
19
20        Briefly,  \e[4msmrsh\e[24m 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"''
28
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''.
33
34        System  administrators  should  be  conservative  about  populating the
35        sm.bin directory.  For example, a reasonable additions is  \e[4mvacation\e[24m(1),
36        and  the like.  No matter how brow-beaten you may be, never include any
37        shell or shell-like program (such as \e[4mperl\e[24m(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 \e[4mprocmail\e[24m(1) is a very bad idea.  \e[4mprocmail\e[24m(1) allows users
42        to run arbitrary programs in their \e[4mprocmailrc\e[24m(5).
43
44 \e[1mCOMPILATION\e[0m
45        Compilation  should  be  trivial  on most systems.  You may need to use
46        -DSMRSH_PATH=\"\e[4mpath\e[24m\" to adjust the default search  path  (defaults  to
47        ``/bin:/usr/bin:/usr/ucb'') and/or -DSMRSH_CMDDIR=\"\e[4mdir\e[24m\" to change the
48        default program directory (defaults to ``/usr/adm/sm.bin'').
49
50 \e[1mFILES\e[0m
51        /usr/adm/sm.bin - default directory for restricted programs on most OSs
52
53        /var/adm/sm.bin  -  directory  for  restricted  programs  on  HP UX and
54        Solaris
55
56        /usr/libexec/sm.bin - directory for restricted programs on FreeBSD  (>=
57        3.3) and DragonFly BSD
58
59
60 \e[1mSEE ALSO\e[0m
61        sendmail(8)
62
63
64
65                          $Date: 2013-11-22 20:52:00 $                 SMRSH(8)