Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: main.cc

Issue 6821025: entd: move opencryptoki initialization out of entd (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/entd.git@master
Patch Set: switch to using a flag to expect cryptohome to init pkcs11 Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « bin/entdwife.sh ('k') | reference_extension/client.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 #include <stdio.h> 5 #include <stdio.h>
6 #include <iostream> 6 #include <iostream>
7 #include <string> 7 #include <string>
8 8
9 #include <base/command_line.h> 9 #include <base/command_line.h>
10 #include <base/file_util.h> 10 #include <base/file_util.h>
11 #include <chromeos/syslog_logging.h> 11 #include <chromeos/syslog_logging.h>
12 12
13 #include "entd/entd.h" 13 #include "entd/entd.h"
14 #include "entd/extensions.h" 14 #include "entd/extensions.h"
15 #include "entd/callback_server.h" 15 #include "entd/callback_server.h"
16 #include "entd/http.h" 16 #include "entd/http.h"
17 #include "entd/pkcs11.h" 17 #include "entd/pkcs11.h"
18 #include "entd/tpm.h"
18 #include "entd/utils.h" 19 #include "entd/utils.h"
19 20
20 namespace switches { 21 namespace switches {
21 // Path to search for extensions; can contain ~ or env variables (e.g. ${HOME}) 22 // Path to search for extensions; can contain ~ or env variables (e.g. ${HOME})
22 static const char *kExtensionPath = "extension-path"; 23 static const char *kExtensionPath = "extension-path";
23 24
24 // User Name 25 // User Name
25 static const char *kUsername = "username"; 26 static const char *kUsername = "username";
26 27
27 // Policy files 28 // Policy files
(...skipping 21 matching lines...) Expand all
49 50
50 // Syslogging is enabled by default if stdout is not a tty. These flags can 51 // Syslogging is enabled by default if stdout is not a tty. These flags can
51 // be used to override the default logic. 52 // be used to override the default logic.
52 static const char *kEnableSyslog = "enable-syslog"; 53 static const char *kEnableSyslog = "enable-syslog";
53 static const char *kDisableSyslog = "disable-syslog"; 54 static const char *kDisableSyslog = "disable-syslog";
54 55
55 static const char *kLibcrosLocation = "libcros-location"; 56 static const char *kLibcrosLocation = "libcros-location";
56 57
57 static const char *kCallbackOrigin = "callback-origin"; 58 static const char *kCallbackOrigin = "callback-origin";
58 59
60 // TODO(crosbug.com/14277): Remove option and assume it is true.
61 static const char *kCryptohomeInitPkcs11 =
62 "cryptohome-init-pkcs11";
63
59 } // namespace switches 64 } // namespace switches
60 65
61 // Return values: 66 // Return values:
62 // 0: Entd completed successfully and should not be restarted. 67 // 0: Entd completed successfully and should not be restarted.
63 // 1: Entd encountered a failure, but will probably fail again if restarted, 68 // 1: Entd encountered a failure, but will probably fail again if restarted,
64 // so please don't. 69 // so please don't.
65 // 2: Entd has NOT encountered a failure, but would like to be restarted. 70 // 2: Entd has NOT encountered a failure, but would like to be restarted.
66 // >2: Entd has encountered a failure, restarting may help. 71 // >2: Entd has encountered a failure, restarting may help.
67 // 72 //
68 // So, exit with a zero or one means leave it down, otherwise restart. 73 // So, exit with a zero or one means leave it down, otherwise restart.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 LOG(INFO) << "Allowing self-signed certs."; 135 LOG(INFO) << "Allowing self-signed certs.";
131 entd::Http::allow_self_signed_certs = true; 136 entd::Http::allow_self_signed_certs = true;
132 } 137 }
133 138
134 if (cl->HasSwitch(switches::kLibcrosLocation)) { 139 if (cl->HasSwitch(switches::kLibcrosLocation)) {
135 entd::Entd::libcros_location = cl->GetSwitchValueASCII( 140 entd::Entd::libcros_location = cl->GetSwitchValueASCII(
136 switches::kLibcrosLocation); 141 switches::kLibcrosLocation);
137 LOG(INFO) << "Setting libcros location: " << entd::Entd::libcros_location; 142 LOG(INFO) << "Setting libcros location: " << entd::Entd::libcros_location;
138 } 143 }
139 144
145 if (cl->HasSwitch(switches::kCryptohomeInitPkcs11)) {
146 LOG(INFO) << "Expecting cryptohome to initialize the TPM token";
147 entd::Tpm::cryptohome_init_pkcs11 = true;
148 }
149
140 if (cl->HasSwitch(switches::kAllowFileIO)) { 150 if (cl->HasSwitch(switches::kAllowFileIO)) {
141 LOG(INFO) << "Allowing File IO."; 151 LOG(INFO) << "Allowing File IO.";
142 entd::Entd::allow_file_io = true; 152 entd::Entd::allow_file_io = true;
143 } 153 }
144 154
145 if (!root_ca_file.empty()) { 155 if (!root_ca_file.empty()) {
146 LOG(INFO) << "Setting root CA file: " << root_ca_file; 156 LOG(INFO) << "Setting root CA file: " << root_ca_file;
147 entd::Http::root_ca_file = root_ca_file; 157 entd::Http::root_ca_file = root_ca_file;
148 } 158 }
149 159
(...skipping 26 matching lines...) Expand all
176 if (!manifest.empty()) 186 if (!manifest.empty())
177 d.SetManifestFile(manifest); 187 d.SetManifestFile(manifest);
178 188
179 if (!policy.empty()) 189 if (!policy.empty())
180 d.SetPolicyFile(policy); 190 d.SetPolicyFile(policy);
181 191
182 uint32_t rv = d.Run(); 192 uint32_t rv = d.Run();
183 LOG(INFO) << "Exiting entd with code: " << rv; 193 LOG(INFO) << "Exiting entd with code: " << rv;
184 return rv; 194 return rv;
185 } 195 }
OLDNEW
« no previous file with comments | « bin/entdwife.sh ('k') | reference_extension/client.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698