Solaris 10 Security
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table of Contents
|
|
|
The Solaris 10 Operating System (OS) contains a number of breakthrough technologies for security enhancements and this guide will deal with three of them in particular:
These three tools can work together to allow system administrators to secure and consolidate multiple functions or applications together on a system, without the need to change or modify existing application code.
This guide combines existing material for a unique solution to a common problem facing enterprises today: Web page hijacking. Malicious modification or hijackingof Web pages typically occurs when a vulnerability in a Web server application is exploited by hackers. Such vulnerabilities often allow the hacker to upload new Web pages, gain super-user shell access to a system or otherwise modify the pages that are being serviced by the Web server process. This guide shows how this issue can be easily solved without the need for costly additional software or specially modified applications.
Figure 1 is a diagram of the example configuration built in the course of this guide using Solaris 10 Operating System (OS) security features. It features a simple system with two network interfaces. One interface (bge1) is connected to a company's intranet/LAN and the other (bge0) is connected to the public Internet through a firewall or other means. The system is running the Solaris 10 OS and is configured with two Containers. One Container, the Data Container, has write access to the HTML files and is connected only to the intranet/LAN. The other Container, the Web Container, is running the Web server process itself with a reduced set of privileges. The Web Container has read-only access to the HTML files served by the Data Container.
To create a secure Web server you need to use several of Solaris' newer security features that are reviewed in the following sections.
Solaris User Rights Management and Process Rights Management offer fine-grained privileges in the kernel and user access space of Solaris. The practical benefit of these technologies is the elimination of the need for applications or users to have unlimited access to the system in order to perform their duties. The kernel itself in Solaris 10 checks only for Process Rights Management attributes, not 'root' or super-user access. This guide utilizes Process Rights Management to run the Apache2 Web server from a non-super-user account and with just one special privilege (net_privaddr) to dramatically reduce or eliminate the risk normally associated with Web servers on Unix systems.
Solaris Service Manager ProfilesSolaris Service Manager is a new feature introduced in Solaris 10 that starts long-running processes (also referred to as services), monitors their status and automatically restarts services as needed. The Service Manager works with the Solaris Fault Manager to isolate and report hardware and software errors and provide graceful shutdown of services, hardware components and dependant processes. It is part of the Solaris Predictive Self-Healing functionality and is designed to aid in system administration and diagnosability.
This guide uses the Service Manager's capability to specify run-time attributes with a service, such as the privileges and userid a service runs as, to put constraints on the execution of the Apache2 Web server. This guide also uses the Service Manager's profile capability to limit what network services are running in the Web and Data Containers.
Solaris ContainersSolaris Containers are a new virtualization and security isolation technology in Solaris 10 that allows customers to securely host multiple applications on the same system. Containers make use of zones(5), privileges(5) and resource management technologies to create a secure, isolated, virtual environment. This guide uses Solaris Containers to create an isolated environment for the Apache2 Web server to run in and a separate isolated environment from which Web pages are maintained. By doing this, administration of the Web server and maintenance of the Web pages are isolated from each other. Solaris Containers also allow for audit file entries to be stored 'outside' the Container in the Global Zone, which prevents attackers from erasing the audit trail should they successfully break into a Container.
To build a secured system which will offer Web services, you will need to perform the following steps:
The following four sections describe each of these steps in detail, with examples. For simplicity, assume that all commands are run as the 'root' user or another role that has appropriate authorization. Creation of such a role is outside the scope of this guide.
The Data Container in this example has the following characteristics:
This guide utilizes a unique capability of Solaris Containers to share common directories using different mount point names and different write permissions on these mount points. To clarify, Figure 2 shows how the common /shared directory is mounted in the Web and Data Containers and what write policy is used.
To create a Data Container with these characteristics, perform the following steps:
# mkdir /shared
# mkdir /shared/data
# mkdir /shared/config
# mkdir /shared/logs
# mkdir /shared/run
# chown -R webservd:webservd /shared/run
# chown -R webservd:webservd /shared/logs
# mkdir /shared/data/run
# cp -R /etc/apache2/* /shared/config
# cp -R /var/apache2/* /shared/data
# mkdir /zones
# zonecfg -z datazone
datazone: No such zone configured Use 'create' to begin configuring a new zone.
zonecfg:datazone> create
zonecfg:datazone> set zonepath=/zones/datazone
zonecfg:datazone> set autoboot=true
zonecfg:datazone> add fs
zonecfg:datazone:fs> set dir=/shared
zonecfg:datazone:fs> set special=/shared
zonecfg:datazone:fs> set options=[rw,nodevices,noexec,nosuid]
zonecfg:datazone:fs> set type=lofs
zonecfg:datazone:fs> end
zonecfg:datazone> add fs
zonecfg:datazone:fs> set dir=/shared/run
zonecfg:datazone:fs> set special=/shared/run
zonecfg:datazone:fs> set options=[ro,nodevices,noexec,nosuid]
zonecfg:datazone:fs> set type=lofs
zonecfg:datazone:fs> end
zonecfg:datazone> add fs
zonecfg:datazone:fs> set dir=/shared/logs
zonecfg:datazone:fs> set special=/shared/logs
zonecfg:datazone:fs> set options=[ro,nodevices,noexec,nosuid]
zonecfg:datazone:fs> set type=lofs
zonecfg:datazone:fs> end
zonecfg:datazone> add net
zonecfg:datazone:net> set address=10.0.0.200
zonecfg:datazone:net> set physical=bge1
zonecfg:datazone:net> end
zonecfg:datazone> add attr
zonecfg:datazone:attr> set name=comment
zonecfg:datazone:attr> set type=string
zonecfg:datazone:attr> set value="Data Container"
zonecfg:datazone:attr> end
zonecfg:datazone> verify
zonecfg:datazone> commit
zonecfg:datazone> exit
# zoneadm -z datazone install
Preparing to install zone .
Creating list of files to copy from the global zone.
[Some output was omitted here for brevity]
# zoneadm -z datazone boot
# zoneadm list -c -v
ID NAME
STATUS
PATH
0
global
running
/
1
datazone
running /zones/datazone
# zlogin -C datazone
SunOS Release 5.10 Version Generic_118822-22 64-bit
Copyright 1983-2005 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Hostname: datazone
[Some output was omitted here for brevity]
datazone console login:
(Press ~. to disconnect from the console session)
(logout)
Creating a Container for the Web server is almost identical to the process for creating the Data Container. The only differences are:
To create the Web Container, perform the following steps:
# zonecfg -z webzone
webzone: No such zone configured Use 'create' to begin configuring a new zone.
zonecfg:webzone> create
zonecfg:webzone> set zonepath=/zones/webzone
zonecfg:webzone> set autoboot=true
zonecfg:webzone> add fs
zonecfg:webzone:fs> set dir=/etc/apache2
zonecfg:webzone:fs> set special=/shared/config
zonecfg:webzone:fs> set options=[ro,nodevices,nosuid,noexec]
zonecfg:webzone:fs> set type=lofs
zonecfg:webzone:fs> end
zonecfg:webzone> add fs
zonecfg:webzone:fs> set dir=/var/apache2
zonecfg:webzone:fs> set special=/shared/data
zonecfg:webzone:fs> set options=[ro,nodevices,nosuid,noexec]
zonecfg:webzone:fs> set type=lofs
zonecfg:webzone:fs> end
zonecfg:webzone> add fs
zonecfg:webzone:fs> set dir=/var/apache2/logs
zonecfg:webzone:fs> set special=/shared/logs
zonecfg:webzone:fs> set options=[rw,nodevices,nosuid,noexec]
zonecfg:webzone:fs> set type=lofs
zonecfg:webzone:fs> end
zonecfg:webzone> add fs
zonecfg:webzone:fs> set dir=/var/apache2/run
zonecfg:webzone:fs> set special=/shared/run
zonecfg:webzone:fs> set options=[rw,nodevices,nosuid,noexec]
zonecfg:webzone:fs> set type=lofs
zonecfg:webzone:fs> end
zonecfg:webzone> add net
zonecfg:webzone:net> set address=129.152.1.200
zonecfg:webzone:net> set physical=bge0
zonecfg:webzone:net> end
zonecfg:webzone> add attr
zonecfg:webzone:attr> set name=comment
zonecfg:webzone:attr> set type=string
zonecfg:webzone:attr> set value="Web Container"
zonecfg:webzone:attr> end
zonecfg:webzone> verify
zonecfg:webzone> commit
zonecfg:webzone> exit
# zoneadm -z webzone install
Preparing to install zone <webzone>.
Creating list of files to copy from the global zone.
[Some output was omitted here for brevity]
# zoneadm -z webzone boot
# zoneadm list -c -v
ID NAME
STATUS
PATH
0
global
running
/
1
datazone
running /zones/datazone
2
webzone
running /zones/webzone
# zlogin -C webzone
SunOS Release 5.10 Version Generic_118822-22 64-bit
Copyright 1983-2005 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Hostname: webzone
[Some output was omitted here for brevity]
webzone console login:
(Press ~. to disconnect from the consoles session)
(logout)
To reduce the network services exposed to possible attack, use the profile capability of the Solaris Service Manager. In this example you will change the default services profile by loading the Generic Limited Networking profile. This profile minimizes the set of network services in each Container. However, the Generic Limited Networking profile is not the only method you can use to secure your system. There may be additional services that you wish to stop or disable. You may use the Services Manager svcadm(1M) command to disable services on a per-Container basis, or you may utilize the Solaris Security Toolkit.
Use of the Solaris Security Toolkit is not covered in this guide, please see the reference material.
# zlogin webzone
[Some output was omitted here for brevity]
webzone console login: root
Password: <enter password here>
# cd /var/svc/profile
# rm generic.xml
# ln -s generic_limited_net.xml generic.xml
# svccfg apply /var/svc/profile/generic_limited_net.xml
# exit
# zlogin datazone
[Some output was omitted here for brevity]
datazone console login: root
Password: <enter password here>
# cd /var/svc/profile
# rm generic.xml
# ln -s generic_limited_net.xml generic.xml
# svccfg apply /var/svc/profile/generic_limited_net.xml
# exit
Now that the default services profile has been changed, each of the Containers will run with a reduced set of network services. Each Container can have its own unique services profile, so system administrators can selectively enable services such as FTP for the Data Container while allowing only ssh(1) access for the Web Container.
Next, modify the Apache2 configuration file to use the new directories. This allows the Apache2 server to have write access for logging and PID information. Also, use the Service Manager to modify the privileges that the Apache2 Web server receives. Here is an outline of the steps required:
It's worth noting that these extra steps are taken to further harden and reduce the risk of intrusion with the Apache2 Web service only within the Web Container. The services used in the Data Container already run with reduced privileges set as their default behavior in the Solaris 10 OS.
# vi /shared/config/httpd.conf
[Some output was omitted here for brevity]
LockFile /var/apache2/logs/accept.lock
[Some output was omitted here for brevity]
PidFile /var/apache2/run/httpd.pid
[Some output was omitted here for brevity]
# zlogin webzone
[Some output was omitted here for brevity]
webzone console login: root
webzone console login: <password here>
webzone >
# svccfg -s apache2
svc:/network/http:apache2> setprop start/user = astring: webservd
svc:/network/http:apache2> setprop start/group = astring: webservd
svc:/network/http:apache2> setprop start/privileges = astring:
basic,!proc_session,!proc_info,!file_link_any,net_privaddr
svc:/network/http:apache2> setprop start/limit_privileges = astring: :default
svc:/network/http:apache2> setprop start/use_profile = boolean: false
svc:/network/http:apache2> setprop start/supp_groups = astring: :default
svc:/network/http:apache2> setprop start/working_directory = astring: :default
svc:/network/http:apache2> setprop start/project = astring: :default
svc:/network/http:apache2> setprop start/resource_pool = astring: :default
svc:/network/http:apache2> end
# svcadm -v refresh apache2
# svcadm -v enable -s apache2
svc:/network/http:apache2 enabled.
# svcs apache2
STATE STIME FMRI
online 12:02:21 svc:/network/http:apache2
# ps -aef | grep httpd | grep -v grep
webservd 5568 5559 0 12:02:22 ? 0:00 /usr/apache2/bin/httpd -k start
webservd 5567 5559 0 12:02:22 ? 0:00 /usr/apache2/bin/httpd -k start
webservd 5561 5559 0 12:02:22 ? 0:00 /usr/apache2/bin/httpd -k start
webservd 5562 5559 0 12:02:22 ? 0:00 /usr/apache2/bin/httpd -k start
webservd 5563 5559 0 12:02:22 ? 0:00 /usr/apache2/bin/httpd -k start
webservd 5559 23382 0 12:02:21 ? 0:00 /usr/apache2/bin/httpd -k start
# ppriv -S 5559 #This is the starting process
5559: /usr/apache2/bin/httpd -k start
flags = <none>
E: net_privaddr,proc_exec,proc_fork
I: net_privaddr,proc_exec,proc_fork
P: net_privaddr,proc_exec,proc_fork
L: zone
At this point, the Apache2 Web server is running inside of its own Web Container, with reduced exposure on the network and with reduced privileges. It is also serving HTML files to which it has read only access. If the Web server is attacked or compromised, the HTML data files to which it is providing access cannot be damaged because of the security constraints placed by Process Rights Management and Solaris Containers.
To verify configuration, connect to the Web server's IP address from your desktop session with a Web browser. You should see the Apache2 Documentation page.
For command-line verification, you can also use the 'telnet 129.152.1.200 80' command to connect to the Web server port and enter 'HEAD / HTTP/1.0', which will return the default Apache2 Web page.
For further verification, connect from a system on the private/LAN network and modify an HTML page. You will notice that your Web server has immediate access to that modified Web page. Remember that Web page authors will modify the content in the /shared/data directory while logged into the Data Container. The Web server Container will see these changes automatically because it mounts the exact same directory as /var/apache2.
As with any complex system, there are a variety of areas for enhancement in a sample configuration such as this. Additional topics include:
See the For More Information section for details on how to implement these enhancements.
This guide has explored combining various technologies to address the common issue of Web server security and Web page defacement. Because of the advances in Solaris 10 OS security, system administrators have new possibilities open to them to solve problems that previously would have taken many more systems, complex add-on products, changes in networking topology or other such compromises. Explore additional Sun documentation and articles for more ideas on how to use the Solaris 10 OS to creatively solve your business and security issues.
|
||||||||||||||||||||||||||||||||||||||||||||||||