### LiteSpeed Web Server Users' Manual

##### Version 5.0 Rev. 1

- License Std / Ent
- Introduction
- Installation
- Administration
  - Service Manager
- Security
- Configuration
  - Server General
  - Server Tuning
  - Server Security
  - Request Filter
  - Page Cache
  - External Apps
  - Fast CGI App
  - Fast CGI Authorizer
  - LSAPI App
  - Servlet Engine
  - Web Server
  - Pipped logger
  - Load Balancer
  - Script Handler
  - Rack/Rails Settings
  - Listeners
  - Templates
  - Virtual Host Basic
  - Virtual Host General
  - Virtual Host Security
  - Rewrite
  - Context
  - Static Context
  - Java Web App Context
  - Servlet Context
  - Fast CGI Context
  - LSAPI Context
  - Proxy Context
  - CGI Context
  - Load Balancer Context
  - Redirect Context
  - Rack/Rails Context
  - Web Socket Proxy
  - Add-ons
  - Admin Server
  - Admin Listeners

# Security

LiteSpeed Web Server is designed with security as a top consideration. LSWS supports SSL, has access control at server and virtual host levels, and context-specific realm protection. Besides these standard features, LSWS also has the following special security features:

1. ### Connection level limits:

   - IP-level throttling limits network bandwidth to and from a single IP address regardless of the number of connections.
   - IP-level connection accounting limits the number of concurrent connections from a single IP address. You can controll this with the connection soft limit, connection hard limit, grace period, and banned period settings in the WebAdmin console.

2. ### Request checking:

   Every HTTP request is vetted by LiteSpeed Web Server. "/." is not allowed in a decoded URL, thus denying accessing hidden files and parent directories.

   Request size is limited by LiteSpeed Web Server's max request URL length, max request header length, and max request body length settings.

3. ### Request filtering:

   Request header and body can be checked against possible attack signatures. This helps defend against XSS attacks and SQL injection attacks, blocking those requests right from the start.

4. ### Static file checking:

   LiteSpeed Web Server will serve a static file only if the following conditions are satisfied:

   - The file is readable by everyone.
   - The file is not executable.
   - The file is not in the access denied directory list.
   - The file does not contain symbolic link if symbolic links are not allowed.
   - By default, LiteSpeed Web Server does not index a directory by listing its files, it has to be enabled explicitly.

5. ### External application firewall:

   LiteSpeed Web Server forwards requests to external applications to process/generate dynamic content. Those applications can use a lot of system resources. The performance of the whole system will be severely degraded when system resource consumption reaches a certain point -- when swapping space has to be used, for example. One way to conduct a DoS attack is to flood the web server with concurrent requests to a cumbersome external application.

   LiteSpeed Web Server can pipeline requests and control the concurrent level of external application use to prevent overconsumption of system resources. LSWS caches requests and only forwards completed requests to the external application. This means the external application will not be held waiting while the server is receiving the request. LSWS also caches the external application's response so that the external application can be released as soon as the response is completed and does not have to wait for the client to receive the complete response. This way the server can utilize fewer external application instances to serve more concurrent requests and achieve higher performance and scalability. LiteSpeed Web Server also uses its own virtual memory to cache the request and response body to minimize the usage of system memory without sacrificing performance.

6. ### CGI resources consumption limit:

   LiteSpeed Web Server restricts the amount of system resources that can be consumed by CGI applications. For each request to a CGI script, the web server needs to start a standalone CGI process to handle it. On a Unix system, the number of concurrent processes is limited. With the CGI resources consumption limit, you can configure the maximum number of concurrent CGI instances that the web server can launch. Excessive concurrent processes will degrade the performance of the whole system. (CGI processes are a common weapon for DoS attacks.) A system process limit can be specified per user in order to control the number of processes that can be spawned by a CGI application. Each process is further confined by CPU and memory limits.

7. ### Enhanced CGI/FastCGI security with suEXEC:

   In order to reduce the security risks of a CGI or Fast CGI script, LiteSpeed Web Server can restrict the system resources the CGI script can access by running it in "suEXEC" or "chroot jail" mode. "suEXEC" starts the CGI or Fast CGI script with a different user ID from that of the web server. This greatly improves security in shared hosting environment by preventing one user's CGI script from accessing other users' files.

   "chroot jail" starts the CGI script under an assigned alternative root directory. The script can not access files beyond this new root directory. With this, you no longer need to worry about confidential system files being exposed by vulnerable scripts.

8. ### Run LSWS in chroot jail [Enterprise Edition Only]:

   LiteSpeed Web Server can run in a chroot environment (known as a chroot jail). In the chroot environment, the web server and its child processes cannot access files outside of the chroot jail. This protects the system from attacks by malicious code.