OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Command luci_machine_tokend runs on all machines via cron. | 5 // Command luci_machine_tokend runs on all machines via cron. |
6 // | 6 // |
7 // It wakes up each ~10 min, checks whether it needs to refresh existing machine | 7 // It wakes up each ~10 min, checks whether it needs to refresh existing machine |
8 // token, and refreshes it if necessary. | 8 // token, and refreshes it if necessary. |
9 // | 9 // |
10 // It also dumps information about its run into a status file (as JSON), that | 10 // It also dumps information about its run into a status file (as JSON), that |
(...skipping 22 matching lines...) Expand all Loading... |
33 "github.com/luci/luci-go/common/tsmon" | 33 "github.com/luci/luci-go/common/tsmon" |
34 | 34 |
35 "github.com/luci/luci-go/client/tokenclient" | 35 "github.com/luci/luci-go/client/tokenclient" |
36 "github.com/luci/luci-go/common/api/tokenserver" | 36 "github.com/luci/luci-go/common/api/tokenserver" |
37 "github.com/luci/luci-go/common/api/tokenserver/minter/v1" | 37 "github.com/luci/luci-go/common/api/tokenserver/minter/v1" |
38 ) | 38 ) |
39 | 39 |
40 // Version identifies the major revision of the tokend code. | 40 // Version identifies the major revision of the tokend code. |
41 // | 41 // |
42 // It is put in the status file (and subsequently reported to monitoring). | 42 // It is put in the status file (and subsequently reported to monitoring). |
43 const Version = "1.0" | 43 const Version = "1.1" |
44 | 44 |
45 // commandLine contains all command line flags. | 45 // commandLine contains all command line flags. |
46 // | 46 // |
47 // See registerFlags() for description of each individual flag. | 47 // See registerFlags() for description of each individual flag. |
48 type commandLine struct { | 48 type commandLine struct { |
49 PrivateKeyPath string | 49 PrivateKeyPath string |
50 CertificatePath string | 50 CertificatePath string |
51 Backend string | 51 Backend string |
52 TokenFile string | 52 TokenFile string |
53 StatusFile string | 53 StatusFile string |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 sort.Strings(keys) | 303 sort.Strings(keys) |
304 h := sha1.New() | 304 h := sha1.New() |
305 for _, k := range keys { | 305 for _, k := range keys { |
306 v := inputs[k] | 306 v := inputs[k] |
307 fmt.Fprintf(h, "%s\n%d\n", k, len(v)) | 307 fmt.Fprintf(h, "%s\n%d\n", k, len(v)) |
308 h.Write(v) | 308 h.Write(v) |
309 } | 309 } |
310 blob := h.Sum(nil) | 310 blob := h.Sum(nil) |
311 return hex.EncodeToString(blob[:]) | 311 return hex.EncodeToString(blob[:]) |
312 } | 312 } |
OLD | NEW |