Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Secure your Web server

Tom Syroid (dwcomments@syroidmanor.com), Staff writer, Studio B Productions
Tom Syroid is a contract writer for Studio B Productions, a literary agency based in Indianapolis, IN specializing in computer-oriented publications. Specialties include *NIX system security, Samba, Apache, and Web database applications based on PHP and MySQL. He has experience administering and maintaining a diverse range of operating systems including Linux (Red Hat, OpenLinux, Mandrake, Slackware, Gentoo), Windows (95, 98, NT, 2000, and XP), and AIX (4.3.3 and 5.1). He is also the co-author of Outlook 2000 in a Nutshell (O'Reilly & Associates). Tom lives in Saskatoon, Saskatchewan with his wife and two children. Hobbies include breaking perfectly good computer installations and then figuring out how to fix them, gardening, reading, and building complex structures out of Lego with his kids.

Summary:  Secure a Web server against unauthorized access. This tutorial covers physical security, the importance of firewalls, correct application installation, file permissions, application configuration, and techniques that allow Web page maintainers to do their job without sacrificing system integrity.

Date:  23 Jul 2002
Level:  Intermediate PDF:  A4 and Letter (82 KB | 24 pages)Get Adobe® Reader®

Activity:  6703 views
Comments:  

Introduction

Tutorial roadmap

Properly securing a Web server entails walking a fine line between accessibility and system security. A Web server, by its very nature, needs to be accessible to the "outside world." But the Internet can be a rough and tumble place. Viruses are rampant; hackers are constantly looking for ways to break into systems and use them for their own means; and "script kiddies" find amusement in defacing prominent Web sites. So system administrators must balance accessibility with system security.

This tutorial addresses this balancing act by examining the following three topic areas:

  • Web server security: Understanding the httpd.conf file and its access directives.
  • Authentication options: Using basic and digest authentication to control user access.
  • Jailing your users: How to create a chroot environment for your Web server.

Upon completion of this tutorial you will understand both the whys of Web server security and the how-tos of tightening and/or closing potential security holes.


Tutorial background

Examples and code listings used throughout this tutorial are based on the latest stable release of the 1.3.x series Apache Web server (which at the time of this writing is 1.3.26). All material discussed is also directly applicable to IBM WebSphere, as it is a derivative of the Apache codebase and employs the same program structure and configuration files. File locations may differ according to how your Web server was compiled, what modules were included in the configuration, etc.

In addition, this tutorial is based on a default "Server" installation of Red Hat 7.3. Again, file locations and initialization techniques may differ across distributions, but the underlying principles discussed apply to all *NIX-based systems running a Web server.

The material presented assumes you have a basic understanding of *NIX administration including user and group UIDs, user file permissions, program installation and maintenance, and editing configuration files. If you want to follow along with the examples provided, you'll need access to a system with an existing Apache installation or a system with enough disk space to install Apache on.

This tutorial also assumes you have secured your production system adequately, meaning, it's behind a well-configured firewall, system user permissions are in order, your Web server of choice is installed correctly, and filesystem permissions -- as a whole -- are in order. The Further resources section at the end of this tutorial lists several books on the topic of general system security.

One important issue this tutorial does not address due to space constraints is the topic of securing dynamic content (Common Gateway Interface, or CGI content, embedded scripting languages such as PHP, wrappers such as suEXEC, etc.). All Web server administrators need to be aware of the dangers inherent in all dynamic content, and the methods available to prevent their misuse. A good resource to check out is www.cgisecurity.com.

Questions, comments, and errata submissions are welcome; you can either e-mail the author directly (dwcomments@syroidmanor.com ) or use the rating form at the end of the tutorial.


General security considerations

The following points are general security issues and considerations all system administrators should be aware of, especially on "front-line" production machines like a publicly accessible Web server:

  • Log files are an administrator's best friend. Make a habit of scanning them for system or user irregularities on a routine basis. Ideally, log files should be sent to a separate system devoted to this one purpose. Doing so ensures that no one but an authorized administrator can view or tamper with these important files.

  • Backups are a crucial component of any comprehensive security strategy. Make sure you have current system backups for all key systems on your network and that the backups can be restored without error.

  • As noted in the previous section, Tutorial background, security begins at the physical level and moves outward in ever-increasing circles. Production servers should be physically secured in a locked room, and stringent password policies enforced. Non-essential services on the server should be turned off, and properly-configured network access control lists (ACLs) should be in place.

  • Apache, by default, runs all child processes as user nobody (the main process controlling the child processes is under root control). All system services accessible to the public should ideally be run under a unique user ID to enforce complete separation between services. For example, Apache's webuser and webgroup directives (found in the httpd.conf configuration file) should be set to a unique user/group such as www/www.

  • Finally, administrators should routinely scour their systems for files that are unnecessarily setuid and/or setgid. ( find / -type f -a \( -perm -4000 -o -perm -2000 \) -print ).

1 of 7 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Tivoli, Web development
ArticleID=136051
TutorialTitle=Secure your Web server
publish-date=07232002
author1-email=dwcomments@syroidmanor.com
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.