強化されたGentoo:セットアップ

強化されたチューニングは、カーネルチューニングとロールチューニング(RBACまたはSELinux)の2つの部分で構成されています。 カーネル構成2.6.20の例を次に示します。 そして、RBAC / SELinuxをまだ構成していません。



make menuconfigで設定を確認するのが最も鮮明だと思います。これにより、PaXとGrSecurityの機能を「目で」評価することができます。



カーネルの異なるバージョン間では、わずかに異なりますが、大きくは異なりません。

PaX ---> . [*] Enable various PaX features ....... PaX Control ---> ......... [ ] Support soft mode ......... [*] Use legacy ELF header marking ......... [*] Use ELF program header marking ............. MAC system integration (none) ---> ....... Non-executable pages ---> ......... [*] Enforce non-executable pages ......... [*] . Segmentation based non-executable pages ......... [ ] Emulate trampolines ......... [*] Restrict mprotect() ......... [ ] . Disallow ELF text relocations ......... [ ] Enforce non-executable kernel pages ....... Address Space Layout Randomization ---> ......... [*] Address Space Layout Randomization ......... [*] . Randomize kernel stack base ......... [*] . Randomize user stack base ......... [*] . Randomize mmap() base ..... Miscellaneous hardening features ---> ....... [ ] Sanitize all freed memory ....... [*] Prevent invalid userland pointer dereference Grsecurity ---> . Security Level (Custom) ---> . Address Space Protection ---> ... [*] Deny writing to /dev/kmem, /dev/mem, and /dev/port ... [ ] Disable privileged I/O ... [*] Remove addresses from /proc/<pid>/[smaps|maps|stat] ... [*] Deter exploit bruteforcing ... [*] Runtime module disabling ... [*] Hide kernel symbols . Role Based Access Control Options ---> ... [*] Hide kernel processes ... (3) Maximum tries before password lockout ... (30) Time to wait after max password tries, in seconds . Filesystem Protections ---> ... [*] Proc restrictions ... [*] . Restrict /proc to user only ... [*] Additional restrictions ... [*] Linking restrictions ... [*] FIFO restrictions ... [*] Chroot jail restrictions ... [*] . Deny mounts ... [*] . Deny double-chroots ... [*] . Deny pivot_root in chroot ... [*] . Enforce chdir("/") on all chroots ... [*] . Deny (f)chmod +s ... [*] . Deny fchdir out of chroot ... [*] . Deny mknod ... [*] . Deny shmat() out of chroot ... [*] . Deny access to abstract AF_UNIX sockets out of chroot ... [*] . Protect outside processes ... [*] . Restrict priority changes ... [*] . Deny sysctl writes ... [*] . Capability restrictions . Kernel Auditing ---> ... [ ] Single group for auditing ... [ ] Exec logging ... [*] Resource logging ... [ ] Log execs within chroot ... [ ] Chdir logging ... [*] (Un)Mount logging ... [ ] IPC logging ... [*] Signal logging ... [*] Fork failure logging ... [ ] Time change logging ... [*] /proc/<pid>/ipaddr support ... [ ] ELF text relocations logging (READ HELP) . Executable Protections ---> ... [*] Enforce RLIMIT_NPROC on execs ... [*] Destroy unused shared memory ... [*] Dmesg(8) restriction ... [ ] Trusted Path Execution (TPE) . Network Protections ---> ... [*] Larger entropy pools ... [ ] Socket restrictions . Sysctl support ---> ... [*] Sysctl support ... [*] . Turn on features by default . Logging Options ---> ... (10) Seconds in between log messages (minimum) ... (4) Number of messages in a burst (maximum) [ ] Enable access key retention support [ ] Enable different security models
      
      





これらの機能の大部分は、ユーザーにとって透過的に機能します。 ただし、いくつか気付くことがあります。まず、一般ユーザーは他のユーザーのプロセスを見ることができなくなり、次に、/ proc /内の一部のファイルにアクセスできなくなります。これがifconfig、routeなどのコマンドの出力です。 通常のユーザーが起動することは、はるかに控えめになります。



これらの機能のほとんどはsysctlで管理できることに注意してください。 これは通常悪いことです。 しかし、良いことは、ハッカーがシステムを半分に壊し、sysctlを介してこれらの保護を無効にする機会を得てから、それを完全に破ることです。 幸いなことに、sysctlを使用してGrSecurity設定の変更をブロックすることができます。 これを行うには、/ etc / sysctl.confに追加します。

 kernel.grsecurity.disable_modules = 1 kernel.grsecurity.grsec_lock = 1
      
      





最初のコマンドがカーネルモジュールの読み込みを禁止している場合(サーバー上のカーネルにモジュールサポートを含めることは最善ではありませんが、これが不可能な場合は、システムの起動時に必要なモジュールを読み込み、kernel.grsecurity.disable_modulesでカーネルの読み込みを無効にする方法があります) -だれも誤ってルートキットをロードしないように:))、2番目はGrSecurity設定の変更を禁止します。



これの欠点は、モジュールをロードするか、GrSecurity機能の一部を無効にする必要がある場合(たとえば、新しいGentooを構築するためのchroot保護)、/ etc / sysctl.confを編集して再起動する必要があることです。



実際、これで設定は終わりました。



要約として、GentooをHardenedに変換するコマンドの完全なセットを提供します:

 emerge hardened-sources #     (    # hardened),     . ln -snf ../usr/portage/profiles/hardened/x86/2.6/ /etc/make.profile #      CFLAGS  /etc/make.conf #   -O2. # : CFLAGS="-march=pentium-m -O2 -pipe" #   $PKGDIR ( /usr/portage/packages/)  #      #  -b  -k  emerge. emerge -C linux-headers emerge linux-headers glibc binutils gcc-config gcc #    ,   #    gcc (. <a href="http://www.gentoo.org/doc/en/gcc-upgrading.xml">GCC Upgrade Guide</a>). emerge -b glibc binutils gcc portage emerge -bke system emerge -ke world glsa-check -l | grep '\[N\]' #   ,    glsa-check. emerge -a --depclean emerge -uDNa world emerge paxtest paxctl gradm revdep-rebuild dispatch-conf #       Hardened, #    .
      
      







スタート。 第二部。 エンディングが続きます...



All Articles