SMRSH(8) SMRSH(8) 名称 smrsh - sendmail用に制限されたシェル 書式 smrsh -c command 解説 smrsh は、 sendmail(8) の設定ファイルで、 sh の代わりに ‘‘prog’’ メーラ として使用する事を目的としています。 smrsh は、システムの全体的なセキュ リ ティを改善するために、 sendmail の ‘‘|program’’ 書式により起動する事 ができるコマンドを制限します。つまり、もし ‘‘悪者’’ が alias ファイルや forward ファイルを経由せずに sendmail からプログラムを実行する事ができ たとしても、 smrsh を使えば、彼(あるいは彼女)が実行できるプログラムを制 限する事ができるのです。 簡単に言うと、 smrsh は、実行可能なプログラムを単一のディレクトリに存在 するものと、シェル組み込みコマンドの ‘‘exec’’, ‘‘exit’’, ‘‘echo’’ だ け に 限 定します。このディレクトリは、デフォルトでは、/usr/libexec/sm.bin です。これにより、システム管理者は利用可能なコマンドを選択する事がで き ま す。更に、 smrsh は、‘‘end run’’ 攻撃を防ぐために、コマンド行に ‘`’, ‘<’, ‘>’, ‘;’, ‘$’, ‘(’, ‘)’, ‘\r’ (復改文字), ‘\n’ (改行文字) の文字を 含 むコマンドは実行しません。 ‘‘||’’ と ‘‘&&’’ は、許可されており、次の ようなコマンドを使用可能 で す: ‘‘"|exec /usr/local/bin/procmail -f- /etc/procmailrcs/user || exit 75"’’ プ ロ グラム名の前にあるパス名は全て取り除かれるため、 ‘‘/usr/bin/vaca- tion’’, ‘‘/home/server/mydir/bin/vacation’’, ‘‘vacation’’ など は 全 て ‘‘/usr/libexec/sm.bin/vacation’’ と解釈されます。 シ ステム管理者は、 sm.bin ディレクトリに置くプログラムを選ぶ際には慎重 な判断をすべきです。適切な物としては、 vacation(1) や procmail(1) な ど があげられるでしょう。いかなる要望があっても、シェルや、 perl(1) などの シェルに似たプログラムを sm.bin に入れてはいけません。これは、単に任 意 のプログラムを実行する事を制限するだけで、 ‘‘#!’’書式を用いた、シェルス クリプトや perl スクリプトを sm.bin ディレクトリに入れる事を制限する 訳 ではありません。 コンパイル コ ンパイルはほとんどのシステムでつまらないものです。デフォルトのサーチ パス (デフォ ル ト で は‘‘/bin:/usr/bin’’) を 変 更 す る た め に は 、-DPATH=\"path\" を使用する必要があり、また、デフォルトのプログラムデ ィレクトリ (デフォルトでは ‘‘/usr/libexec/sm.bin’’) を変更するために は 、-DCMDBIN=\"dir\" を使用する必要があります。 関連ファイル /usr/libexec/sm.bin - 制限されたプログラム用のディレクトリ 関連項目 sendmail(8) 1Date: 2000/12/15 19:50:46 1 SMRSH(8)
SMRSH(8) SMRSH(8) NAME smrsh - restricted shell for sendmail SYNOPSIS smrsh -c command DESCRIPTION The smrsh program is intended as a replacement for sh for use in the ‘‘prog’’ mailer in sendmail(8) configuration files. It sharply limits the commands that can be run using the ‘‘|program’’ syntax of sendmail in order to improve the over all security of your system. Briefly, even if a ‘‘bad guy’’ can get sendmail to run a program without going through an alias or forward file, smrsh limits the set of programs that he or she can execute. Briefly, smrsh limits programs to be in a single directory, by default /etc/smrsh, allowing the system administrator to choose the set of acceptable commands, and to the shell builtin commands ‘‘exec’’, ‘‘exit’’, and ‘‘echo’’. It also rejects any commands with the charac- ters ‘`’, ‘<’, ‘>’, ‘;’, ‘$’, ‘(’, ‘)’, ‘\r’ (carriage return), or ‘\n’ (newline) on the command line to prevent ‘‘end run’’ attacks. It allows ‘‘||’’ and ‘‘&&’’ to enable commands like: ‘‘"|exec /usr/local/bin/filter || exit 75"’’ Initial pathnames on programs are stripped, so forwarding to ‘‘/usr/ucb/vacation’’, ‘‘/usr/bin/vacation’’, ‘‘/home/server/mydir/bin/vacation’’, and ‘‘vacation’’ all actually for- ward to ‘‘/etc/smrsh/vacation’’. System administrators should be conservative about populating the /etc/smrsh directory. For example, a reasonable additions is vaca- tion(1), and the like. 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 that this does not restrict the use of shell or perl scripts in the sm.bin directory (using the ‘‘#!’’ syn- tax); it simply disallows execution of arbitrary programs. Also, including mail filtering programs such as procmail(1) is a very bad idea. procmail(1) allows users to run arbitrary programs in their procmailrc(5). FILES /etc/smrsh - directory for restricted programs SEE ALSO sendmail(8) $Date: 2004/08/06 03:55:35 $ SMRSH(8)
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa