35
TOMOYO TOMOYO ® ® Linux Linux : : A A Practical Practical Method to Method to Understand Understand and and Protect Protect Your Own Linux Box Your Own Linux Box Nov. 29, 2007 Nov. 29, 2007 Toshiharu Harada Toshiharu Harada <[email protected]> <[email protected]> Research and Development Headquarters Research and Development Headquarters NTT DATA CORPORATION NTT DATA CORPORATION

PacSec2007: TOMOYO Linux: A Practical Method to Understand and Protect Your Own Linux Box

Embed Size (px)

DESCRIPTION

PacSec 2007 presentation

Citation preview

  • 1.TOMOYO Linux:A Practical Method to Understand and ProtectYour Own Linux BoxNov. 29, 2007Toshiharu Harada Research and Development Headquarters NTT DATA CORPORATION

2. OutlineLooking Back Linux SecurityWhat is TOMOYO LinuxHow TOMOYO Linux Compares to Other? 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 1 3. Incidents OccurLets dig it to see how it could happen:1.shell code is caused by2.buffer overflow attack is caused by3.vulnerability is caused by4.human err *THE END* (cant digfurther)So, no one can stop incidents. 2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION 2 4. What human can do isLimiting the extent of damage.How? Brightest invention of Mandatory Access Control It has become available to even Open Source Software including Linux and other mainstream OSes.Problem still remains Managing proper policies is not easy. 2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION 3 5. Why Managing Policy is Such Difficult? Because Its in the bottom layer (kernel), not in the human understandable layer. Programmers have to understand about the complexities that are usually encapsulated by libraries and middleware. The differences of manners between Linux kernel and Human understandings.Human and Linux Boxes can live without policies. 2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION4 6. Two Approaches Towards the Single Goal Goal To obtain the appropriate policies.Approaches Catering vs. DIY Catering means:Someone cooks and deliver dishes. Users (you!) just eat their dishes. DIY meanscook by yourself and eat by yourself In other words:Professional vs. Amateur2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION 5 7. Time to Introduce the PlayersProfessional team: SELinux by NSA Users are suppose to apply professionally ready made policies.Amateur team: TOMOYO Linux automatic policy learning mode is available.Somewhere in-between: AppArmor (formerly known as SubDomain)Promising rookie: Smack (Simplified Mandatory Access Control Kernel)2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION6 8. At a Glance Comparisonhttp://tomoyo.sourceforge.jp/wiki-e/?WhatIs#comparison(live complicated table with useful links) 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 7 9. What Item is Important?In my humble view: Whether you like professional security way of thinking or not Your DIY spirit (or Your love for your Linux box) Number of the Linux boxes you need to manage Functional requirements (this is the easier part)If you need more, probably SELinux is the best. Please be advised to read the policies beforeyou make decisions. If you dont like/understand policies, you should not choose it. Using secure OS is managing its policies. (by ME) 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION8 10. Professional PolicyQuote from LKML ever lasting AppArmors threadSELinux expert, Kyle Moffet wrote: Average users are not supposed to be writing security policy. To be honest, even average-level system administrators should not be writing security policy. It's OK for such sysadmins to tweak existing policy to give access to additional web-docs or such, but only expert sysadmin/developers or security professionals should be writing security policy. It's just too damn easy to get completely wrong.http://lkml.org/lkml/fancy/2007/5/28/359Having a SELinux is a glory, but if you use it today,you will need some hustle. If you can bare it,SELinux should be the first secure Linux for you. 2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION9 11. OutlineLooking Back Linux SecurityWhat is TOMOYO LinuxHow TOMOYO Linux Compares to Other? 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 10 12. MotivationQuestions Who knows best about your Linux box? Who is responsible for your Linux box?I assume Its YOU, isnt it?You might not be a professional securityarchitect or a SELinux guru, but you can be anexpert of YOUR own Linux box.So, we are developing DIY tool for you. That isTOMOYO Linux.2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 11 13. Lets Go Back to the NeedsThe title of this presentation is TOMOYOLinux: A Practical Method to Understand andProtect Your Own Linux Box.Why to protect? (protect from what?) Malicious attacks. Operations by mistake. Your wife to skim your secret data. 2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION 12 14. Defining a GoalProtect is OK, but why Understandproceeds?Because you need to understand your Linux boxto protect it. 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 13 15. Defining a Goal What am I suppose to understand about myLinux box? I know its running 2.6.23 kerneland its Ubuntu 7.10. Isnt that enough?No.Example?Can you tell how a gnome-terminal process is invokedand what a gnome-terminal process does?2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 14 16. Defining a GoalYou might say, Im totally not interested insuch things. WHY DO I NEED TO KNOWTHEM? (calm down, please )You need to know them to tell your Linux boxthose accesses are needed. Thats the waysecurity policy works. Im sorry, but this is the truth. You can never protect unless you understand what you want to protect. (Theres a professional security model exists, though) 2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION15 17. Defining a GoalYou might say, I want to protect my Linux box, but I dont want to spend time to analyze my Linux box and write down policy myself.Congratulations!TOMOYO Linux is just for you. 2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION 16 18. Lets seeHow the gnome-terminal process is kicked.What the gnome-terminal process accesses. With TOMOYO Linux Yes. You can.I will demonstrate now. 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 17 19. How gnome-terminal was execed 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 18 20. What *THIS* gnome-terminal accesses? 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 19 21. How Did I Get?Just copied and pasted the output of TOMOYOLinux policy editor.TOMOYO Linux policy editor Displays the domains (domain transition tree) Displays the result of access occurred for each domainWant to see it?2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION 20 22. How Did I Get? 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 21 23. So what?With TOMOYO Linux and without anypreparations and hustle you can see how the processes are generated and what they do (access). you can distinguish processes by their call chains, not by the name of the program. if you know the correct call chains, then you can detect and exclude incorrect accesses.Thats what title of this presentation means,Understand and Protect 2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION22 24. OutlineLooking Back Linux SecurityWhat is TOMOYO LinuxHow TOMOYO Linux Compares to Other? 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 23 25. 1-2-3 You Are All SetInvoke policy editor program 1) Choose the domain you want to protect 2) Enter s key to change the mode for the selected domain 3) Input the profile number you chooseProfile /etc/ccs/profile.conf (text file) You can define the MAC functions as you need 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION24 26. Where is the profile #? 2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION 25 27. Lets Restrict a Shell 2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION 26 28. Lets Restrict a Shell 2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION 27 29. See it again? 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 28 30. OutlineLooking Back Linux SecurityWhat is TOMOYO LinuxHow TOMOYO Linux Compares to Other? 2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 29 31. Comparison with - SELinuxSELinux Overview in tree security enhancement Fine grained yet flexible MAC engine with full functionalities of Multi-Level Security, Multi- Category Security and Role Based Access Control. Based on the concept of Security should be designed by professionals. -> reference policy Well designed and supported by the wizards.2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 30 32. Comparison with - SELinuxShould be ideal solution for Linux users*if*: reference policy definition is finished. administrators are freed from label management tasks.Per domain permissive mode is a missingpeace. (Enforcing/Permissive mode is asystem global attribute)2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 31 33. Comparison with - AppArmorAppArmor Overview formerly known as SubDomain. same pathname based MAC (we are brothers) domain is per program while TOMOYO Linux domain is process invocation tree. aims to confine specified programs and is not intended to protect the whole system.2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION 32 34. SELinux, AppArmor, TOMOYO LinuxAll does MAC per domaindomain differs significantly: SELinuxDomains are pre-defined in the policyNo hierarchy for domain. Domains are flat AppArmor (profile)Domains correspond to programs, such as ApacheDomains are pre-defined in the policyNo hierarchy for domain. TOMOYO LinuxDomains are automatically defined and managed by the kernelDomain is process invocation history (or call chain)2007-11-29 PacSec 2007 Copyright(c) 2007 NTT DATA CORPORATION33 35. With TOMOYO Linux/bin/sh with different process invocationhistory are treated totally different domainIts done by the TOMOYO Linux kernel, so youdont have to define in advanceDomain name is literally its process invocationhistory (no learning is needed) 2007-11-29 PacSec 2007Copyright(c) 2007 NTT DATA CORPORATION 34