Debian Codegraph @

upstream/opensuse-tumbleweed/man8/smrsh.8

raw
1 .\" Copyright (c) 1998-2004 Proofpoint, Inc. and its suppliers.
2 .\" All rights reserved.
3 .\" Copyright (c) 1993 Eric P. Allman. All rights reserved.
4 .\" Copyright (c) 1993
5 .\" The Regents of the University of California. All rights reserved.
6 .\"
7 .\" By using this file, you agree to the terms and conditions set
8 .\" forth in the LICENSE file which can be found at the top level of
9 .\" the sendmail distribution.
10 .\"
11 .\"
12 .\" $Id: smrsh.8,v 8.23 2013-11-22 20:52:00 ca Exp $
13 .\"
14 .TH SMRSH 8 "$Date: 2013-11-22 20:52:00 $"
15 .SH NAME
16 smrsh \- restricted shell for sendmail
17 .SH SYNOPSIS
18 .B smrsh
19 .B \-c
20 command
21 .SH DESCRIPTION
22 The
23 .I smrsh
24 program is intended as a replacement for
25 .I sh
26 for use in the ``prog'' mailer in
27 .IR sendmail (8)
28 configuration files.
29 It sharply limits the commands that can be run using the
30 ``|program'' syntax of
31 .I sendmail
32 in order to improve the over all security of your system.
33 Briefly, even if a ``bad guy'' can get sendmail to run a program
34 without going through an alias or forward file,
35 .I smrsh
36 limits the set of programs that he or she can execute.
37 .PP
38 Briefly,
39 .I smrsh
40 limits programs to be in a single directory,
41 by default
42 /usr/lib/sendmail.d/bin/
43 allowing the system administrator to choose the set of acceptable commands,
44 and to the shell builtin commands ``exec'', ``exit'', and ``echo''.
45 It also rejects any commands with the characters
46 `\`', `<', `>', `;', `$', `(', `)', `\er' (carriage return),
47 or `\en' (newline)
48 on the command line to prevent ``end run'' attacks.
49 It allows ``||'' and ``&&'' to enable commands like:
50 ``"|exec /usr/local/bin/filter || exit 75"''
51 .PP
52 Initial pathnames on programs are stripped,
53 so forwarding to ``/usr/bin/vacation'',
54 ``/usr/bin/vacation'',
55 ``/home/server/mydir/bin/vacation'',
56 and
57 ``vacation''
58 all actually forward to
59 `/usr/lib/sendmail.d/bin/vacation''.
60 .PP
61 System administrators should be conservative about populating
62 the
63 /usr/lib/sendmail.d/bin/
64 directory.
65 For example, a reasonable additions is
66 .IR vacation (1),
67 and the like.
68 No matter how brow-beaten you may be,
69 never include any shell or shell-like program
70 (such as
71 .IR perl (1))
72 in the
73 /usr/lib/sendmail.d/bin/
74 directory.
75 Note that this does not restrict the use of shell or perl scripts
76 in the /usr/lib/sendmail.d/bin/ directory (using the ``#!'' syntax);
77 it simply disallows execution of arbitrary programs.
78 Also, including mail filtering programs such as
79 .IR procmail (1)
80 is a very bad idea.
81 .IR procmail (1)
82 allows users to run arbitrary programs in their
83 .IR procmailrc (5).
84 .SH COMPILATION
85 Compilation should be trivial on most systems.
86 You may need to use \-DSMRSH_PATH=\e"\fIpath\fP\e"
87 to adjust the default search path
88 (defaults to ``/bin:/usr/bin'')
89 and/or \-DSMRSH_CMDDIR=\e"\fIdir\fP\e"
90 to change the default program directory
91 (defaults to ``/usr/lib/sendmail.d/bin/'').
92 .SH FILES
93 /usr/lib/sendmail.d/bin/ \- default directory for restricted programs on SuSE Linux
94 .SH SEE ALSO
95 sendmail(8)