daily memorandum 2.3.0
CBUG | FreeBSD | Hiki | Knoppix | Mac | Ruby | W-ZERO3 | Windows | ad | amd64 | ks | linux | momonga | net | print | security | tdiary | unix | www | 会社 | 鯖缶 | 全学ゼミ | 本
2005-11-17 (Thu)
_ [security] sudo から interactive shell が実行できないようにするには
% sudo tcsh
とか
% sudo -s
で interactive shell を実行されてしまうと、 何が実行されたか syslog に残らなくてイヤンなので、 sudoers にこんなこと書いて制限かけてみる:
Cmnd_Alias SHELLS = /bin/sh, /bin/csh, /bin/tcsh, /usr/local/bin/bash
Cmnd_Alias SHELLS_NONINTERACTIVE = /bin/sh -c *, /bin/csh -c *, \
/bin/tcsh -c *, /usr/local/bin/bash -c *
koma2 ALL=(root) ALL, !SHELLS, SHELLS_NONINTERACTIVE
この時、ALL, !SHELLS, SHELLS_NONINTERACTIVE は この順番でないといけないので注意。
- まず、すべてのコマンドを許可
- shell を不許可に
- ただし、-c つきの場合は許可
って感じで解釈されるみたい。
これでどうしても interactive shell が使いたいって人が出たら、 sudosh を入れて許可してもいいかも。
[TrackBack URL: http://bloghome.lovepeers.org/daymemo2/tb.cgi/20051117]
本日のリンク元
アンテナ
- CBUGのCってなんだろうアンテナ ×27 : 26, 1
- 偽善者あんてな ×25 : 17, 6, 2
- halchan's Antenna ×14
- Motoyuki's Diary Links ×12
- Momonga Members Links ×5
- 二度寝アンテナ ×4
- http://www.bloglines.com/myblogs_display?sub=18926... ×2
- としをアンテナ ×2
- http://a.hatena.ne.jp/ttamo/ ×1
- http://www.bloglines.com/myblogs_display?sub=23529... ×1
- http://www.bloglines.com/myblogs_display?all=1 ×1
- http://www.bloglines.com/myblogs_display?folder=15... ×1
- youheのアンテナ ×1
- http://www.bloglines.com/myblogs_display?sub=12154... ×1
- http://www.bloglines.com/myblogs_display?sub=83427... ×1
- 狩野宏樹のアンテナ(試用中) ×1
- http://a.hatena.ne.jp/gunshot/ ×1
- http://www.bloglines.com/myblogs_display?sub=79894... ×1
- http://www.bloglines.com/myblogs_display?sub=10879... ×1
- http://www.bloglines.com/myblogs_display?folder=10... ×1
- http://www.bloglines.com/myblogs_display?sub=11193... ×1
- http://t.ngram.org/a/index.html ×1
その他のリンク元
- http://www.pochi.cc/~sasaki/chalow/ ×11
- http://feedbringer.net/feed ×7
- http://www.pochi.cc/~sasaki/chalow/2005-11-18-5.ht... ×6
- http://www.zuvat.com/web/?p=8&s=tokyo porn ×4
- http://www.plazoo.com/es/search_es/sex.htm ×4
- http://search.live.com/results.aspx?q=shell&form=Q... ×3
- http://masq.cocolog-nifty.com/imasugu/2005/08/post... ×3
- http://b.hatena.ne.jp/yass/sudo/ ×3
- http://search.live.com/results.aspx?q=shell ×3
- http://xrl.us/3pz4 ×3
- http://search.live.com/results.aspx?q=shell&mrt=en... ×2
- http://www.plazoo.com/ru/search_es/porn.htm ×2
- http://www.pochi.cc/~sasaki/chalow/cat_computer-9.... ×2
- http://reader.livedoor.com/reader/ ×2
- http://www.plazoo.com/en/default.asp?q=sex&fc=&s=r... ×2
- http://www.pochi.cc/~sasaki/chalow/index.html ×2
- http://www.pochi.cc/~sasaki/chalow/cat_computer-19... ×1
- http://www.rambler.ru/srch?words=/var was not prop... ×1
- http://southbeach-diets.blogspot.com/ ×1
- http://gree.jp/?mode=blog&act=view_per_month&user_... ×1
- http://www.denis.com ×1
- http://www.pop-wd.com/pop/iwork 使い方/ ×1
- http://wrs.search.yahoo.co.jp/S=2114736003/K=JAPAN... ×1
- http://www.pochi.cc/~sasaki/chalow/cat_computer-35... ×1
- http:// ×1
- http://shiro.pochi.cc/~sasaki/chalow/cat_computer-... ×1
- http://www.pochi.cc/~sasaki/chalow/cat_computer-16... ×1
- http://xrl.us/3pz2 ×1
- http://b.hatena.ne.jp/yass/security/ ×1
- http://www.zuvat.com/web/?p=6&s=tokyo porn ×1
- http://wrs.search.yahoo.co.jp/S=2114736003/K=pussy... ×1
- http://www.outfoxer.com/ ×1
- http://www.rambler.ru/srch?oe=1251&words=sudo bash... ×1
- http://bloghome.lovepeers.org/daymemo2?date=200511... ×1
- http://bloglines.com/myblogs_display?sub=18729563&... ×1
- http://wrs.search.yahoo.co.jp/S=2114736003/K=pussy... ×1
- http://bloglines.com/myblogs_display?sub=13157245&... ×1
- http://wrs.search.yahoo.co.jp/S=2114736003/K=japan... ×1
検索
- japanese pussy ×21 / japanese porno ×20 / porno sex ×18 / teens from tokyo ×12 / peeing 写真 ×11 / pussy japanese ×10 / 胸もみインタビュー ×8 / 胸もみ インタビュー ×8 / squirting ×7 / sex porno ×6 / Pantyhose Sex ×5 / japan schoolgirl sex ×4 / big tit ×4 / adult pussy ×4 / teens from tokyo.com ×3 / キーワード不明 ×3 / hairy japanese teens ×3 / recoverdisk ×3 / Pussy,Sex ×3 / bash portupgrade ×3 / japanese teens pussy ×3 / pussy teens ×2 / japanese teens hairy pussy ×2 / sexy pussy ×2 / teens from tokyo ×2 / FreeBSD topless ×2 / FreeBSD 6.0 ×2 / pussy clits ×2 / porno core ×2 / pussy japan ×2 / PORNO ×2 / japanese sexy pussy ×2 / pussy sex ×2 / japanese-sex GALLERY ×2 / schoolgirls ×2 / bbs.zgsm.com/bbs.php?bbs=/ ×2 / pussy porno ×2 / hairly girl japan ×2 / peeing ×2 / schg.schoolgirls ×2 / japanese pussy sex ×2 / peeing girl ×2 / adult-pussy ×2 / free japanese sex gallery ×2 / Japanese Teen ×2 / porno core porn ×2 / Japanese Pussy ×2 / japan sexy schoolgirl ×2 / Japanese hairy pussy ×2 / adult sex porno ×2 / teens pussy ×2 / japanese hairy girl ×2 / tokyo zoosex.com ×2 / teens porno ×2 / japanese teens porno ×2 / tokyo topless ×2 / openssh restricted shell ×1 / ntbackup どうよ ×1 / hiki.conf UTF-8 ×1 / Bourne Shell windows ×1 / firefox テーマ arin ×1 / restricted bash ×1 / "| sudo -S" interactive ×1 / "sudo -s" sudoers ×1 / "Linux ipv6設定" ×1 / パスワード変更 12154 ×1 / freebsd 5.4 read_dma error ×1 / 同一サーバで複数のHikiを運営する方法 ×1 / cups-PDF ×1 / chatzilla つながらない ×1 / zoosex ×1 / sudo "/bin/bash -c" ×1 / error=40<UNCORRECTABLE> ×1 / sudo bash ×1 / SHELLS_NONINTERACTIVE ×1 / wnn8 FreeBSD 動かす ×1 / pdksh restricted shell ×1 / restrictedモード ksh ×1 / "linux+ ipv6 設定" ×1 / sudo tcsh ×1 / ircII 使い方 ×1 / sudosh tcsh ×1 / csh ×1 / OpenBSD dell sc430 ×1 / OpenSSH パスワード変更 ×1 / xterm ports CONFLICTS ×1 / "d_type" "d_name" ×1 / !SHELLS, SHELLS_NONINTERACTIVE, ×1 / sudo csh Unix ×1 / restricted shell hp ×1 / cups pdf 日本語 xpdfrc ×1 / input/output-error シリアル ×1 / pmset + openbsd ×1 / tcsh restricted ×1 / /mnt was not properly dismounted' ×1 / spam filter BSD ×1 / postfix 452 Insufficient system storage ×1 / koma2@lovepeers.org ×1 / sudo +shell +実行を制限 ×1 / freebsd 6.2 source コマンド ×1

% sudo bash -c /bin/sh とかされたら抜けられそうな気がするんですけど、大丈夫なんですか?
もちろん、大丈夫なわけないですがな。(爆)
ってか、やっぱ穴があったか。(苦笑)
・ Bourne shell の syntax が使える
・ interactive shell としては使えない
・ 呼び出せるコマンドが制限できる
restricted shell があるといいのだがなぁ。。。
env PATH=/var/restricted /bin/bash --restricted -c *
とかではどうなんでしょう。
/var/restricted に必要最低限のコマンドだけ
ln -s しておくんです。
手元にある OpenBSD pdksh では
ksh -r -c /bin/sh は (絶対 path なので) ちゃんと不許可です。