CentOSに環境構築したRedmineをSELinux有効(Enforcing)で動かしたい!!
調べてみた。
参考)
SELinuxが有効な環境でRedmineを動作させる設定
SELinuxが有効な状態でRedmineを動かす
ポリシーモジュールの管理に必要になるパッケージをインストール
1 |
[root@localhost ~]# yum install policycoreutils-python |
yを押下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
================================================================================ Package Arch Version Repository Size ================================================================================ Installing: policycoreutils-python x86_64 2.0.83-29.el6 base 437 k Installing for dependencies: audit-libs-python x86_64 2.4.5-3.el6 base 63 k libcgroup x86_64 0.40.rc1-18.el6_8 updates 130 k libsemanage-python x86_64 2.0.43-5.1.el6 base 81 k setools-libs x86_64 3.3.7-4.el6 base 400 k setools-libs-python x86_64 3.3.7-4.el6 base 222 k Updating for dependencies: audit x86_64 2.4.5-3.el6 base 214 k audit-libs x86_64 2.4.5-3.el6 base 74 k libsemanage x86_64 2.0.43-5.1.el6 base 104 k policycoreutils x86_64 2.0.83-29.el6 base 663 k Transaction Summary ================================================================================ Install 6 Package(s) Upgrade 4 Package(s) Total download size: 2.3 M Is this ok [y/N]: |
インストールが完了しました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
Verifying : libcgroup-0.40.rc1-18.el6_8.x86_64 7/14 Verifying : audit-libs-2.4.5-3.el6.x86_64 8/14 Verifying : audit-libs-python-2.4.5-3.el6.x86_64 9/14 Verifying : setools-libs-3.3.7-4.el6.x86_64 10/14 Verifying : libsemanage-2.0.43-4.2.el6.x86_64 11/14 Verifying : audit-2.3.7-5.el6.x86_64 12/14 Verifying : policycoreutils-2.0.83-19.47.el6_6.1.x86_64 13/14 Verifying : audit-libs-2.3.7-5.el6.x86_64 14/14 Installed: policycoreutils-python.x86_64 0:2.0.83-29.el6 Dependency Installed: audit-libs-python.x86_64 0:2.4.5-3.el6 libcgroup.x86_64 0:0.40.rc1-18.el6_8 libsemanage-python.x86_64 0:2.0.43-5.1.el6 setools-libs.x86_64 0:3.3.7-4.el6 setools-libs-python.x86_64 0:3.3.7-4.el6 Dependency Updated: audit.x86_64 0:2.4.5-3.el6 audit-libs.x86_64 0:2.4.5-3.el6 libsemanage.x86_64 0:2.0.43-5.1.el6 policycoreutils.x86_64 0:2.0.83-29.el6 Complete! |
SELinuxの監査ログから不要な情報を全て削除。
1 2 3 4 5 6 |
[root@localhost ~]# cd /var/log/audit/ [root@localhost audit]# ls audit.log [root@localhost audit]# rm /var/log/audit/audit.log rm: remove regular file `/var/log/audit/audit.log'? y [root@localhost audit]# |
ポリシーモジュールの管理のサービスを再起動
1 2 3 |
[root@localhost audit]# service auditd restart auditd を停止中: [ OK ] auditd を起動中: [ OK ] |
SELinuxをPermissiveモードに設定し、httpdを再起動
1 2 3 4 |
[root@localhost audit]# setenforce 0 [root@localhost audit]# service httpd restart httpd を停止中: [ OK ] httpd を起動中: [ OK ] |
Redmineにアクセスして、全てのページ操作や保存処理を行う。
SELinuxにて監視ログがたまるらしい。
監視ログからポリシーモジュールを作成
1 2 3 4 5 6 7 |
[root@localhost audit]# grep httpd /var/log/audit/audit.log | audit2allow -M passenger ******************** IMPORTANT *********************** To make this policy package active, execute: semodule -i passenger.pp [root@localhost audit]# |
1 |
[root@localhost audit]# semodule -i passenger.pp |
SELinuxを有効にし、Apacheを再起動します。
1 2 3 4 5 6 |
[root@localhost audit]# setenforce 1 [root@localhost audit]# service httpd restart httpd を停止中: [ OK ] httpd を起動中: [ OK ] [root@localhost audit]# getenforce Enforcing |
できた!!!☆☆