OpenBSD 5.8登場
2015年10月18日、
OpenBSD 5.
- sudo in base has been replaced with doas(1), sudo is available as a package.
(http:// www. より抜粋)openbsd. org/ 58. html
ユーザランドからsudo(8)を削除し、
# uname -a OpenBSD trybsd.ongs.co.jp 5.7 GENERIC#825 amd64 # which sudo /usr/bin/sudo # which doas which: doas: Command not found. #
# uname -a OpenBSD openbsd.ongs.co.jp 5.8 GENERIC#1170 amd64 # which sudo which: sudo: Command not found. # which doas /usr/bin/doas #
どういった経緯でsudo(8)が廃止され、
sudo(8)廃止とdoas(1)導入の経緯
doas(1)の開発はOpenBSDコミッタのTed Unangst氏が行っています。Ted Unangst氏が投函したとみられる記事
Ted Unangst氏はsudo(8)のデフォルト設定に関してある問題を感じていたとしています。まず、
- パーミッションやチェックなどを細かく実施し、
入念に考慮されたシステム管理インフラを構築したい - 追加でパスワードを覚えることなくrootのシェルが得られればよい
Ted Unangst氏は後者であるものの、
当初はこれは個人的な考えだからということでコミットすることはなかったといいますが、
- root権限で動作するにはsudo(1)はプログラムが大きすぎる。OpenBSDのベースシステムに導入されているsetuidされたプログラムと比較して5倍以上に大きい
- ベースシステムに導入するソフトウェアは多機能すぎるのはよくない
doas(1)は指定したコマンドを指定したユーザで実行するというシンプルな機能だけを提供しています。設定ファイルは/etc/
OpenBSD 5.8をセットアップ
OpenBSD 5.


OpenBSD 5.
# adduser Couldn't find /etc/adduser.conf: creating a new adduser configuration file Reading /etc/shells Enter your default shell: csh ksh nologin sh [ksh]: Your default shell is: ksh -> /bin/ksh Default login class: authpf bgpd daemon default pbuild staff unbound [default]: Enter your default HOME partition: [/home]: Copy dotfiles from: /etc/skel no [/etc/skel]: Send welcome message?: /path/file default no [no]: Do not send message(s) Prompt for passwords by default (y/n) [y]: Default encryption method for passwords: auto blowfish [auto]: Use option ``-silent'' if you don't want to see all warnings and questions. Reading /etc/shells Check /etc/master.passwd Check /etc/group Ok, let's go. Don't worry about mistakes. There will be a chance later to correct any input. Enter username []: daichi Enter full name []: Daichi GOTO Enter shell csh ksh nologin sh [ksh]: Uid [1000]: Login group daichi [daichi]: Login group is ``daichi''. Invite daichi into other groups: guest no [no]: wheel Login class authpf bgpd daemon default pbuild staff unbound [default]: Enter password []: Enter password again []: Name: daichi Password: **** Fullname: Daichi GOTO Uid: 1000 Gid: 1000 (daichi) Groups: daichi wheel Login Class: default HOME: /home/daichi Shell: /bin/ksh OK? (y/n) [y]: y Added user ``daichi'' Copy files from /etc/skel to /home/daichi Add another user? (y/n) [y]: n Goodbye! #
ユーザを追加するときのシェルがkshになっていますが、
# ls -il /bin/sh 51988 -r-xr-xr-x 3 root bin 479920 Aug 16 17:19 /bin/sh # ls -il /bin/ksh 51988 -r-xr-xr-x 3 root bin 479920 Aug 16 17:19 /bin/ksh #
OpenBSDにマージされているkshはパブリックドメインで提供されているkshです。kshはシェルスクリプト向けの/bin/
使ってみようdoas(1)
su(1)コマンドをパスワードの入力なく利用できるようにする設定は次のようになります。設定のサンプルやルールに関してはdoas.
permit nopass daichi as root cmd su
OpenBSD/amd64 (openbsd.ongs.co.jp) (tty00) login: daichi Password: Last login: Mon Oct 19 23:54:48 on tty00 OpenBSD 5.8 (GENERIC) #1170: Sun Aug 16 02:26:00 MDT 2015 Welcome to OpenBSD: The proactively secure Unix-like operating system. Please use the sendbug(1) utility to report bugs in the system. Before reporting a bug, please try to reproduce it with the latest version of the code. With bug reports, please try to ensure that enough information to reproduce the problem is enclosed, and if a known fix for it exists, include that as well. $ su -l Password: ← rootのパスワード入力求められる Sorry $ su -l Password: # exit $ doas su -l ← パスワード不要で実行可能 # exit $
ちょっと設定を変えて、
permit daichi as root cmd su
$ doas su -l Password: ← 自分のパスワード求められる #
doas(1)はパーサとヘッダを合わせてもソースコードが780行ほどしかありません。sudo(8)はCのコードとヘッダだけでも10,000行を超えていますので、
よりシンプルで安全なものをデフォルトに
doas(1)に限らず、
- セキュアとはいえないため、
自分達で開発した方がセキュアだと判断した - ソースコードが複雑になってきて見通しが悪くなったので、
よりシンプルなものを開発することにした - 利用しない不要な機能のソースコードなども含まれておりデフォルトでベースに入れることが適切とは言えなくなった
- BSDライセンスのもとで提供されていないので、
BSDライセンス版を開発することにした
OpenBSDプロジェクトで開発されるソフトウェアはFreeBSDやNetBSDにも移植されることも多いです。doas(1)は興味深いコマンドですし、