The idea is to deploy mirrors across dn42 using anycast addressing (BGP), thus providing redundancy, load-balancing and improved access times to the wiki. Sites are powered by gollum which has no native SSL support, so Nginx acts as a reverse proxy and handles the encryption. The local webserver is monitored with a simple shell script working in conjunction with ExaBGP, announcing/withdrawing the assigned route if the service is up/down.


  • Stable 24/7 connection to dn42.
  • Stable host machine, present in dn42.
  • Solid networking/sysadmin skills (to keep the system as a whole stable).

    In contrast with the general spirit in dn42, this service should NOT be deployed by unskilled members for the purpose of learning and exploring - since it is the primary source of information related to the project, it should not be used as a playground.

  • Software:

    It's recommended to use a debian distro on the host machine, where most of the above software can be installed using package manager(s) with ease. On some distros (RHEL based for example) it might not be an easy task.


  • Install wiki anycast IP addresses and fd42:d42:d42:80::1/64 on the system
  • Assign a unicast IP address to be used by Nginx
  • Establish connectivity to the dn42 network

Data replication

Site files are stored in a local DVCS repository (Git) on each node and replicated through a central server hosted by XUU-DN42. Since gollum is built on top of Git, it is not overly complicated to keep the local site in sync with others, each site only triggers periodic pulls/pushes from/to the Git server.

Setup the repo

  • Clone the dn42 wiki repo:

    git clone ssh://[email protected]/dn42/wiki <path>

  • Contact XUU-DN42 and ask for write access to the repo
  • Setup cron for periodic pull/push jobs for the repo (simple example):


    ```sh #!/bin/bash

WIKI_PATH= GIT=/usr/bin/git

cd "${WIKI_PATH}" ${GIT} push ${GIT} pull

exit 0 ```

 + **Cron entry**:

 `*/10 * * * * <path>/ &> /dev/null`

   Running in 10 minute intervals is reasonable, if you choose to change this, please keep it in the range from 5 to 15 minutes.


  • Install gollum
  • Start two gollum instances, read-only and read/write on

    Read/write (SSL only):

    RACK_ENV=production gollum --css --host  --port 4568 <path>


    RACK_ENV=production gollum --css --host  --port 4567 --no-edit <path>

    Set <path> to the location where wiki Git repo was cloned.

Nginx reverse proxy


  • Setup your maintainer object according to Automatic CA
  • Generate a CSR and send DNS Key Pin to [email protected]:
  • <AS> is the as number with the prefix as like
./ca.dn42 tls-gen \
   <AS>-<CC>(-<UID>).wiki.dn42 \
   [email protected] \

Wait for a reply and then sign the certificate:

./ca.dn42 tls-sign wiki.dn42 MIC92-MNT


Site identification

A custom header X-SiteID identifies the site you're connecting to:

  • add_header X-SiteID '<AS>-<ISO country code>';
    • <AS> is the as number prefixed with as like as64737
Enabling HPKP
  • Extract base64 encoded SPKI fingerprint from private key wiki.key:

    openssl rsa -in wiki.key -outform der -pubout | openssl dgst -sha256 -binary | openssl enc -base64
  • Configure Nginx to send the fingerprint in header (SSL block):

    add_header Public-Key-Pins  pin-sha256="<primary>"; pin-sha256="<backup>"; max-age=5184000; includeSubDomains';
  • <primary> - the fingerprint extracted from wiki.key
  • <backup> - the CA fingerprint: of00RDinhPeVRNnXm1jXQDagktOL75qQo1pT+xc7VIE=

Read more about this here.


The proxy should accept the following domain names:

  • internal.dn42
  • wiki.dn42

Nginx should listen on a unicast address as well, so your site can be reached exclusively. Assign an IP address for the occasion and send it to XUU-DN42 including your AS <aut-num> and the country code <CC> where your site is located. A forward DNS record will be created, pointing to the unicast IP address:

  • <aut-num>-<CC>(-<UID>).wiki.dn42

Config example

ssl_protocols  TLSv1.2 TLSv1.1 TLSv1;
ssl_session_cache shared:SSL:2m;

ssl_prefer_server_ciphers   on;

upstream wiki { server; }

server { 
        server_name internal.dn42 wiki.dn42 as<aut-num>-<cc>.wiki.dn42;

        listen default;
        listen [fd42:d42:d42:80::1]:80 default;
        listen <unicast ipv4> 80;
        listen [<unicast ipv6>]:80;

        add_header X-SiteID                   '<aut-num>-<cc>';

        location / {
                proxy_pass http://wiki;

upstream wikirw { server; }

server { 
        server_name internal.dn42 wiki.dn42 as<aut-num>-<cc>.wiki.dn42;

        listen ssl default;
        listen [fd42:d42:d42:80::1]:443 ssl default;
        listen <unicast ipv4> 443 ssl;
        listen [<unicast ipv6>]:443 ssl;

	ssl on;
        ssl_certificate      <path>/ssl.crt;  
        ssl_certificate_key  <path>/ssl.key;

        add_header strict-transport-security  "max-age=5184000; includeSubDomains";
        add_header Public-Key-Pins            'pin-sha256="<primary-pin>";pin-sha256="<backup-pin>";  max-age=5184000; includeSubDomains';
        add_header X-SiteID                   '<aut-num>-<cc>';

        location / {
                proxy_pass http://wikirw;



The prefix AS-PATH should show the announcement is originating from your AS. After peering ExaBGP to the nearest speaker(s), check if the prefix is routing properly inside your network. Try not to blackhole the passing traffic (e.g. no static routes to Test the whole thing by shutting down nginx/gollum and watch what happens.


# exabgp.conf

group gollum-watchdog {
  neighbor <peer1> {
    router-id x.x.x.x;
    local-address <source-address>;
    local-as <ownas>;
    peer-as <peeras>;

  ## (example ipv4) peer with one of our iBGP speakers:
  neighbor {
    local-as 123456;
    peer-as 123456;

  ## (example ipv6) peer with one of our iBGP speakers:
  neighbor fd42:4992:6a6d::1 {
    local-address fd42:4992:6a6d::2;
    local-as 123456;
    peer-as 123456;

  ## ...

  process watch-gollum {
     run <path>/;

Watchdog script

Watchdog runs in an infinite loop, sending the appropriate commands to stdout. ExaBGP attaches to the process' stdout and listens for instructions. Watchdog sends either a route announce or widthdraw.

Run in a shell first to validate it's working:



## url's to check (all listed must be alive to send announce)
URL=("" "" "http://[fd42:d42:d42:80::1]" "https://[fd42:d42:d42:80::1]")

## the anycast v6 route (/64 due to prefix size limits)
## the next-hop we'll be advertising to neighbor(s)

## regex match this keyword against HTTP response from curl


check_urls() {          
        for url in "${URL[@]}"; do
                ## workaround curl errno 23 when piping
                http_response=`${CURL} --insecure -g -s -L -o - "${url}"`
                echo "${http_response}" | egrep -q "${VALIDATE_KEYWORD}" || {
                        return 1

                ## add more checks

        return 0

while [ 1 ]; do
        if [ ${RUN_STATE} -eq 0 ]; then
                check_urls && {
                        echo "announce route ${ROUTE} next-hop ${NEXTHOP}"
                        echo "announce route ${ROUTE6} next-hop ${NEXTHOP6}"
                check_urls || {
                        echo "withdraw route ${ROUTE} next-hop ${NEXTHOP}"
                        echo "withdraw route ${ROUTE6} next-hop ${NEXTHOP6}"

        sleep ${INTERVAL}

exit 0


Normally SIGUSR1 to the exabgp process triggers a configuration update, but at occasion the process might need to be restarted - since its gracefull shutdown can be glitchy , this might be a bit difficult. Sending SIGKILL to the child(ren) and immediately after, the parent, does the job (quick-and-dirty).

USAGE: /etc/exabgp/ [start|stop|restart]





start() {
	[ -f ${PID_FILE} ] && {
		echo "WARNING: `cat ${PID_FILE}`: exabgp already running"; return 1
	${EXABGP} ${CONF} &> ${EXA_LOG} &
	[ ${cpid} -eq 0 ] && {
		echo "ERROR: could not start process"; return 1
        echo ${cpid} > ${PID_FILE}

	[ -f ${PID_FILE} ] || return 1 
	pkill -9 -P $(cat ${PID_FILE})
        kill -9  $(cat ${PID_FILE})
	rm -f ${PID_FILE}

case ${1} in
    start )
    stop )
    restart )
	sleep 1

exit 0