「SELinux を Ubuntu にインストールする」の版間の差分
提供: セキュリティ
(ページの作成:「<!-- vim: filetype=mediawiki --> SELinux を Ubuntu にインストールします。 __TOC__ == 概要 == SELinux を Ubuntu にインストール...」) |
|||
(同じ利用者による、間の6版が非表示) | |||
行11: | 行11: | ||
== インストール == | == インストール == | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | % sudo apt-get install -y selinux-basics selinux-policy-default selinux-policy-dev selinux-policy-src selinux-utils | ||
+ | % sudo selinux-activate | ||
+ | % sudo shutdown -r now | ||
+ | % check-selinux-installation | ||
+ | % sudo apt install -y auditd | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | 下記の方法は、すでに古いです。selinux のパッケージは、なくなったようです。 | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
% sudo apt-get install selinux | % sudo apt-get install selinux | ||
行18: | 行27: | ||
== 使い方 == | == 使い方 == | ||
− | |||
[[SELinux]] をご参照ください。 | [[SELinux]] をご参照ください。 | ||
− | == | + | == selinux-activate の実行例 == |
+ | <syntaxhighlight lang="bash"> | ||
+ | kaworu@ubuntu:~$ sudo selinux-activate | ||
+ | Activating SE Linux | ||
+ | Sourcing file `/etc/default/grub' | ||
+ | Sourcing file `/etc/default/grub.d/init-select.cfg' | ||
+ | Generating grub configuration file ... | ||
+ | Found linux image: /boot/vmlinuz-5.0.0-25-generic | ||
+ | Found initrd image: /boot/initrd.img-5.0.0-25-generic | ||
+ | Found linux image: /boot/vmlinuz-5.0.0-20-generic | ||
+ | Found initrd image: /boot/initrd.img-5.0.0-20-generic | ||
+ | Found linux image: /boot/vmlinuz-5.0.0-17-generic | ||
+ | Found initrd image: /boot/initrd.img-5.0.0-17-generic | ||
+ | Found linux image: /boot/vmlinuz-5.0.0-16-generic | ||
+ | Found initrd image: /boot/initrd.img-5.0.0-16-generic | ||
+ | Found memtest86+ image: /boot/memtest86+.elf | ||
+ | Found memtest86+ image: /boot/memtest86+.bin | ||
+ | done | ||
+ | SE Linux is activated. You may need to reboot now. | ||
+ | </syntaxhighlight> | ||
+ | == ステータスの確認 == | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | kaworu@ubuntu:~$ sudo sestatus | ||
+ | SELinux status: enabled | ||
+ | SELinuxfs mount: /sys/fs/selinux | ||
+ | SELinux root directory: /etc/selinux | ||
+ | Loaded policy name: default | ||
+ | Current mode: permissive | ||
+ | Mode from config file: permissive | ||
+ | Policy MLS status: enabled | ||
+ | Policy deny_unknown status: allowed | ||
+ | Memory protection checking: requested (insecure) | ||
+ | Max kernel policy version: 31 | ||
+ | </syntaxhighlight> | ||
+ | == ブロックの確認 == | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | audit2why -al | ||
+ | </syntaxhighlight> | ||
+ | ausearch コマンドが内部で実行されるので、 auditd のパッケージが必要になります。 | ||
+ | == インストールされるファイル == | ||
+ | === selinux-basics === | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | kaworu@ubuntu:~$ sudo dpkg -L selinux-basics | ||
+ | /. | ||
+ | /usr | ||
+ | /usr/sbin | ||
+ | /usr/sbin/check-selinux-installation | ||
+ | /usr/sbin/postfix-nochroot | ||
+ | /usr/sbin/selinux-activate | ||
+ | /usr/sbin/selinux-config-enforcing | ||
+ | /usr/sbin/selinux-policy-upgrade | ||
+ | /usr/share | ||
+ | /usr/share/doc | ||
+ | /usr/share/doc/selinux-basics | ||
+ | /usr/share/doc/selinux-basics/README | ||
+ | /usr/share/doc/selinux-basics/changelog.gz | ||
+ | /usr/share/doc/selinux-basics/copyright | ||
+ | /usr/share/man | ||
+ | /usr/share/man/man8 | ||
+ | /usr/share/man/man8/check-selinux-installation.8.gz | ||
+ | /usr/share/man/man8/postfix-nochroot.8.gz | ||
+ | /usr/share/man/man8/selinux-config-enforcing.8.gz | ||
+ | /usr/share/man/man8/selinux-policy-upgrade.8.gz | ||
+ | /usr/share/python3 | ||
+ | /usr/share/python3/runtime.d | ||
+ | /usr/share/python3/runtime.d/selinux-basics.rtupdate | ||
+ | /usr/share/selinux-basics | ||
+ | /usr/share/selinux-basics/tests | ||
+ | /usr/share/selinux-basics/tests/00_selinuxenabled.py | ||
+ | /usr/share/selinux-basics/tests/01_verify_init.py | ||
+ | /usr/share/selinux-basics/tests/02_verify_slash_selinux.py | ||
+ | /usr/share/selinux-basics/tests/10_test_kernel_processes.py | ||
+ | /usr/share/selinux-basics/tests/20_old-style-ttys.py | ||
+ | /usr/share/selinux-basics/tests/21_pam.py | ||
+ | /usr/share/selinux-basics/tests/22_postfix.py | ||
+ | /usr/share/selinux-basics/tests/24_fsckfix.py | ||
+ | /usr/share/selinux-basics/tests/25_udev_relabel.py | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | == check-selinux-installation がエラーになる例 == | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | kaworu@ubuntu:~$ sudo check-selinux-installation | ||
+ | Traceback (most recent call last): | ||
+ | File "/usr/sbin/check-selinux-installation", line 33, in <module> | ||
+ | results += test.test() | ||
+ | File "/usr/share/selinux-basics/tests/24_fsckfix.py", line 24, in test | ||
+ | raise IOError("/etc/default/rcS not found, is this Debian?") | ||
+ | OSError: /etc/default/rcS not found, is this Debian? | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | 上記のエラーは、下記にレポートされているバグだと思われます。 | ||
+ | https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=860522 | ||
+ | |||
+ | == 関連項目 == | ||
* [[SELinux]] | * [[SELinux]] |
2019年8月16日 (金) 23:08時点における最新版
目次
概要
インストール
% sudo apt-get install -y selinux-basics selinux-policy-default selinux-policy-dev selinux-policy-src selinux-utils % sudo selinux-activate % sudo shutdown -r now % check-selinux-installation % sudo apt install -y auditd
下記の方法は、すでに古いです。selinux のパッケージは、なくなったようです。
% sudo apt-get install selinux % sudo shutdown -r now
使い方
SELinux をご参照ください。
selinux-activate の実行例
kaworu@ubuntu:~$ sudo selinux-activate Activating SE Linux Sourcing file `/etc/default/grub' Sourcing file `/etc/default/grub.d/init-select.cfg' Generating grub configuration file ... Found linux image: /boot/vmlinuz-5.0.0-25-generic Found initrd image: /boot/initrd.img-5.0.0-25-generic Found linux image: /boot/vmlinuz-5.0.0-20-generic Found initrd image: /boot/initrd.img-5.0.0-20-generic Found linux image: /boot/vmlinuz-5.0.0-17-generic Found initrd image: /boot/initrd.img-5.0.0-17-generic Found linux image: /boot/vmlinuz-5.0.0-16-generic Found initrd image: /boot/initrd.img-5.0.0-16-generic Found memtest86+ image: /boot/memtest86+.elf Found memtest86+ image: /boot/memtest86+.bin done SE Linux is activated. You may need to reboot now.
ステータスの確認
kaworu@ubuntu:~$ sudo sestatus SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: default Current mode: permissive Mode from config file: permissive Policy MLS status: enabled Policy deny_unknown status: allowed Memory protection checking: requested (insecure) Max kernel policy version: 31
ブロックの確認
audit2why -al
ausearch コマンドが内部で実行されるので、 auditd のパッケージが必要になります。
インストールされるファイル
selinux-basics
kaworu@ubuntu:~$ sudo dpkg -L selinux-basics /. /usr /usr/sbin /usr/sbin/check-selinux-installation /usr/sbin/postfix-nochroot /usr/sbin/selinux-activate /usr/sbin/selinux-config-enforcing /usr/sbin/selinux-policy-upgrade /usr/share /usr/share/doc /usr/share/doc/selinux-basics /usr/share/doc/selinux-basics/README /usr/share/doc/selinux-basics/changelog.gz /usr/share/doc/selinux-basics/copyright /usr/share/man /usr/share/man/man8 /usr/share/man/man8/check-selinux-installation.8.gz /usr/share/man/man8/postfix-nochroot.8.gz /usr/share/man/man8/selinux-config-enforcing.8.gz /usr/share/man/man8/selinux-policy-upgrade.8.gz /usr/share/python3 /usr/share/python3/runtime.d /usr/share/python3/runtime.d/selinux-basics.rtupdate /usr/share/selinux-basics /usr/share/selinux-basics/tests /usr/share/selinux-basics/tests/00_selinuxenabled.py /usr/share/selinux-basics/tests/01_verify_init.py /usr/share/selinux-basics/tests/02_verify_slash_selinux.py /usr/share/selinux-basics/tests/10_test_kernel_processes.py /usr/share/selinux-basics/tests/20_old-style-ttys.py /usr/share/selinux-basics/tests/21_pam.py /usr/share/selinux-basics/tests/22_postfix.py /usr/share/selinux-basics/tests/24_fsckfix.py /usr/share/selinux-basics/tests/25_udev_relabel.py
check-selinux-installation がエラーになる例
kaworu@ubuntu:~$ sudo check-selinux-installation Traceback (most recent call last): File "/usr/sbin/check-selinux-installation", line 33, in <module> results += test.test() File "/usr/share/selinux-basics/tests/24_fsckfix.py", line 24, in test raise IOError("/etc/default/rcS not found, is this Debian?") OSError: /etc/default/rcS not found, is this Debian?
上記のエラーは、下記にレポートされているバグだと思われます。 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=860522