ルギア君の戯言

雑多な記事。

Canna

なんで Canna が起動しないかわかった。

[root@lugia-castle ~]# strace /usr/sbin/cannaserver -u bin
(中略)
close(3)                                = 0                                                                                              
munmap(0xb801e000, 4096)                = 0                                                                                              
umask(0)                                = 022                                                                                            
mkdir("/var/run/.iroha_unix", 0777)     = -1 EEXIST (File exists)                                                                        
socket(PF_FILE, SOCK_STREAM, 0)         = 3                                                                                              
bind(3, {sa_family=AF_FILE, path="/var/run/.iroha_unix/IROHA"...}, 110) = -1 EACCES (Permission denied)                                  
close(3)                                = 0                                                                                              
umask(022)                              = 0                                                                                              
write(2, "\n"..., 1
)                    = 1
write(2, "ERROR:\n "..., 8ERROR:
 )             = 8
write(2, "  Another 'cannaserver' is detect"..., 37  Another 'cannaserver' is detected.
) = 37
write(2, "   If 'cannaserver' is not runnin"..., 36   If 'cannaserver' is not running,
) = 36
write(2, "   \"/var/run/.iroha_unix/IROHA\" m"..., 57   "/var/run/.iroha_unix/IROHA" may remain accidentally.
) = 57
write(2, "   So, after making sure that 'ca"..., 60   So, after making sure that 'cannaserver' is not running.
) = 60
write(2, "   Please execute following comma"..., 37   Please execute following command.
) = 37
write(2, "\n"..., 1
)                    = 1
write(2, "               rm /var/run/.iroha"..., 45               rm /var/run/.iroha_unix/IROHA
) = 45
write(2, "\n"..., 1
)                    = 1
munmap(0xb7fcb000, 188416)              = 0
exit_group(2)                           = ?

これを読むと

/var/run/.iroha_unix/IROHA

が存在するかどうか Permission エラーにより確認できないということでした。

[root@lugia-castle ~]# cd /var/run
[root@lugia-castle run]# ls -la                                                                                                       
total 248                                                                                                                             
drwxr-xr-x 25 root       root        4096 Oct  4 09:50 .                                                                              
drwxr-xr-x 22 root       root        4096 Oct  3 16:14 ..                                                                             
drwxr-xr-x  2 root       root        4096 Sep 24 03:34 .iroha_unix
(後略)

まあ、こうなってりゃ起動しないのも当然ですよね・・・


対処法としては、

# chown bin.root .iroha_unix

とするか、

# chmod g+w .iroha_unix

するかすればいいのではないでしょうか。


どちらの方がセキュリティ的に有利かはわかりません。


・・・chown すれば(chmod では駄目だった)

# sh /etc/init.d/canna start

は動くようになった。


あとは SELinux か。

[root@lugia-castle ~]# audit2allow < /var/log/audit/audit.log


#============= canna_t ==============
allow canna_t rpm_var_lib_t:dir search;

#============= setroubleshootd_t ==============
allow setroubleshootd_t lib_t:dir write;

これを追加すれば(setroubleshootd は canna には関係ないが)

# service canna start

も動く。


ただ、うごくだけで、ローマ字変換も、かな漢字変換も失敗する(笑)