All Projects → mpfr → httpd-plus

mpfr / httpd-plus

Licence: ISC license
Add-ons for the OpenBSD web server

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to httpd-plus

OpenBSDFirewall
Simple OpenBSD Home Firewall Config for ALIX Board
Stars: ✭ 41 (+28.13%)
Mutual labels:  openbsd, pf
UTMFW
UTM Firewall on OpenBSD
Stars: ✭ 104 (+225%)
Mutual labels:  openbsd, packet-filter
changelog
Security router changelog
Stars: ✭ 15 (-53.12%)
Mutual labels:  openbsd, pf
PFRE
Packet Filter Rule Editor for OpenBSD/pf
Stars: ✭ 26 (-18.75%)
Mutual labels:  openbsd, packet-filter
Caesonia
OpenBSD Email Service
Stars: ✭ 761 (+2278.13%)
Mutual labels:  openbsd, httpd
Signify
OpenBSD tool to signs and verify signatures on files. Portable version.
Stars: ✭ 122 (+281.25%)
Mutual labels:  openbsd
Purritobin
ultra fast, minimalistic, encrypted command line paste-bin
Stars: ✭ 171 (+434.38%)
Mutual labels:  openbsd
Fisy Fuzz
This is the full file system fuzzing framework that I presented at the Hack in the Box 2020 Lockdown Edition conference in April.
Stars: ✭ 110 (+243.75%)
Mutual labels:  openbsd
Postinstall
💻 Bash Script to automate post-installation steps
Stars: ✭ 104 (+225%)
Mutual labels:  openbsd
WaGis-Mass-IP-Blacklister-Windows
This Tool blocks a Mass of IP Adresses via the Windows Firewall. You can run in Automatic-Mode using a Abusive IP List like blocklist.de
Stars: ✭ 34 (+6.25%)
Mutual labels:  blocklist
Awesome Openbsd
A curated list of awesome OpenBSD resources
Stars: ✭ 228 (+612.5%)
Mutual labels:  openbsd
Durden
Desktop Environment for Arcan
Stars: ✭ 158 (+393.75%)
Mutual labels:  openbsd
Glaucus
An independent Linux® distribution built from scratch
Stars: ✭ 130 (+306.25%)
Mutual labels:  openbsd
Punes
Nintendo Entertaiment System emulator and NSF/NSFe Music Player (Linux, FreeBSD, OpenBSD and Windows)
Stars: ✭ 217 (+578.13%)
Mutual labels:  openbsd
Mg
Micro (GNU) Emacs-like text editor ❤️ public-domain
Stars: ✭ 117 (+265.63%)
Mutual labels:  openbsd
Awesome Bsd
A collection of awesome BSD related stuff
Stars: ✭ 236 (+637.5%)
Mutual labels:  openbsd
Libtuntap
The portable Tun/Tap devices configuration utility
Stars: ✭ 107 (+234.38%)
Mutual labels:  openbsd
Src
Public git conversion mirror of OpenBSD's official CVS src repository. Pull requests not accepted - send diffs to the tech@ mailing list.
Stars: ✭ 2,213 (+6815.63%)
Mutual labels:  openbsd
Gnb
GNB is open source de-centralized VPN to achieve layer3 network via p2p with the ultimate capability of NAT Traversal.GNB是一个开源的去中心化的具有极致内网穿透能力的通过P2P进行三层网络交换的VPN。
Stars: ✭ 225 (+603.13%)
Mutual labels:  openbsd
Aws Openbsd
AWS OpenBSD image builder (AMI) and cloud-init replacement
Stars: ✭ 144 (+350%)
Mutual labels:  openbsd

httpd-plus

Add-ons for the OpenBSD httpd(8) web server applicable to the latest -current branch.

Other branches available:

Notes:

List of add-ons

updates

Bug fixes:

  • Failing directory auto index of location in case enclosing server specifies directory no index (see on tech@)
  • Failing location access test in case server/location root is empty (see on tech@)
  • Inconsistent handling of inaccessible server/location root (regular file access still returns status 404 instead of 500)
  • Inappropriate log_warn in case of missing custom error documents and cleanup of read_errdoc function (see on misc@)

Amendments:

  • The info regarding the usage of the former location-access-tests add-on with WordPress was moved from this website to httpd.conf(5).

cache-control-headers

Optional HTTP Cache-Control headers via httpd.conf(5).

types {
	...
	image/jpeg  { cache "max-age=2592000, public" }             jpeg jpg
	text/css    { cache "max-age=86400, private" }              css
	text/html   { cache "no-store, no-cache, must-revalidate" } html
	...
}

fastcgi-script-overrides

Definition of script overrides for fastcgi environments via httpd.conf(5). This may be used either to run a dedicated script in its specific param environment for a certain location, or simply as a shortcut avoiding unnecessary evaluation rounds for the server (as required when using request rewrite).

server "www.example.com" {
	...
	location "/foobar/*" {
		fastcgi {
			socket "/run/php-fpm.sock"
			param "PARAM_1" "value_1"
			param "PARAM_2" "value_2"
			script "/index.php"
		}
	}
	location not found "/*" {
		# request rewrite "/index.php"
		fastcgi {
			socket "/run/php-fpm.sock"
			script "/index.php"
		}
	}
	...
}

client-address-filters

Client address matching (from or not from) for location sections in httpd.conf(5).

server "www.example.com" {
	...
	location "/intranet*" not from "10.0.0/24" { block }
	...
}

notify-on-block

Send notification messages to UNIX-domain sockets for server and/or location sections with a block directive in httpd.conf(5).

This cooperates perfectly with pftbld(8), offering an easy and straightforward means to effectively protect the web server from offensive clients and successively build customized firewall blocklists. In the example below, access to /restricted* URLs from outside the 10.0.0/24 network is not just blocked, but httpd(8) also reports client IP addresses to pftbld(8) (with its listening socket at /var/www/run/pftbld-www.sock) for further handling.

httpd.conf:

server "www.example.com" {
	...
	location "/restricted*" not from "10.0.0/24" {
		notify-on-block {
			socket "/run/pftbld-www.sock"
			message "$REMOTE_ADDR"
		}
		block
	}
	...
}

pftbld.conf:

target "www" {
	...
	socket "/var/www/run/pftbld-www.sock" {
		owner "www"
		group "www"
	}
	cascade {
		table "attackers"
		expire 1h
		...
	}
	...
}

brace-expansion

Simple brace expansion for alias <name>, include <path> and location <path> option parameters in httpd.conf(5). Helps to minimize the configuration file size by avoiding duplicate content.

include "/etc/httpd-{0..5}-incl.conf"
...
server "www.example.com" {
	alias "www.{a,b,c}.example.com"
	...
	location "/*.{bmp,gif,ico,jpg,png}" { pass }
	...
}

How to install

httpd-plus is a series of consecutive patch files which may be applied easily by following the steps below.

Make sure your user has sufficient doas permissions. To start, cd into the user's home directory, for example /home/mpfr.

$ cat /etc/doas.conf
permit nopass mpfr
$ cd
$ pwd
/home/mpfr

Download and extract patch files and installation script.

$ rm -rf httpd-plus-current/
$ ftp -Vo - https://codeload.github.com/mpfr/httpd-plus/tar.gz/current | tar xzvf -
httpd-plus-current
httpd-plus-current/00-updates.patch
httpd-plus-current/01-cache-control-headers.patch
httpd-plus-current/02-fastcgi-script-overrides.patch
httpd-plus-current/03-client-address-filters.patch
httpd-plus-current/04-notify-on-block.patch
httpd-plus-current/05-brace-expansion.patch
httpd-plus-current/LICENSE
httpd-plus-current/README.md
httpd-plus-current/install

Apply the patch files by running the installation script. This will build and install the httpd-plus binary. After the build process, the original source is restored.

$ doas ksh httpd-plus-current/install 2>&1 | tee httpd-plus-install.log
Backing up original sources ... Done.
Applying patch files ...
====================
===  00-updates  ===
====================
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
.
.
.
done
==================================
===  01-cache-control-headers  ===
==================================
Hmm...  Looks like a unified diff to me...
.
.
.
done
Building and installing httpd-plus binary and manpage ...
.
.
.
Restoring original sources ... Done.

Installing httpd-plus binary and manpage completed successfully.
Please consult 'man httpd.conf' for further information on new features.

Adapt your httpd.conf for the newly added features. For further information, have a look at the updated httpd.conf(5) manpage (also via man httpd.conf). Make sure your new configuration is valid.

$ doas vi /etc/httpd.conf
...
$ doas httpd -n
configuration OK

Restart the httpd daemon.

$ doas rcctl restart httpd
httpd(ok)
httpd(ok)

How to uninstall

The original version of httpd can easily be restored by performing a fresh rebuild and reinstall.

$ cd /usr/src/usr.sbin/httpd
$ doas make obj
$ doas make clean
$ doas make
$ doas make install

Remove httpd-plus related features from your configuration file and make sure it is valid. Don't forget to restart the httpd daemon.

$ doas vi /etc/httpd.conf
...
$ doas httpd -n
configuration OK
$ doas rcctl restart httpd
httpd(ok)
httpd(ok)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].