Skip to content

Instantly share code, notes, and snippets.

mtigas / gist:952344
Last active Aug 3, 2021
Mini tutorial for configuring client-side SSL certificates.
View gist:952344

Client-side SSL

For excessively paranoid client authentication.

Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

mtigas / 0 ProPublica Tor hidden service
Last active Jul 29, 2021
Configuration for ProPublica’s Tor hidden service proxy.
View 0 ProPublica Tor hidden service

These files contain the base configuration for ProPublica’s Tor hidden service mirror.

Of note:

  • We're using the nginx "subs_filter" and "headers more" modules to allow us to rewrite content and update headers, so that we can convert clearnet links into onion links, where possible.

  • Based on feedback we've received, we're using Unix sockets (instead of a TCP port) where nginx listens internally for the inbound connection from Tor. This ensures that a firewall misconfiguration can't expose the site running in nginx, which is likely overkill for an already-public (clearnet) website; this may also slightly improve performance and reduce socket overhead, however.

    If you try doing this and have issues using sudo service nginx restart due to leftover connections using the socket, you may have to nuke the previous sockets before starting a new nginx process:

mtigas /
Last active Jun 30, 2021
Example code for running a (HTTP/HTTPS) Tor hidden service supporting subdomains.

The following files show an example of how to create subdomains for onion site hidden services. (This hasn't been tested for hidden services for anything other than HTTP/HTTPS.)

(You might also want to read our blog post about ProPublica’s Tor hidden service, including a tutorial and notes on running a hidden service: )

In general, this works (maybe just in recent Tor clients) because Tor will handle the connection to www.xxxxxxxxxxxxxxxx.onion as a connection to xxxxxxxxxxxxxxxx.onion. The encapsulated HTTP/HTTPS connection contains the subdomain in the Host: header (and in the case of HTTPS, the SNI

mtigas /
Last active May 21, 2021
experiments with using v3 onions with client auth (as of tor 0.3.5.X)
# needs openssl 1.1+
# needs `basez`
# (but something else that decodes the base64 and re-encodes the raw key bytes
# to base32 is probably fine too)
##### generate a key
openssl genpkey -algorithm x25519 -out /tmp/k1.prv.pem
mtigas /
Last active Apr 10, 2021
[macos] homebrew-installed signal w/v2 group support (fixes libzkgroup warning)
#!/usr/bin/env bash
set -e
set -x
brew install signal-cli || brew upgrade signal-cli
SIGNAL_LIBEXEC_LIBDIR="`brew --prefix signal-cli`/libexec/lib"
# zkgroup-java*.jar --- remove the linux x86_64 bundled lib
mtigas / nginx.conf
Last active Feb 20, 2021
Nginx configuration for (Based on Ubuntu 13.10 / Nginx 1.4.1 default config.)
View nginx.conf
# This configuration file is provided on an "as is" basis,
# with no warranties or representations, and any use of it
# is at the user's own risk.
# You will need to edit domain name information, IP addresses for
# redirection (at the bottom), SSL certificate and key paths, and
# the "Public-Key-Pins" header. Search for any instance of "TODO".
user www-data;
worker_processes 4;
mtigas / LICENSE.txt
Created Feb 9, 2011
Script that allows batch-downloading a person's full Facebook photo collection.
View LICENSE.txt
Copyright 2011 Mike Tigas. 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
mtigas /
Last active Sep 25, 2020
HTTPS / SSL certificate config stuff

Normal SSL cert

export DATE=`date +"%Y%m"`
export SITENAME="mike_tig_as"

# Generate private key, make it have no password.
# change to 2048 if you want compatibility with CDNs / aws cloudfront / load balancers, etc
openssl genrsa -aes256 -passout pass:xxxx -out "${KEYNAME}.pass.key" 4096
openssl rsa -passin pass:xxxx -in ${KEYNAME}.pass.key -out ${KEYNAME}.key

Moved to

A new version of this report is located at ProPublica. Includes more detail and a comment from Susan Prosser, Vice President of Industry Relations at DomainTools, about the how the DomainTools "IP Explorer" tool gathers the "C block owner" value.

The new version mostly just adds information, but previous versions of this gist can still be seen at the "Revisions" button to the left. Earlier versions should be considered draft quality.

mtigas / sunrise.html
Created Jun 7, 2010
Messing with HTML5 canvas to create a daylight clock visualization.
View sunrise.html
<!DOCTYPE html>
<html xmlns="" lang="en-US">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="" type="text/javascript"></script>
<script type="text/javascript">/*<![CDATA[*/
// TODO automate getting this data somehow