Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mholt's full-sized avatar
💪
I write code with my bare hands

Matt Holt mholt

💪
I write code with my bare hands
View GitHub Profile

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@electerious
electerious / Caddyfile
Created August 20, 2016 18:15
Most complete list of mime types in the correct format for the Caddy mime directive
mime {
.atom application/atom+xml
.json application/json
.map application/json
.topojson application/json
.jsonld application/ld+json
.rss application/rss+xml
.geojson application/vnd.geo+json
.rdf application/xml
.xml application/xml
@AGWA
AGWA / ocsp_stapling_robustness.md
Last active October 31, 2016 20:33
OCSP Stapling Robustness in Apache and nginx

Date: Mon, 5 Oct 2015 16:34:03 -0700

Apache caches an OCSP response for one hour by default. Unfortunately, once the hour is up, the response is purged from the cache, and Apache doesn't attempt to retrieve a new one until the next TLS handshake takes place. That means that if there's a problem contacting the OCSP responder at that moment, Apache is left without an OCSP response to staple. Furthermore, it caches the non-response for 10 minutes (by default), so for the next 10 minutes, no OCSP response will be stapled to your

@ericclemmons
ericclemmons / example.md
Last active February 22, 2024 16:18
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
@kennwhite
kennwhite / unprivileged_caddy.sh
Last active June 21, 2021 07:32
Run caddy server as unprivileged user, includes Hugo option
#!/bin/bash
# *As root*
cd ~
killall caddy
rm -rf ~/caddy
mkdir caddy && cd caddy
curl -SL 'https://caddyserver.com/download/build?os=linux&arch=amd64&features=hugo' > caddy.tgz
tar xzf caddy.tgz
@phred
phred / Caddyfile
Created March 28, 2016 18:41
A+ grade on securityheaders.io with this: https://securityheaders.io/?q=https%3A%2F%2Ffff.red
fff.red {
header / {
Strict-Transport-Security "max-age=31536000; includeSubDomains"
Content-Security-Policy "default-src https:*"
Public-Key-Pins "pin-sha256=\"ckOIjdimiwD3mfMmkmCh7uiJCBtXvoqoBoKKB1K5UIM=\"; pin-sha256=\"QiTyymM4e635OgWkx9d7nq5xvEuqmgV7HiDjIIGyymo=\"; max-age=2592000"
X-Frame-Options SAMEORIGIN
X-XSS-Protection "1; mode=block"
X-Content-Type-Options nosniff
}
}
@hlandau
hlandau / rough-design.md
Last active April 24, 2016 19:00
Rough design for acmed

This is a rough sketch I've put together in my mind of how an 'ACME daemon' might end up looking.

API

acmetool is designed for batch operation which works well for small use cases but large scale deployments will work better with a daemon. This will probably expose a service via an HTTP API, so that arbitrary parts of a service provider's stack can request certificates.

This API will need to be asynchronous as it may take arbitrarily long for 'acmed'

@j-mcnally
j-mcnally / Caddyfile
Created January 14, 2016 20:02
Caddyfile - Example
config_server "https://etcd.local:2379"
service users {
endpoint: "/users",
proxy: "{{services.users.ip}}:{{services.users.port}}"
}
# In this example 'services.users' would be a directory with a json key for every user service container / application.
# Using this we could template the proxy and any other information in the services block, and it would just work with caddy.
apt-get update
apt-get install -y curl git mercurial make binutils bison gcc build-essential
git clone https://go.googlesource.com/go go14
git clone go14 go15
git clone go14 go16
#build all go versions
cd go14/src
@tgulacsi
tgulacsi / runit-caddy.md
Last active April 8, 2023 05:29
Using runit as a supervisor for Caddy

Supervisors

A supervisor's main task, is to start a specified process (in a specified environment), watch it running, and do something when it ends - usually based on the exit code.

From my experience, the environment setup can be a complex task (consult some config management for the required ports, actualize the config file from the central config management...), and this is where the most featureful supervisor (systemd, AFAIK) falls short:

  • it can setup & manage the listening sockets, and pass it to your app (if it can accept it - not hard, just have to be ready for it),