deis/deis — pull request #945 by carmstrong (2014-05-09 02:05:25+00:00)
Title: feat(user-data): add Docker index debugging service

Defines a systemd service which will capture traffic on port 443.

Some notes:
* Capture files will grow to 10MB each before tcpdump creates a new file
* Only 50 capture files will exist before tcpdump will overwrite them
* These mean that only 500MB is the maximum storage used for network dumps
* We use the core user since the fedora image is stored as /var/lib/toolbox/$USER-fedora --
this makes it so that we use the same image that is used when a user runs
`toolbox` on a CoreOS machine.

TESTING: Run `sudo systemctl start docker-index-network-logging` and
wait for the service to start (first time will take a few minutes,
as the toolbox is pulling a Fedora image). Then, do a few `docker pull`s
and then inspect the logs inside a `toolbox` shell:

```console
$ tcpdump -tttt -r /media/root/dumps/docker-index-logs.pcap00 |less
```

The output will look something like:
```console
2014-05-09 01:51:06.871078 IP 162.159.253.251.https > deis-1.59424: Flags [P.], seq 1947618:1949078, ack 821, win 65535, length 1460
2014-05-09 01:51:06.871078 IP deis-1.59424 > 162.159.253.251.https: Flags [.], ack 1949078, win 65535, length 0
2014-05-09 01:51:06.872202 IP 162.159.253.251.https > deis-1.59424: Flags [P.], seq 1949078:1950538, ack 821, win 65535, length 1460
2014-05-09 01:51:06.872218 IP deis-1.59424 > 162.159.253.251.https: Flags [.], ack 1950538, win 65535, length 0
```