2019-02-28 11:28:21 +03:00
|
|
|
.\" $NetBSD: bozohttpd.8,v 1.79 2019/02/28 08:28:21 mrg Exp $
|
2007-10-16 06:47:12 +04:00
|
|
|
.\"
|
2011-11-18 13:51:31 +04:00
|
|
|
.\" $eterna: bozohttpd.8,v 1.101 2011/11/18 01:25:11 mrg Exp $
|
2007-10-16 05:14:01 +04:00
|
|
|
.\"
|
2019-02-28 11:28:21 +03:00
|
|
|
.\" Copyright (c) 1997-2019 Matthew R. Green
|
2007-10-16 05:14:01 +04:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
2019-02-28 11:28:21 +03:00
|
|
|
.Dd February 27, 2019
|
2015-04-16 05:32:33 +03:00
|
|
|
.Dt BOZOHTTPD 8
|
2009-03-11 16:39:33 +03:00
|
|
|
.Os
|
2007-10-16 05:14:01 +04:00
|
|
|
.Sh NAME
|
2015-04-16 05:32:33 +03:00
|
|
|
.Nm bozohttpd
|
2007-10-16 05:14:01 +04:00
|
|
|
.Nd hyper text transfer protocol version 1.1 daemon
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2016-05-25 00:18:29 +03:00
|
|
|
.Op Fl EGHVXefhnsu
|
2007-10-16 05:14:01 +04:00
|
|
|
.Op Fl C Ar suffix cgihandler
|
2009-05-24 00:26:18 +04:00
|
|
|
.Op Fl I Ar port
|
2013-10-13 02:37:43 +04:00
|
|
|
.Op Fl L Ar prefix script
|
2009-05-24 00:26:18 +04:00
|
|
|
.Op Fl M Ar suffix type encoding encoding11
|
2011-03-29 11:22:31 +04:00
|
|
|
.Op Fl P Ar pidfile
|
2009-05-24 00:26:18 +04:00
|
|
|
.Op Fl S Ar server_software
|
2018-11-20 04:06:46 +03:00
|
|
|
.Op Fl T Ar type timeout
|
2015-11-29 18:29:55 +03:00
|
|
|
.Op Fl U Ar username
|
2011-11-18 13:51:31 +04:00
|
|
|
.Op Fl Z Ar cert privkey
|
|
|
|
.Op Fl c Ar cgibin
|
|
|
|
.Op Fl i Ar address
|
|
|
|
.Op Fl p Ar pubdir
|
2008-12-06 16:18:09 +03:00
|
|
|
.Op Fl t Ar chrootdir
|
2007-10-16 05:14:01 +04:00
|
|
|
.Op Fl v Ar virtualroot
|
|
|
|
.Op Fl x Ar index
|
2015-12-12 19:57:53 +03:00
|
|
|
.Op Fl z Ar ciphers
|
2007-10-16 05:14:01 +04:00
|
|
|
.Ar slashdir
|
|
|
|
.Op Ar myname
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
program reads a
|
|
|
|
.Em HTTP
|
|
|
|
request from the standard input, and sends a reply to the standard output.
|
|
|
|
Besides ~user translation and virtual hosting support (see below), all file
|
|
|
|
requests are from
|
|
|
|
.Ar slashdir
|
|
|
|
directory.
|
|
|
|
The server uses
|
|
|
|
.Ar myname
|
|
|
|
as its name, which defaults to the local hostname, obtained from
|
|
|
|
.Xr gethostname 3
|
|
|
|
(but see the
|
|
|
|
.Fl v
|
|
|
|
option for virtual hosting.)
|
|
|
|
.Nm
|
2010-06-22 09:24:12 +04:00
|
|
|
writes logs to
|
2010-06-22 11:00:12 +04:00
|
|
|
.Xr syslog 3
|
|
|
|
using the ftp facility (but see the
|
2010-06-22 09:24:12 +04:00
|
|
|
.Fl s
|
|
|
|
option for testing.)
|
|
|
|
.Nm
|
2007-10-16 05:14:01 +04:00
|
|
|
is designed to be small, simple and relatively featureless,
|
|
|
|
hopefully increasing its security.
|
2008-12-06 16:30:35 +03:00
|
|
|
.Ss OPTIONS
|
2007-10-16 05:14:01 +04:00
|
|
|
The following options are available:
|
|
|
|
.Bl -tag -width xxxcgibin
|
|
|
|
.It Fl b
|
2011-04-24 11:17:02 +04:00
|
|
|
Enables daemon mode, where
|
2007-10-16 05:14:01 +04:00
|
|
|
.Nm
|
|
|
|
detaches from the current terminal, running in the background and
|
|
|
|
servicing HTTP requests.
|
|
|
|
.It Fl C Ar suffix cgihandler
|
2011-04-24 11:17:02 +04:00
|
|
|
Adds a new CGI handler program for a particular file type.
|
2007-10-16 05:14:01 +04:00
|
|
|
The
|
|
|
|
.Ar suffix
|
|
|
|
should be any normal file suffix, and the
|
|
|
|
.Ar cgihandler
|
|
|
|
should be a full path to an interpreter.
|
|
|
|
This option is the only way to enable CGI programs that exist
|
|
|
|
outside of the cgibin directory to be executed.
|
|
|
|
Multiple
|
|
|
|
.Fl C
|
|
|
|
options may be passed.
|
|
|
|
.It Fl c Ar cgibin
|
2011-04-24 11:17:02 +04:00
|
|
|
Enables the CGI/1.1 interface.
|
2007-10-16 05:14:01 +04:00
|
|
|
The
|
|
|
|
.Ar cgibin
|
|
|
|
directory is expected to contain the CGI programs to be used.
|
|
|
|
.Nm
|
|
|
|
looks for URL's in the form of
|
2017-07-04 00:28:48 +03:00
|
|
|
.Em /cgi-bin/<scriptname>
|
2007-10-16 05:14:01 +04:00
|
|
|
where
|
2009-05-23 06:26:03 +04:00
|
|
|
.Aq scriptname
|
2007-10-16 05:14:01 +04:00
|
|
|
is a valid CGI program in the
|
|
|
|
.Ar cgibin
|
|
|
|
directory.
|
|
|
|
In other words, all CGI URL's must begin with
|
|
|
|
.Em \%/cgi-bin/ .
|
2015-10-28 12:20:15 +03:00
|
|
|
Note that the CGI/1.1 interface is available with
|
2007-10-16 05:14:01 +04:00
|
|
|
.Em ~user
|
2015-10-28 12:20:15 +03:00
|
|
|
translation using
|
|
|
|
.Fl E
|
|
|
|
switch.
|
2007-10-16 05:14:01 +04:00
|
|
|
.It Fl e
|
2011-04-24 11:17:02 +04:00
|
|
|
Causes
|
2007-10-16 05:14:01 +04:00
|
|
|
.Nm
|
|
|
|
to not clear the environment when used with either the
|
|
|
|
.Fl t
|
|
|
|
or
|
|
|
|
.Fl U
|
|
|
|
options.
|
2009-05-23 06:26:03 +04:00
|
|
|
.It Fl f
|
2011-04-24 11:17:02 +04:00
|
|
|
Stops the
|
2009-05-23 06:26:03 +04:00
|
|
|
.Fl b
|
|
|
|
flag from
|
|
|
|
.Nm
|
|
|
|
detaching from the tty and going into the background.
|
2016-05-25 00:18:29 +03:00
|
|
|
.It Fl G
|
|
|
|
Get the
|
|
|
|
.Nm
|
|
|
|
version string, print it on standard output, and exit.
|
2007-10-16 05:14:01 +04:00
|
|
|
.It Fl H
|
2011-04-24 11:17:02 +04:00
|
|
|
Causes directory index mode to hide files and directories
|
2007-10-16 05:14:01 +04:00
|
|
|
that start with a period, except for
|
|
|
|
.Pa .. .
|
|
|
|
Also see
|
|
|
|
.Fl X .
|
|
|
|
.It Fl I Ar port
|
2011-04-24 11:17:02 +04:00
|
|
|
Causes
|
2011-11-18 02:09:12 +04:00
|
|
|
.Nm
|
|
|
|
to use
|
2007-10-16 05:14:01 +04:00
|
|
|
.Ar port
|
2011-11-18 02:09:12 +04:00
|
|
|
instead of the default
|
2007-10-16 05:14:01 +04:00
|
|
|
.Dq http
|
|
|
|
port.
|
2011-11-18 02:09:12 +04:00
|
|
|
When used with the
|
2007-10-16 05:14:01 +04:00
|
|
|
.Fl b
|
2011-11-18 02:09:12 +04:00
|
|
|
option, it changes the bound port.
|
|
|
|
Otherwise it forces redirections to use this port instead of the
|
|
|
|
value obtained via
|
|
|
|
.Xr getsockname 2 .
|
2011-04-24 11:17:02 +04:00
|
|
|
.It Fl i Ar address
|
|
|
|
Causes
|
2007-10-16 05:14:01 +04:00
|
|
|
.Ar address
|
2012-12-05 02:42:14 +04:00
|
|
|
to be used as the address to bind daemon mode.
|
2007-10-16 05:14:01 +04:00
|
|
|
If otherwise unspecified, the address used to bind is derived from the
|
|
|
|
.Ar myname ,
|
|
|
|
which defaults to the name returned by
|
|
|
|
.Xr gethostname 3 .
|
2009-04-19 01:22:03 +04:00
|
|
|
Only the last
|
|
|
|
.Fl i
|
|
|
|
option is used.
|
2011-04-24 11:17:02 +04:00
|
|
|
This option is only valid with the
|
|
|
|
.Fl b
|
|
|
|
option.
|
2013-10-13 02:37:43 +04:00
|
|
|
.It Fl L Ar prefix script
|
|
|
|
Adds a new Lua script for a particular prefix.
|
|
|
|
The
|
|
|
|
.Ar prefix
|
|
|
|
should be an arbitrary text, and the
|
|
|
|
.Ar script
|
|
|
|
should be a full path to a Lua script.
|
|
|
|
Multiple
|
|
|
|
.Fl L
|
|
|
|
options may be passed.
|
|
|
|
A separate Lua state is created for each prefix.
|
|
|
|
The Lua script can register callbacks using the
|
|
|
|
httpd.register_handler('<name>', function) Lua function,
|
|
|
|
which will trigger the execution of the Lua function
|
|
|
|
.Em function
|
|
|
|
when a URL in the form
|
|
|
|
.Em http://<hostname>/<prefix>/<name>
|
|
|
|
is being accessed.
|
|
|
|
The function is passed three tables as arguments, the server
|
|
|
|
environment, the request headers, and the decoded query string
|
2016-12-21 12:33:08 +03:00
|
|
|
plus any data that was sent as application/x-www-form-urlencoded.
|
2007-10-16 05:14:01 +04:00
|
|
|
.It Fl M Ar suffix type encoding encoding11
|
2011-04-24 11:17:02 +04:00
|
|
|
Adds a new entry to the table that converts file suffixes to
|
2007-10-16 05:14:01 +04:00
|
|
|
content type and encoding.
|
|
|
|
This option takes four additional arguments containing
|
|
|
|
the file prefix, its
|
|
|
|
.Dq Content-Type ,
|
2008-12-06 16:30:35 +03:00
|
|
|
.Dq Content-Encoding ,
|
2007-10-16 05:14:01 +04:00
|
|
|
and
|
|
|
|
.Dq Content-Encoding
|
|
|
|
for HTTP/1.1 connections, respectively.
|
2008-12-06 16:30:35 +03:00
|
|
|
If any of these are a single dash
|
|
|
|
.Pq Dq - ,
|
|
|
|
the empty string is used instead.
|
2007-10-16 05:14:01 +04:00
|
|
|
Multiple
|
|
|
|
.Fl M
|
|
|
|
options may be passed.
|
|
|
|
.It Fl n
|
2011-04-24 11:17:02 +04:00
|
|
|
Stops
|
2007-10-16 05:14:01 +04:00
|
|
|
.Nm
|
|
|
|
from doing IP address to name resolution of hosts for setting the
|
|
|
|
.Ev REMOTE_HOST
|
|
|
|
variable before running a CGI program.
|
|
|
|
This option has no effect without the
|
|
|
|
.Fl c
|
|
|
|
option.
|
2011-03-29 11:22:31 +04:00
|
|
|
.It Fl P Ar pidfile
|
2011-04-24 11:17:02 +04:00
|
|
|
Causes
|
2011-03-29 11:22:31 +04:00
|
|
|
.Nm
|
2017-11-28 15:22:27 +03:00
|
|
|
to create a PID file in
|
2011-03-29 11:22:31 +04:00
|
|
|
.Ar pidfile
|
|
|
|
when run in daemon mode with the
|
|
|
|
.Fl b
|
|
|
|
option.
|
2007-10-16 05:14:01 +04:00
|
|
|
.It Fl p Ar pubdir
|
2011-04-24 11:17:02 +04:00
|
|
|
Changes the default user directory for
|
2007-10-16 05:14:01 +04:00
|
|
|
.Em /~user/
|
|
|
|
translations from
|
|
|
|
.Dq public_html
|
|
|
|
to
|
|
|
|
.Ar pubdir .
|
|
|
|
.It Fl S Ar server_software
|
2011-04-24 11:17:02 +04:00
|
|
|
Sets the internal server version to
|
2007-10-16 05:14:01 +04:00
|
|
|
.Ar server_software .
|
|
|
|
.It Fl s
|
2011-04-24 11:17:02 +04:00
|
|
|
Forces logging to be set to stderr always.
|
2018-11-20 04:06:46 +03:00
|
|
|
.It Fl T Ar type timeout
|
|
|
|
Set the timeout for
|
|
|
|
.Ar type
|
|
|
|
to
|
|
|
|
.Ar timeout .
|
|
|
|
The valid values of
|
|
|
|
.Ar type
|
|
|
|
are
|
2019-02-28 11:28:21 +03:00
|
|
|
.Dq ssl timeout ,
|
2018-11-20 04:06:46 +03:00
|
|
|
.Dq initial timeout ,
|
|
|
|
.Dq header timeout ,
|
|
|
|
and
|
|
|
|
.Dq request timeout .
|
2019-02-28 11:28:21 +03:00
|
|
|
The default values are 30 seconds, 30 seconds, 10 seconds and 600 seconds,
|
|
|
|
respectively.
|
2007-10-16 05:14:01 +04:00
|
|
|
.It Fl t Ar chrootdir
|
2011-04-24 11:17:02 +04:00
|
|
|
Makes
|
2007-10-16 05:14:01 +04:00
|
|
|
.Nm
|
2011-04-24 11:17:02 +04:00
|
|
|
chroot to the specified directory
|
2007-10-16 05:14:01 +04:00
|
|
|
before answering requests.
|
|
|
|
Every other path should be specified relative
|
|
|
|
to the new root, if this option is used.
|
|
|
|
Note that the current environment
|
|
|
|
is normally replaced with an empty environment with this option, unless the
|
|
|
|
.Fl e
|
|
|
|
option is also used.
|
|
|
|
.It Fl U Ar username
|
2011-04-24 11:17:02 +04:00
|
|
|
Causes
|
2007-10-16 05:14:01 +04:00
|
|
|
.Nm
|
|
|
|
to switch to the user and the groups of
|
|
|
|
.Ar username
|
|
|
|
after initialization.
|
|
|
|
This option, like
|
|
|
|
.Fl t
|
|
|
|
above, causes
|
|
|
|
.Nm
|
|
|
|
to clear the environment unless the
|
|
|
|
.Fl e
|
|
|
|
option is given.
|
|
|
|
.It Fl u
|
2011-04-24 11:17:02 +04:00
|
|
|
Enables the transformation of Uniform Resource Locators of
|
2007-10-16 05:14:01 +04:00
|
|
|
the form
|
|
|
|
.Em /~user/
|
2009-11-22 21:40:26 +03:00
|
|
|
into the directory
|
2007-10-16 05:14:01 +04:00
|
|
|
.Pa ~user/public_html
|
|
|
|
(but see the
|
|
|
|
.Fl p
|
|
|
|
option above).
|
2015-10-28 12:20:15 +03:00
|
|
|
.It Fl E
|
|
|
|
Enables CGI/1.1 interface for
|
|
|
|
.Em ~user
|
|
|
|
translation.
|
|
|
|
Note that enabling this support implies that users can run
|
|
|
|
commands as web server user, this may have security implications.
|
2007-10-16 05:14:01 +04:00
|
|
|
.It Fl V
|
2016-10-04 21:33:00 +03:00
|
|
|
Sets the backup virtual host directory to the
|
|
|
|
.Ar slashdir
|
|
|
|
argument.
|
2007-10-16 05:14:01 +04:00
|
|
|
If no directory exists in
|
|
|
|
.Ar virtualroot
|
|
|
|
for the request, then
|
|
|
|
.Ar slashdir
|
|
|
|
will be used.
|
2017-11-28 15:22:27 +03:00
|
|
|
The default behavior is to return 404 (Not Found.)
|
2007-10-16 05:14:01 +04:00
|
|
|
.It Fl v Ar virtualroot
|
2011-04-24 11:17:02 +04:00
|
|
|
Enables virtual hosting support.
|
2007-10-16 05:14:01 +04:00
|
|
|
Directories in
|
|
|
|
.Ar virtualroot
|
|
|
|
will be searched for a matching virtual host name, when parsing
|
|
|
|
the HTML request.
|
|
|
|
If a matching name is found, it will be used
|
|
|
|
as both the server's real name,
|
|
|
|
.Op Ar myname ,
|
|
|
|
and as the
|
|
|
|
.Ar slashdir .
|
|
|
|
See the
|
|
|
|
.Sx EXAMPLES
|
|
|
|
section for an example of using this option.
|
|
|
|
.It Fl X
|
2011-04-24 11:17:02 +04:00
|
|
|
Enables directory indexing.
|
2007-10-16 05:14:01 +04:00
|
|
|
A directory index will be generated only when the default file (i.e.
|
|
|
|
.Pa index.html
|
|
|
|
normally) is not present.
|
|
|
|
.It Fl x Ar index
|
2011-04-24 11:17:02 +04:00
|
|
|
Changes the default file read for directories from
|
2007-10-16 05:14:01 +04:00
|
|
|
.Dq index.html
|
|
|
|
to
|
|
|
|
.Ar index .
|
2015-12-12 19:57:53 +03:00
|
|
|
.It Fl z Ar ciphers
|
|
|
|
Sets the list of SSL ciphers (see
|
|
|
|
.Xr SSL_CTX_set_cipher_list 3 ) .
|
2007-10-16 05:14:01 +04:00
|
|
|
.It Fl Z Ar certificate_path privatekey_path
|
2011-04-24 11:17:02 +04:00
|
|
|
Sets the path to the server certificate file and the private key file
|
2017-11-28 15:22:27 +03:00
|
|
|
in PEM format.
|
2008-12-06 16:18:09 +03:00
|
|
|
It also causes
|
2008-03-04 01:15:08 +03:00
|
|
|
.Nm
|
|
|
|
to start SSL mode.
|
2007-10-16 05:14:01 +04:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Note that in
|
|
|
|
.Nm
|
|
|
|
versions 20031005 and prior that supported the
|
|
|
|
.Fl C
|
|
|
|
and
|
|
|
|
.Fl M
|
|
|
|
options, they took a single space-separated argument that was parsed.
|
|
|
|
since version 20040828, they take multiple options (2 in the case of
|
|
|
|
.Fl C
|
|
|
|
and 4 in the case of
|
|
|
|
.Fl M . )
|
2008-12-06 16:30:35 +03:00
|
|
|
.Ss INETD CONFIGURATION
|
2007-10-16 05:14:01 +04:00
|
|
|
As
|
|
|
|
.Nm
|
|
|
|
uses
|
|
|
|
.Xr inetd 8
|
|
|
|
by default to process incoming TCP connections for HTTP requests
|
|
|
|
(but see the
|
|
|
|
.Fl b
|
|
|
|
option),
|
|
|
|
.Nm
|
|
|
|
has little internal networking knowledge.
|
2015-12-27 13:21:35 +03:00
|
|
|
(Indeed, you can run it on the command line with little change of
|
|
|
|
functionality.)
|
2007-10-16 05:14:01 +04:00
|
|
|
A typical
|
|
|
|
.Xr inetd.conf 5
|
|
|
|
entry would be:
|
|
|
|
.Bd -literal
|
2007-10-16 06:47:12 +04:00
|
|
|
http stream tcp nowait:600 _httpd /usr/libexec/httpd httpd /var/www
|
|
|
|
http stream tcp6 nowait:600 _httpd /usr/libexec/httpd httpd /var/www
|
2007-10-16 05:14:01 +04:00
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
This would serve web pages from
|
|
|
|
.Pa /var/www
|
|
|
|
on both IPv4 and IPv6 ports.
|
|
|
|
The
|
|
|
|
.Em :600
|
|
|
|
changes the
|
|
|
|
requests per minute to 600, up from the
|
|
|
|
.Xr inetd 8
|
|
|
|
default of 40.
|
|
|
|
.Pp
|
|
|
|
Using the
|
|
|
|
.Nx
|
|
|
|
.Xr inetd 8 ,
|
|
|
|
you can provide multiple IP-address based HTTP servers by having multiple
|
|
|
|
listening ports with different configurations.
|
2008-12-06 16:30:35 +03:00
|
|
|
.Ss NOTES
|
2007-10-16 05:14:01 +04:00
|
|
|
This server supports the
|
|
|
|
.Em HTTP/0.9 ,
|
2008-12-06 16:30:35 +03:00
|
|
|
.Em HTTP/1.0 ,
|
2007-10-16 05:14:01 +04:00
|
|
|
and
|
|
|
|
.Em HTTP/1.1
|
2008-03-04 01:15:08 +03:00
|
|
|
standards.
|
|
|
|
Support for these protocols is very minimal and many optional features are
|
|
|
|
not supported.
|
2007-10-16 05:14:01 +04:00
|
|
|
.Pp
|
|
|
|
.Nm
|
2014-01-02 12:47:38 +04:00
|
|
|
can be compiled without
|
|
|
|
CGI support (NO_CGIBIN_SUPPORT),
|
|
|
|
user transformations (NO_USER_SUPPORT),
|
|
|
|
directory index support (NO_DIRINDEX_SUPPORT),
|
|
|
|
daemon mode support (NO_DAEMON_MODE),
|
|
|
|
dynamic MIME content (NO_DYNAMIC_CONTENT),
|
2017-01-20 19:14:44 +03:00
|
|
|
Lua support (NO_LUA_SUPPORT),
|
2014-01-02 12:47:38 +04:00
|
|
|
and SSL support (NO_SSL_SUPPORT)
|
|
|
|
by defining the listed macros when building
|
2007-10-16 05:14:01 +04:00
|
|
|
.Nm .
|
2017-11-28 15:22:27 +03:00
|
|
|
.Ss HTTP BASIC AUTHORIZATION
|
2007-10-16 05:14:01 +04:00
|
|
|
.Nm
|
2017-11-28 15:22:27 +03:00
|
|
|
has support for HTTP Basic Authorization.
|
2007-10-17 17:55:46 +04:00
|
|
|
If a file named
|
|
|
|
.Pa .htpasswd
|
|
|
|
exists in the directory of the current request,
|
|
|
|
.Nm
|
|
|
|
will restrict access to documents in that directory
|
|
|
|
using the RFC 2617 HTTP
|
|
|
|
.Dq Basic
|
|
|
|
authentication scheme.
|
|
|
|
.Pp
|
|
|
|
Note:
|
|
|
|
This does not recursively protect any sub-directories.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Pa .htpasswd
|
|
|
|
file contains lines delimited with a colon containing
|
2017-11-28 15:22:27 +03:00
|
|
|
user names and passwords hashed with
|
2007-10-17 17:55:46 +04:00
|
|
|
.Xr crypt 3 ,
|
|
|
|
for example:
|
|
|
|
.Bd -literal
|
2008-12-06 16:18:09 +03:00
|
|
|
heather:$1$pZWI4tH/$DzDPl63i6VvVRv2lJNV7k1
|
2007-10-17 17:55:46 +04:00
|
|
|
jeremy:A.xewbx2DpQ8I
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
On
|
|
|
|
.Nx ,
|
|
|
|
the
|
|
|
|
.Xr pwhash 1
|
|
|
|
utility may be used to generate hashed passwords.
|
2008-03-04 01:15:08 +03:00
|
|
|
.Pp
|
2008-12-06 16:18:09 +03:00
|
|
|
While
|
2008-03-04 01:15:08 +03:00
|
|
|
.Nm
|
|
|
|
distributed with
|
|
|
|
.Nx
|
2017-11-28 15:22:27 +03:00
|
|
|
has support for HTTP Basic Authorization enabled by default,
|
2009-04-18 11:28:24 +04:00
|
|
|
in the portable distribution it is excluded.
|
2008-03-04 01:15:08 +03:00
|
|
|
Compile
|
|
|
|
.Nm
|
|
|
|
with
|
|
|
|
.Dq -DDO_HTPASSWD
|
2008-12-06 16:18:09 +03:00
|
|
|
on the compiler command line to enable this support.
|
2009-05-23 06:26:03 +04:00
|
|
|
It may require linking with the crypt library, using
|
2008-03-04 01:15:08 +03:00
|
|
|
.Dq -lcrypt .
|
2008-12-06 16:30:35 +03:00
|
|
|
.Ss SSL SUPPORT
|
2007-10-16 05:14:01 +04:00
|
|
|
.Nm
|
2015-12-12 19:57:53 +03:00
|
|
|
has support for TLSv1.1 and TLSv1.2 protocols that are included by
|
2008-12-06 16:18:09 +03:00
|
|
|
default.
|
|
|
|
It requires linking with the crypto and ssl library, using
|
2007-10-16 05:14:01 +04:00
|
|
|
.Dq -lcrypto -lssl .
|
|
|
|
To disable SSL SUPPORT compile
|
|
|
|
.Nm
|
|
|
|
with
|
|
|
|
.Dq -DNO_SSL_SUPPORT
|
|
|
|
on the compiler command line.
|
2012-02-20 13:26:56 +04:00
|
|
|
.Ss COMPRESSION
|
|
|
|
.Nm
|
2016-12-21 12:33:08 +03:00
|
|
|
supports a very basic form of compression.
|
2012-02-20 13:26:56 +04:00
|
|
|
.Nm
|
2012-02-20 13:45:22 +04:00
|
|
|
will serve the requested file postpended with
|
|
|
|
.Dq Pa .gz
|
|
|
|
if it exists, it is readable, the client requested gzip compression, and
|
2012-02-20 13:26:56 +04:00
|
|
|
the client did not make a ranged request.
|
2008-12-06 17:17:43 +03:00
|
|
|
.Sh FILES
|
|
|
|
.Nm
|
|
|
|
looks for a couple of special files in directories that allow certain features
|
|
|
|
to be provided on a per-directory basis.
|
|
|
|
In addition to the
|
|
|
|
.Pa .htpasswd
|
2017-11-28 15:22:27 +03:00
|
|
|
used by HTTP basic authorization,
|
2008-12-06 17:17:43 +03:00
|
|
|
if a
|
|
|
|
.Pa .bzdirect
|
|
|
|
file is found (contents are irrelevant)
|
|
|
|
.Nm
|
2019-01-08 09:04:29 +03:00
|
|
|
will allow direct access.
|
2008-12-06 17:17:43 +03:00
|
|
|
If a
|
|
|
|
.Pa .bzredirect
|
|
|
|
symbolic link is found,
|
|
|
|
.Nm
|
|
|
|
will perform a smart redirect to the target of this symlink.
|
|
|
|
The target is assumed to live on the same server.
|
2015-10-28 12:20:15 +03:00
|
|
|
If target starts with slash then absolute redirection is performed,
|
|
|
|
otherwise it's handled as relative.
|
2008-12-06 17:17:43 +03:00
|
|
|
If a
|
|
|
|
.Pa .bzabsredirect
|
|
|
|
symbolic link is found,
|
|
|
|
.Nm
|
2017-11-28 15:22:27 +03:00
|
|
|
will redirect to the absolute URL pointed to by this symlink.
|
2008-12-06 17:17:43 +03:00
|
|
|
This is useful to redirect to different servers.
|
2015-10-28 12:20:15 +03:00
|
|
|
Two forms of redirection are supported - symbolic link without schema will use
|
|
|
|
.Em http://
|
|
|
|
as default i.e. link to
|
|
|
|
.Em NetBSD.org
|
|
|
|
will redirect to
|
|
|
|
.Em http://NetBSD.org/
|
|
|
|
Otherwise provided schema will be used i.e. symbolic link to
|
|
|
|
.Em ftp://NetBSD.org/
|
2017-07-07 10:05:49 +03:00
|
|
|
will redirect to the provided URL.
|
2018-08-24 14:41:16 +03:00
|
|
|
If a
|
|
|
|
.Pa .bzremap
|
|
|
|
file is found at the root of a (virtual) server, it is expected to contain
|
|
|
|
rewrite mappings for URLs.
|
|
|
|
.Pp
|
|
|
|
These remappings are performed internally in the server before authentication
|
|
|
|
happens and can be used to hide implementation details, like the CGI handler
|
|
|
|
specific suffix for non cgi scripts in authorized directories.
|
|
|
|
.Pp
|
|
|
|
The map file consists of lines two paths separated by a colon, where the left
|
|
|
|
side needs to exactly match a (sub) path of the request and will be replaced
|
|
|
|
by the right side.
|
|
|
|
.Pp
|
|
|
|
The first match always wins.
|
|
|
|
.Pp
|
|
|
|
A
|
|
|
|
.Pa .bzremap
|
|
|
|
file could look like this:
|
|
|
|
.Bd -literal
|
|
|
|
/nic/update:/auth-dir/updipv4.pl
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
The remap file should be short, access to it is slow and needs to happen
|
|
|
|
on each request.
|
2018-08-24 17:24:50 +03:00
|
|
|
If a request path needs to include a colon
|
2018-08-24 14:41:16 +03:00
|
|
|
.Pq Li \&:
|
|
|
|
character, it can be escaped
|
|
|
|
with a backslash
|
|
|
|
.Pq Li \e
|
|
|
|
The right hand side of the colon is always used verbatim, no escape sequences
|
|
|
|
are interpreted.
|
2008-12-06 17:17:43 +03:00
|
|
|
.Sh EXAMPLES
|
|
|
|
To configure set of virtual hosts, one would use an
|
|
|
|
.Xr inetd.conf 5
|
|
|
|
entry like:
|
|
|
|
.Bd -literal
|
|
|
|
http stream tcp nowait:600 _httpd /usr/libexec/httpd httpd -v /var/vroot /var/www
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
and inside
|
|
|
|
.Pa /var/vroot
|
|
|
|
create a directory (or a symlink to a directory) with the same name as
|
|
|
|
the virtual host, for each virtual host.
|
2014-02-09 05:46:10 +04:00
|
|
|
Lookups for these names are done in a case-insensitive manner, and may
|
|
|
|
include the port number part of the request, allowing for distinct
|
|
|
|
virtual hosts on the same name.
|
2008-12-06 17:17:43 +03:00
|
|
|
.Pp
|
|
|
|
To use
|
|
|
|
.Nm
|
|
|
|
with PHP, one must use the
|
|
|
|
.Fl C
|
|
|
|
option to specify a CGI handler for a particular file type.
|
2011-03-10 17:37:16 +03:00
|
|
|
Typically this will be like:
|
2008-12-06 17:17:43 +03:00
|
|
|
.Bd -literal
|
2016-04-15 20:57:21 +03:00
|
|
|
httpd -C .php /usr/pkg/bin/php-cgi /var/www
|
2008-12-06 17:17:43 +03:00
|
|
|
.Ed
|
2017-11-28 15:22:27 +03:00
|
|
|
.Pp
|
|
|
|
Note that a plain script interpreter can not be used directly as a cgihandler,
|
|
|
|
as there are no command line options passed from
|
|
|
|
.Nm
|
|
|
|
to avoid security issues.
|
|
|
|
.Pp
|
|
|
|
If no CGI-aware wrapper exists, a simple shell script like the following
|
|
|
|
might do.
|
|
|
|
.Pp
|
|
|
|
It would be invoked like:
|
|
|
|
.Bd -literal
|
|
|
|
httpd -C .pl /www-scripts/bin/run.perl /var/www
|
|
|
|
.Ed
|
|
|
|
and the script could look like:
|
|
|
|
.Bd -literal
|
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
if [ -r "$SCRIPT_FILENAME" -a -x "$SCRIPT_FILENAME" ]; then
|
|
|
|
exec /usr/pkg/bin/perl "$SCRIPT_FILENAME"
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
.Ed
|
2007-10-16 05:14:01 +04:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr inetd.conf 5 ,
|
|
|
|
.Xr inetd 8
|
|
|
|
.Sh HISTORY
|
|
|
|
.Nm
|
2015-04-16 05:32:33 +03:00
|
|
|
was first written in perl, based on another perl http server
|
2007-10-16 05:14:01 +04:00
|
|
|
called
|
|
|
|
.Dq tinyhttpd .
|
|
|
|
It was then rewritten from scratch in perl, and then once again in C.
|
2009-04-18 16:35:51 +04:00
|
|
|
From
|
2007-10-16 06:47:12 +04:00
|
|
|
.Dq bozohttpd
|
2009-04-18 11:28:24 +04:00
|
|
|
version 20060517, it has been integrated into
|
|
|
|
.Nx .
|
2007-10-16 05:14:01 +04:00
|
|
|
The focus has always been simplicity and security, with minimal features
|
|
|
|
and regular code audits.
|
2008-03-04 01:15:08 +03:00
|
|
|
This manual documents
|
|
|
|
.Nm
|
2019-01-17 10:46:16 +03:00
|
|
|
version 20190116.
|
2007-10-16 05:14:01 +04:00
|
|
|
.Sh AUTHORS
|
2013-10-13 02:37:43 +04:00
|
|
|
.An -nosplit
|
2007-10-16 05:14:01 +04:00
|
|
|
.Nm
|
2013-10-13 02:37:43 +04:00
|
|
|
was written by
|
|
|
|
.An Matthew R. Green
|
|
|
|
.Aq Mt mrg@eterna.com.au .
|
2007-10-16 05:14:01 +04:00
|
|
|
.Pp
|
|
|
|
The large list of contributors includes:
|
|
|
|
.Bl -dash
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Christoph Badura
|
|
|
|
.Aq Mt bad@bsd.de
|
2008-03-04 01:15:08 +03:00
|
|
|
provided Range: header support
|
|
|
|
.It
|
2018-12-19 15:40:32 +03:00
|
|
|
.An Marc Balmer
|
|
|
|
.Aq Mt mbalmer@NetBSD.org
|
|
|
|
added Lua support for dynamic content creation
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Sean Boudreau
|
|
|
|
.Aq Mt seanb@NetBSD.org
|
2010-09-21 11:05:28 +04:00
|
|
|
provided a security fix for virtual hosting
|
2010-09-21 03:11:38 +04:00
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Julian Coleman
|
|
|
|
.Aq Mt jdc@coris.org.uk
|
2007-10-16 05:14:01 +04:00
|
|
|
provided an IPv6 bugfix
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Chuck Cranor
|
|
|
|
.Aq Mt chuck@research.att.com
|
2007-10-16 05:14:01 +04:00
|
|
|
provided cgi-bin support fixes, and more
|
|
|
|
.It
|
2014-01-02 12:47:38 +04:00
|
|
|
.An Alistair G. Crooks
|
|
|
|
.Aq Mt agc@NetBSD.org
|
2015-04-16 05:32:33 +03:00
|
|
|
cleaned up many internal interfaces, made
|
|
|
|
.Nm
|
2019-01-17 10:46:16 +03:00
|
|
|
linkable as a library and provided the Lua binding
|
2014-01-02 12:47:38 +04:00
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An DEGROOTE Arnaud
|
|
|
|
.Aq Mt degroote@NetBSD.org
|
2009-04-18 11:28:24 +04:00
|
|
|
provided a fix for daemon mode
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Andrew Doran
|
|
|
|
.Aq Mt ad@NetBSD.org
|
2007-10-16 05:14:01 +04:00
|
|
|
provided directory indexing support
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Roland Dowdeswell
|
|
|
|
.Aq Mt elric@NetBSD.org
|
2013-07-11 11:44:19 +04:00
|
|
|
added support for serving gzipped files and better SSL handling
|
|
|
|
.It
|
2018-12-19 15:40:32 +03:00
|
|
|
.An Per Ekman
|
|
|
|
.Aq Mt pek@pdc.kth.se
|
|
|
|
provided a fix for a minor (non-security) buffer overflow condition
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Jun-ichiro itojun Hagino, KAME
|
|
|
|
.Aq Mt itojun@iijlab.net
|
2007-10-16 05:14:01 +04:00
|
|
|
provided initial IPv6 support
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Martin Husemann
|
|
|
|
.Aq Mt martin@NetBSD.org
|
2018-11-19 07:14:59 +03:00
|
|
|
provided .bzabsredirect and .bzredir support, and fixed various
|
|
|
|
redirection issues
|
2007-10-16 05:14:01 +04:00
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Arto Huusko
|
|
|
|
.Aq Mt arto.huusko@pp2.inet.fi
|
2009-04-18 11:28:24 +04:00
|
|
|
provided fixes cgi-bin
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Roland Illig
|
|
|
|
.Aq Mt roland.illig@gmx.de
|
2007-10-16 05:14:01 +04:00
|
|
|
provided some off-by-one fixes
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Zak Johnson
|
|
|
|
.Aq Mt zakj@nox.cx
|
2009-04-18 11:28:24 +04:00
|
|
|
provided cgi-bin enhancements
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Nicolas Jombart
|
|
|
|
.Aq Mt ecu@ipv42.net
|
2017-11-28 15:22:27 +03:00
|
|
|
provided fixes for HTTP basic authorization support
|
2007-10-16 05:14:01 +04:00
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Antti Kantee
|
|
|
|
.Aq Mt pooka@NetBSD.org
|
2017-11-28 15:22:27 +03:00
|
|
|
provided fixes for HTTP basic authorization support
|
2013-07-11 11:44:19 +04:00
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Thomas Klausner
|
|
|
|
.Aq Mt wiz@NetBSD.org
|
2007-10-16 05:14:01 +04:00
|
|
|
provided many fixes and enhancements for the man page
|
|
|
|
.It
|
2015-03-20 22:54:53 +03:00
|
|
|
.An Mateusz Kocielski
|
|
|
|
.Aq Mt shm@NetBSD.org
|
2015-08-13 15:30:08 +03:00
|
|
|
fixed memory leaks, various issues with userdir support,
|
2015-08-13 12:00:29 +03:00
|
|
|
information disclosure issues, added support for using CGI handlers
|
2016-04-15 20:57:21 +03:00
|
|
|
with directory indexing, found several security issues and provided
|
2019-01-17 10:46:16 +03:00
|
|
|
various other fixes
|
2015-03-20 22:54:53 +03:00
|
|
|
.It
|
2014-01-02 12:47:38 +04:00
|
|
|
.An Arnaud Lacombe
|
|
|
|
.Aq Mt alc@NetBSD.org
|
|
|
|
provided some clean up for memory leaks
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Johnny Lam
|
|
|
|
.Aq Mt jlam@NetBSD.org
|
2007-10-16 05:14:01 +04:00
|
|
|
provided man page fixes
|
|
|
|
.It
|
2017-01-31 17:36:09 +03:00
|
|
|
.An Dennis Lindroos
|
|
|
|
.Aq Mt denafcm@gmail.com
|
|
|
|
provided a cgi-bin fix
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Julio Merino
|
|
|
|
.Aq Mt jmmv@NetBSD.org
|
2013-07-11 11:44:19 +04:00
|
|
|
Added the
|
|
|
|
.Fl P
|
2019-01-17 10:46:16 +03:00
|
|
|
option (pidfile support) and provided some man page fixes
|
2013-07-11 11:44:19 +04:00
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Luke Mewburn
|
|
|
|
.Aq Mt lukem@NetBSD.org
|
2008-12-06 16:30:35 +03:00
|
|
|
provided many various fixes, including cgi-bin fixes and enhancements,
|
2017-11-28 15:22:27 +03:00
|
|
|
HTTP basic authorization support and much code clean up
|
2007-10-16 05:14:01 +04:00
|
|
|
.It
|
2014-02-09 05:46:10 +04:00
|
|
|
.An Rajeev V. Pillai
|
|
|
|
.Aq Mt rajeev_v_pillai@yahoo.com
|
2019-01-17 10:46:16 +03:00
|
|
|
provided several fixes for virtual hosting and directory indexing and
|
|
|
|
fixes for CGI
|
2014-02-09 05:46:10 +04:00
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Jeremy C. Reed
|
|
|
|
.Aq Mt reed@NetBSD.org
|
2008-03-04 01:15:08 +03:00
|
|
|
provided several clean up fixes, and man page updates
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Scott Reynolds
|
|
|
|
.Aq Mt scottr@NetBSD.org
|
2007-10-16 05:14:01 +04:00
|
|
|
provided various fixes
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Tyler Retzlaff
|
|
|
|
.Aq Mt rtr@eterna.com.au
|
2008-03-04 01:15:08 +03:00
|
|
|
provided SSL support, cgi-bin fixes and much other random other stuff
|
2007-10-16 05:14:01 +04:00
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An rudolf
|
|
|
|
.Aq Mt netbsd@eq.cz
|
2010-09-21 03:11:38 +04:00
|
|
|
provided minor compile fixes and a CGI content map fix
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Steve Rumble
|
|
|
|
.Aq Mt rumble@ephemeral.org
|
2007-10-16 05:14:01 +04:00
|
|
|
provided the
|
|
|
|
.Fl V
|
2019-01-17 10:46:16 +03:00
|
|
|
option
|
2007-10-16 05:14:01 +04:00
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Thor Lancelot Simon
|
|
|
|
.Aq Mt tls@NetBSD.org
|
2019-01-17 10:46:16 +03:00
|
|
|
enhanced cgi-bin support
|
2013-07-11 11:44:19 +04:00
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Joerg Sonnenberger
|
|
|
|
.Aq Mt joerg@NetBSD.org
|
2009-04-18 11:28:24 +04:00
|
|
|
implemented If-Modified-Since support
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An ISIHARA Takanori
|
|
|
|
.Aq Mt ishit@oak.dti.ne.jp
|
2007-10-16 05:14:01 +04:00
|
|
|
provided a man page fix
|
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.An Holger Weiss
|
|
|
|
.Aq Mt holger@CIS.FU-Berlin.DE
|
2017-11-28 15:22:27 +03:00
|
|
|
provided http authorization fixes
|
2009-04-18 11:28:24 +04:00
|
|
|
.It
|
2013-10-13 02:37:43 +04:00
|
|
|
.Aq Mt xs@kittenz.org
|
2007-10-16 05:14:01 +04:00
|
|
|
provided chroot and change-to-user support, and other various fixes
|
2009-04-18 11:28:24 +04:00
|
|
|
.It
|
2019-01-17 10:46:16 +03:00
|
|
|
Coyote Point provided various CGI fixes
|
2007-10-16 05:14:01 +04:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
There are probably others I have forgotten (let me know if you care)
|
2009-04-18 11:28:24 +04:00
|
|
|
.Pp
|
|
|
|
Please send all updates to
|
|
|
|
.Nm
|
|
|
|
to
|
2013-10-13 02:37:43 +04:00
|
|
|
.Aq Mt mrg@eterna.com.au
|
2013-03-02 20:45:31 +04:00
|
|
|
for inclusion in future releases.
|
2007-10-16 05:14:01 +04:00
|
|
|
.Sh BUGS
|
|
|
|
.Nm
|
2011-04-02 11:44:15 +04:00
|
|
|
does not handle HTTP/1.1 chunked input from the client yet.
|