blob: 8e907d3ff670e832f732bd56e10bd2f0b75aab0a [file] [log] [blame]
Jacob Appelbaum3bb69c82012-07-09 22:22:27 +02001tlsdate: 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 Appelbaumb1e5e8b2012-11-05 17:35:08 -05009On Debian GNU/Linux and related systems, we provide an init.d script that
10controls the tlsdated daemon. It will notice network changes and regularly
11invoke tlsdate to keep the clock in sync. Start it like so:
12
13 /etc/init.d/tlsdate start
14
Jacob Appelbaume205d622012-07-13 18:37:21 +020015Here 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 Appelbaumaf07cb52012-01-18 16:09:19 +110028This is an example run - starting as root and dropping to nobody:
29
Jacob Appelbaume205d622012-07-13 18:37:21 +020030 % sudo ./tlsdate -v
31 V: tlsdate version 0.0.1
Jacob Appelbaumaf07cb52012-01-18 16:09:19 +110032 V: We were called with the following arguments:
Jacob Appelbaume205d622012-07-13 18:37:21 +020033 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 Appelbaumb6bfa082012-01-30 03:46:22 -080039
Jacob Appelbaume205d622012-07-13 18:37:21 +020040Here is an example with a custom host and custom port without verification:
Jacob Appelbaumb6bfa082012-01-30 03:46:22 -080041
Jacob Appelbaume205d622012-07-13 18:37:21 +020042 % sudo tlsdate -v --skip-verification -p 80 -H rgnx.net
43 V: tlsdate version 0.0.1
Jacob Appelbaumb6bfa082012-01-30 03:46:22 -080044 V: We were called with the following arguments:
Jacob Appelbaume205d622012-07-13 18:37:21 +020045 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 Appelbaumaf07cb52012-01-18 16:09:19 +110052
Jacob Appelbaum0a2934c2012-02-15 16:03:54 -080053Here is an example of a false ticker that is detected and rejected:
54
55 % sudo tlsdate -v -H facebook.com
Jacob Appelbaume205d622012-07-13 18:37:21 +020056 V: tlsdate version 0.0.1
Jacob Appelbaum0a2934c2012-02-15 16:03:54 -080057 V: We were called with the following arguments:
Jacob Appelbaume205d622012-07-13 18:37:21 +020058 V: validate SSL certificates host = facebook.com:443
59 V: time is currently 1342197379.931852
Jacob Appelbaum0a2934c2012-02-15 16:03:54 -080060 V: using TLSv1_client_method()
61 V: SSL certificate verification passed
Jacob Appelbaume205d622012-07-13 18:37:21 +020062 V: server time 2693501503 (difference is about -1351304124 s) was fetched in 724 ms
Jacob Appelbaum0a2934c2012-02-15 16:03:54 -080063 remote server is a false ticker from the future!
64
Jacob Appelbaum894d5272012-07-15 14:32:39 -040065Here is an example where a system may not have any kind of RTC at boot. Do the
Jacob Appelbaum920ea032012-07-15 22:06:02 -040066time warp to restore sanity and do so with a leap of faith:
Jacob Appelbaum894d5272012-07-15 14:32:39 -040067
Jacob Appelbaumc732f4e2012-07-15 22:38:46 -040068 % sudo tlsdate -v -V -l -t
Jacob Appelbaum3eecb1a2012-07-15 21:39:20 -040069 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 Appelbaum9f807292012-07-16 18:24:37 -070072 V: RECENT_COMPILE_DATE is 1342407042.000000
73 V: time is currently 1342488229.659967
Jacob Appelbaum3eecb1a2012-07-15 21:39:20 -040074 V: time is greater than RECENT_COMPILE_DATE
75 V: using TLSv1_client_method()
76 V: freezing time for x509 verification
Jacob Appelbaum9f807292012-07-16 18:24:37 -070077 V: remote peer provided: 1342488230, prefered over compile time: 1342407042
78 V: freezing time with X509_VERIFY_PARAM_set_time
Jacob Appelbaum3eecb1a2012-07-15 21:39:20 -040079 V: SSL certificate verification passed
Jacob Appelbaum9f807292012-07-16 18:24:37 -070080 V: server time 1342488230 (difference is about -1 s) was fetched in 791 ms
81 Mon Jul 16 18:23:50 PDT 2012
Jacob Appelbaumc732f4e2012-07-15 22:38:46 -040082 V: setting time succeeded
Jacob Appelbaum3eecb1a2012-07-15 21:39:20 -040083