CentOS 6.4でSELinux上でRuby1.9.3p429+Passenger-4.05.+Remine2.3を動かしてみる
CentOS 6.4標準でのRuby1.8.7+Passenger-3.0.19では動作したので、yumでアンインストールしたのち、Ruby1.0.3-p429をtarボールからconfigure --prefix=/usr/localでコンパイル、インストールする。
全体のインストールは以下を参照した。
Redmineの実行方法、上記のブログの「パターン3: バーチャルホストでRedmineを実行」を選択した。
ただし、このままではSELinuxの制約のためPassengerのプロセスの起動に失敗する。
このため、Passengerのルートディレクトリ以下のディレクトリ、ファイルのタイプを変更し、ポリシーを追加する。
chcon -R -h -t httpd_sys_content_t /path/to/passenger/folder
追加したポリシー(ファイル名:passenger.te)は以下の通り
module passenger 1.0;
require {
type user_devpts_t;
type httpd_var_run_t;
type anon_inodefs_t;
type httpd_sys_script_t;
class process { getsession setpgid };
class chr_file { read write ioctl append };
class capability { setuid sys_resource dac_override sys_nice chown fsetid kill setgid fowner };
class file { setattr read create write getattr unlink open };
class sock_file { write getattr unlink create setattr };
class dir { remove_name rmdir };
}
#============= httpd_sys_script_t ==============
allow httpd_sys_script_t anon_inodefs_t:file { read write };
allow httpd_sys_script_t httpd_var_run_t:dir { remove_name rmdir };
allow httpd_sys_script_t httpd_var_run_t:file { write getattr setattr create unlink open };
allow httpd_sys_script_t httpd_var_run_t:sock_file { write getattr unlink create setattr };
allow httpd_sys_script_t self:capability { setuid sys_resource dac_override sys_nice chown fsetid kill setgid fowner };
allow httpd_sys_script_t self:process { getsession setpgid };
allow httpd_sys_script_t user_devpts_t:chr_file { read write ioctl append };
ポリシーをSELinuxに反映する。
semodule -i passenger.pp
SELinuxの設定に関しては、以下を参照した。
- CentOS6のApacheでRailsとPassengerをSELinux Enforcingで動かす - kame-tの日記
- Fedora 18: Redmine + mod_passenger + SELinux(単体起動するまで)のざっくりメモ - ishikawa84g's blog
- Redmine/PassengerをSELinux下で動かす
- SELinux 基本編 - とみぞーノート