Jacob Appelbaum | 3bb69c8 | 2012-07-09 22:22:27 +0200 | [diff] [blame] | 1 | tlsdate: secure parasitic rdate replacement |
| 2 | |
| 3 | tlsdate sets the local clock by securely connecting with TLS to remote |
| 4 | servers and extracting the remote time out of the secure handshake. Unlike |
| 5 | ntpdate, tlsdate uses TCP, for instance connecting to a remote HTTPS or TLS |
| 6 | enabled service, and provides some protection against adversaries that try to |
| 7 | feed you malicious time information. |
| 8 | |
Jacob Appelbaum | b1e5e8b | 2012-11-05 17:35:08 -0500 | [diff] [blame] | 9 | On Debian GNU/Linux and related systems, we provide an init.d script that |
| 10 | controls the tlsdated daemon. It will notice network changes and regularly |
| 11 | invoke tlsdate to keep the clock in sync. Start it like so: |
| 12 | |
| 13 | /etc/init.d/tlsdate start |
| 14 | |
Jacob Appelbaum | e205d62 | 2012-07-13 18:37:21 +0200 | [diff] [blame] | 15 | Here is an example an unprivileged user fetching the remote time: |
| 16 | |
| 17 | % tlsdate -v -V -n |
| 18 | V: tlsdate version 0.0.1 |
| 19 | V: We were called with the following arguments: |
| 20 | V: validate SSL certificates host = www.ptb.de:443 |
| 21 | V: time is currently 1342197117.577381 |
| 22 | V: using TLSv1_client_method() |
| 23 | V: SSL certificate verification passed |
| 24 | V: server time 1342197117 (difference is about 0 s) was fetched in 705 ms |
| 25 | Fri Jul 13 18:31:57 CEST 2012 |
| 26 | |
| 27 | |
Jacob Appelbaum | af07cb5 | 2012-01-18 16:09:19 +1100 | [diff] [blame] | 28 | This is an example run - starting as root and dropping to nobody: |
| 29 | |
Jacob Appelbaum | e205d62 | 2012-07-13 18:37:21 +0200 | [diff] [blame] | 30 | % sudo ./tlsdate -v |
| 31 | V: tlsdate version 0.0.1 |
Jacob Appelbaum | af07cb5 | 2012-01-18 16:09:19 +1100 | [diff] [blame] | 32 | V: We were called with the following arguments: |
Jacob Appelbaum | e205d62 | 2012-07-13 18:37:21 +0200 | [diff] [blame] | 33 | V: validate SSL certificates host = www.ptb.de:443 |
| 34 | V: time is currently 1342197222.273552 |
| 35 | V: using TLSv1_client_method() |
| 36 | V: SSL certificate verification passed |
| 37 | V: server time 1342197222 (difference is about 0 s) was fetched in 520 ms |
| 38 | V: setting time succeeded |
Jacob Appelbaum | b6bfa08 | 2012-01-30 03:46:22 -0800 | [diff] [blame] | 39 | |
Jacob Appelbaum | e205d62 | 2012-07-13 18:37:21 +0200 | [diff] [blame] | 40 | Here is an example with a custom host and custom port without verification: |
Jacob Appelbaum | b6bfa08 | 2012-01-30 03:46:22 -0800 | [diff] [blame] | 41 | |
Jacob Appelbaum | e205d62 | 2012-07-13 18:37:21 +0200 | [diff] [blame] | 42 | % sudo tlsdate -v --skip-verification -p 80 -H rgnx.net |
| 43 | V: tlsdate version 0.0.1 |
Jacob Appelbaum | b6bfa08 | 2012-01-30 03:46:22 -0800 | [diff] [blame] | 44 | V: We were called with the following arguments: |
Jacob Appelbaum | e205d62 | 2012-07-13 18:37:21 +0200 | [diff] [blame] | 45 | V: disable SSL certificate check host = rgnx.net:80 |
| 46 | WARNING: Skipping certificate verification! |
| 47 | V: time is currently 1342197285.298607 |
| 48 | V: using TLSv1_client_method() |
| 49 | V: Certificate verification skipped! |
| 50 | V: server time 1342197286 (difference is about -1 s) was fetched in 765 ms |
| 51 | V: setting time succeeded |
Jacob Appelbaum | af07cb5 | 2012-01-18 16:09:19 +1100 | [diff] [blame] | 52 | |
Jacob Appelbaum | 0a2934c | 2012-02-15 16:03:54 -0800 | [diff] [blame] | 53 | Here is an example of a false ticker that is detected and rejected: |
| 54 | |
| 55 | % sudo tlsdate -v -H facebook.com |
Jacob Appelbaum | e205d62 | 2012-07-13 18:37:21 +0200 | [diff] [blame] | 56 | V: tlsdate version 0.0.1 |
Jacob Appelbaum | 0a2934c | 2012-02-15 16:03:54 -0800 | [diff] [blame] | 57 | V: We were called with the following arguments: |
Jacob Appelbaum | e205d62 | 2012-07-13 18:37:21 +0200 | [diff] [blame] | 58 | V: validate SSL certificates host = facebook.com:443 |
| 59 | V: time is currently 1342197379.931852 |
Jacob Appelbaum | 0a2934c | 2012-02-15 16:03:54 -0800 | [diff] [blame] | 60 | V: using TLSv1_client_method() |
| 61 | V: SSL certificate verification passed |
Jacob Appelbaum | e205d62 | 2012-07-13 18:37:21 +0200 | [diff] [blame] | 62 | V: server time 2693501503 (difference is about -1351304124 s) was fetched in 724 ms |
Jacob Appelbaum | 0a2934c | 2012-02-15 16:03:54 -0800 | [diff] [blame] | 63 | remote server is a false ticker from the future! |
| 64 | |
Jacob Appelbaum | 894d527 | 2012-07-15 14:32:39 -0400 | [diff] [blame] | 65 | Here is an example where a system may not have any kind of RTC at boot. Do the |
Jacob Appelbaum | 920ea03 | 2012-07-15 22:06:02 -0400 | [diff] [blame] | 66 | time warp to restore sanity and do so with a leap of faith: |
Jacob Appelbaum | 894d527 | 2012-07-15 14:32:39 -0400 | [diff] [blame] | 67 | |
Jacob Appelbaum | c732f4e | 2012-07-15 22:38:46 -0400 | [diff] [blame] | 68 | % sudo tlsdate -v -V -l -t |
Jacob Appelbaum | 3eecb1a | 2012-07-15 21:39:20 -0400 | [diff] [blame] | 69 | V: tlsdate version 0.0.1 |
| 70 | V: We were called with the following arguments: |
| 71 | V: validate SSL certificates host = www.ptb.de:443 |
Jacob Appelbaum | 9f80729 | 2012-07-16 18:24:37 -0700 | [diff] [blame] | 72 | V: RECENT_COMPILE_DATE is 1342407042.000000 |
| 73 | V: time is currently 1342488229.659967 |
Jacob Appelbaum | 3eecb1a | 2012-07-15 21:39:20 -0400 | [diff] [blame] | 74 | V: time is greater than RECENT_COMPILE_DATE |
| 75 | V: using TLSv1_client_method() |
| 76 | V: freezing time for x509 verification |
Jacob Appelbaum | 9f80729 | 2012-07-16 18:24:37 -0700 | [diff] [blame] | 77 | V: remote peer provided: 1342488230, prefered over compile time: 1342407042 |
| 78 | V: freezing time with X509_VERIFY_PARAM_set_time |
Jacob Appelbaum | 3eecb1a | 2012-07-15 21:39:20 -0400 | [diff] [blame] | 79 | V: SSL certificate verification passed |
Jacob Appelbaum | 9f80729 | 2012-07-16 18:24:37 -0700 | [diff] [blame] | 80 | V: server time 1342488230 (difference is about -1 s) was fetched in 791 ms |
| 81 | Mon Jul 16 18:23:50 PDT 2012 |
Jacob Appelbaum | c732f4e | 2012-07-15 22:38:46 -0400 | [diff] [blame] | 82 | V: setting time succeeded |
Jacob Appelbaum | 3eecb1a | 2012-07-15 21:39:20 -0400 | [diff] [blame] | 83 | |