From Wikitech
Jump to: navigation, search is a internal apache reverse proxy hosted on wikitech-static to provide secure web-interface interface to status monitoring provided by Watchmouse.

Service notes

I've moved the status.wm.o DNS to wikitech-static, and set up an apache reverse proxy there with a LetsEncrypt cert that auto-renews. It seems to work now, after much experimenting and mucking around!

For the record, since we have no puppet, in case we have to muck with this again, the basic things I did were:

  1. Created a local acme user and group that can't log in
  2. Copied acme-setup,, and x509-bundle from our puppet repo to /usr/local/sbin/
  3. Commented out the self-verification portion of (this always seems to fail on challenge over redirect to self-signed for me).
  4. Installed the letsencrypt X3 and X4 intermediates in /usr/local/share/ca-certificates and ran update-ca-certificates.
  5. Enabled the following new apache2 modules: proxy, proxy_http, proxy_html
  6. Set up the following as the sites-available/enabled file for (note especially the crazy html translation hacks for re-mapping links URLs, especially the mongocache one (which is for ajax data loaded from a separate HTTP-only URL belonging to CA...):
# vim: filetype=apache

<VirtualHost *:80>

	SSLEngine off

	RewriteEngine on
	RewriteCond %{SERVER_PORT} !^443$
	RewriteRule ^/(.*)$$1 [L,R=301]

	ErrorLog /var/log/apache2/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog /var/log/apache2/access.log combined
	ServerSignature Off

<VirtualHost *:443>

		SSLEngine on
		SSLCertificateFile /etc/acme/cert/status.chained.crt
		SSLCertificateKeyFile /etc/acme/key/status.key
		SSLProtocol all -SSLv2 -SSLv3
	SSLHonorCipherOrder On
	Header always set Strict-Transport-Security "max-age=31536000"

	<Location />
		ProxyPass ""
		ProxyPassReverse ""
		RequestHeader unset Accept-Encoding
		Header always set Content-Security-Policy upgrade-insecure-requests
		ProxyHTMLEnable On
		ProxyHTMLExtended On
		ProxyHTMLLinks	a		href
		ProxyHTMLLinks	area		href
		ProxyHTMLLinks	link		href
		ProxyHTMLLinks	img		src longdesc usemap
		ProxyHTMLLinks	object		classid codebase data usemap
		ProxyHTMLLinks	q		cite
		ProxyHTMLLinks	blockquote	cite
		ProxyHTMLLinks	ins		cite
		ProxyHTMLLinks	del		cite
		ProxyHTMLLinks	form		action
		ProxyHTMLLinks	input		src usemap
		ProxyHTMLLinks	head		profile
		ProxyHTMLLinks	base		href
		ProxyHTMLLinks	script		src for
		ProxyHTMLEvents	onclick ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout onkeypress onkeydown onkeyup onfocus onblur onload onunload onsubmit onreset onselect onchange
		ProxyHTMLURLMap //status\.asm\.ca\.com/8777(/|$) // [Ri]
		ProxyHTMLURLMap // //
		ProxyHTMLURLMap http:// https:// [i]
		SetOutputFilter proxy-html
	<Location /.mongocache>
		ProxyPass ""
		ProxyPassReverse ""

	<Location /.well-known/acme-challenge>
		ProxyPass "!"

	Alias "/.well-known/acme-challenge" "/var/acme/challenge"
	<IfVersion >= 2.4>
		<Directory "/var/acme/challenge">
			Require all granted

	ErrorLog /var/log/apache2/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel debug

	CustomLog /var/log/apache2/access.log combined
	ServerSignature Off

  1. Ran the initial acme-setup for self-signed:
/usr/local/sbin/acme-setup -i status -s -m self -u acme
  1. Reloaded apache2
  2. Re-run to get a real cert:
/usr/local/sbin/acme-setup -i status -s -u acme -m acme -w apache2
  1. Created a cronjob running exactly the above once a day at 17:17, which will auto-renew when necessary.

See also