chromiumos/platform/entd.git
2 years agoRevert "[entd] use libchromeos.pc" factory-1987.B master release-R18-1660.B release-R19-2046.B stabilize2
Scott James Remnant [Fri, 13 Jan 2012 01:58:55 +0000 (17:58 -0800)]
Revert "[entd] use libchromeos.pc"

This reverts commit 85d343eed33b02b480ca34cccd800b26f15d8d91

Change-Id: I195e215c44c6745f4fa75257d1a71795cb496494
Reviewed-on: https://gerrit.chromium.org/gerrit/14119
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
Tested-by: Scott James Remnant <keybuk@chromium.org>
2 years ago[entd] use libchromeos.pc
Elly Jones [Wed, 11 Jan 2012 22:06:19 +0000 (17:06 -0500)]
[entd] use libchromeos.pc

BUG=chromium-os:24959
TEST=build

Change-Id: Icbb14cea274501e002d5def4b9551af6eb9cb777
Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/14006
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2 years agoChanged PKCS #11 module from libopencryptoki.so to libchaps.so. factory-1412.B release-R17-1412.B stabilize
Darren Krahn [Tue, 8 Nov 2011 18:29:39 +0000 (10:29 -0800)]
Changed PKCS #11 module from libopencryptoki.so to libchaps.so.

BUG=chromium-os:21005
TEST=emerge-x86-generic and emerge-arm-generic

Change-Id: Ib8e6bbb5249497abace9afb79d2f5a3b378cae44
Reviewed-on: https://gerrit.chromium.org/gerrit/11433
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Reviewed-by: Ken Mixter <kmixter@chromium.org>
Tested-by: Darren Krahn <dkrahn@chromium.org>
Commit-Ready: Darren Krahn <dkrahn@chromium.org>

2 years agoChange to use new location of shflags factory-1284.B firmware-kiev-2.112.B firmware-uboot_v2-1299.B
Sonny Rao [Fri, 21 Oct 2011 08:06:42 +0000 (08:06 +0000)]
Change to use new location of shflags

BUG=chromium-os:21742
TEST=manual verify this works with new dev-utils/shflags package

Change-Id: Idab182a0854e55b2444dbc6b87b73346d9466643
Reviewed-on: https://gerrit.chromium.org/gerrit/10476
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
2 years agoentd: Add hooks for enterprise-specific client messages factory-1235.B release-R16-1193.B
Ken Mixter [Thu, 29 Sep 2011 23:40:58 +0000 (16:40 -0700)]
entd: Add hooks for enterprise-specific client messages

BUG=chromium-os:21024
TEST=manual tests with old and new chrome

Change-Id: Ie4fc58e59d53346b0f4d51af2054825412a83e26
Reviewed-on: http://gerrit.chromium.org/gerrit/8577
Reviewed-by: Ken Mixter <kmixter@chromium.org>
Tested-by: Ken Mixter <kmixter@chromium.org>
2 years agoentd: Removed dependency on PRIVATE_ROOT_KEY.pem which will no longer be created. factory-1020.B factory-980.B release-1011.B test-982.B
Darren Krahn [Fri, 19 Aug 2011 15:47:16 +0000 (08:47 -0700)]
entd: Removed dependency on PRIVATE_ROOT_KEY.pem which will no longer be created.

BUG=chromium-os:19256
TEST=Login without pem files.

Change-Id: I186c4d2886ede9b42258f0b521bf844a8aef4f60
Reviewed-on: http://gerrit.chromium.org/gerrit/6340
Tested-by: Darren Krahn <dkrahn@chromium.org>
Reviewed-by: Darren Krahn <dkrahn@chromium.org>
3 years agoentd: Upon finding multiple matching certs, pick one
Ken Mixter [Sat, 23 Jul 2011 01:03:46 +0000 (18:03 -0700)]
entd: Upon finding multiple matching certs, pick one

Instead of erroring out like there are no certs when multiple exist,
pick one assuming all are the same.  This may help some users who
get in cycles of needing to reinstall certs on every logout/login.
I think flimflam multiprofile will also fix them since Google-A
doesn't need to be re-setup every time you log in by entd.

BUG=chromium-os:17219
TEST=test:
1) it shows correct status when only one cert is installed
2) it shows "Installed." when multiple certs are installed

To install multiple certs:
Install certificate as usual
openssl pkcs12 -in /home/chronos/user/Downloads/clientCert.p12  -out file.pem
// split file.pem into a .crt and .key file by hand (pem format)
openssl rsa -in /tmp/foo.key -out /tmp/foo.keyder -outform der
openssl x509 -in /tmp/foo.crt -out /tmp/foo.der -outform der
pkcs11-tool --module=/usr/lib/opencryptoki/PKCS11_API.so -O -p 111111 -y privkey -w /tmp/foo.keyder -a 'whatever' -d 03
pkcs11-tool --module=/usr/lib/opencryptoki/PKCS11_API.so -O -p 111111 -y cert -w /tmp/foo.der -a 'whatever' -d 03

Unfortunately this installs a cert that won't work with Google-A.  In my testing, I believe WPA supplicant is picking
that cert and reject occurs.

Change-Id: Ia95e8a3bd3824457bc0bb4703850b308a889104e
Reviewed-on: http://gerrit.chromium.org/gerrit/4628
Reviewed-by: Robert Ginda <rginda@chromium.org>
Reviewed-by: Ken Mixter <kmixter@chromium.org>
Tested-by: Ken Mixter <kmixter@chromium.org>
3 years agoDeleted an unused variable (fun).
Ahmad Sharif [Mon, 15 Aug 2011 19:30:22 +0000 (12:30 -0700)]
Deleted an unused variable (fun).

TEST=cros_workon start --board=$board entd && emerge-$board entd
BUG=chromium-os:19174

Change-Id: If5dc361dd574e3ba13b254d1348f4936a02329fc
Reviewed-on: http://gerrit.chromium.org/gerrit/6013
Tested-by: asharif <asharif@chromium.org>
Reviewed-by: Anush Elangovan <anush@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
3 years agoentd: Present version information to enterprise extension 0.15.877.B firmware-881-u-boot-v1 firmware-u-boot-v1
Ken Mixter [Fri, 1 Jul 2011 23:42:03 +0000 (16:42 -0700)]
entd: Present version information to enterprise extension

BUG=chromium-os:15553
TEST=start and verify logs indicate parsed version number

Change-Id: Ic78a27956920ecc39e79ff6a7f82df46aedd3d71
Reviewed-on: http://gerrit.chromium.org/gerrit/3598
Reviewed-by: Ken Mixter <kmixter@chromium.org>
Tested-by: Ken Mixter <kmixter@chromium.org>
3 years agoentd: Respect PKG_CONFIG variable if set in the environment. 780.B
David James [Tue, 7 Jun 2011 16:56:55 +0000 (09:56 -0700)]
entd: Respect PKG_CONFIG variable if set in the environment.

This is required for the new cross-compilation support using pkg-config
wrappers instead of changing the pkg-config files themselves.

BUG=chromium-os:16245
TEST=Compile entd on arm with and without PKG_CONFIG variable set.
     When the *.pc files don't have SYSROOT hardcoded into them,
     using the PKG_CONFIG wrapper ensures that we look in the board
     for libs instead of /usr/lib.

Change-Id: Iaff59b826aa059b7f6138de301004d82c763ac0d
Reviewed-on: http://gerrit.chromium.org/gerrit/2222
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: David James <davidjames@chromium.org>
3 years agoentd: fix problem problem with multi-second timeouts on ARM
Ken Mixter [Fri, 3 Jun 2011 19:32:47 +0000 (12:32 -0700)]
entd: fix problem problem with multi-second timeouts on ARM

BUG=chromium-os:160007
TEST=ran with pkcs11 failing on x86 and verified multiple-minute timeouts work correctly

Change-Id: If4a6cc8cdf8dc132d5520d183983d40144a93a56
Reviewed-on: http://gerrit.chromium.org/gerrit/2100
Tested-by: Ken Mixter <kmixter@chromium.org>
Reviewed-by: Sam Leffler <sleffler@chromium.org>
3 years agoentd: if pkcs11 system is down back off on retries until trying each hour 0.13.558.B
Ken Mixter [Mon, 23 May 2011 21:07:09 +0000 (14:07 -0700)]
entd: if pkcs11 system is down back off on retries until trying each hour

BUG=none
TEST=login in state where token is not initialized, verify backoff based on logs

Change-Id: Ied5659279d22b305845ead262735bd6a6f47c7e7
Reviewed-on: http://gerrit.chromium.org/gerrit/1386
Tested-by: Ken Mixter <kmixter@chromium.org>
Reviewed-by: Robert Ginda <rginda@chromium.org>
3 years agoentd: expect cryptohome to initialize pkcs11 by default
Ken Mixter [Fri, 20 May 2011 17:11:41 +0000 (10:11 -0700)]
entd: expect cryptohome to initialize pkcs11 by default

BUG=chromium-os:14277
TEST=bvt && below:
1) Log into device without tpm token
2) load enterprise extension and get a certificate
3) log out
4) log in, certificate persists
5) verify secure_certificates it not a crosh command
6) verify if pkcsslotd is started slowly by cryptohome the
   extension/entd recovers ok not needing to have entd
   start after pkcsslotd.

Change-Id: I651b04dde445966c5f698e23f0636b0d692687a7
Reviewed-on: http://gerrit.chromium.org/gerrit/1272
Tested-by: Ken Mixter <kmixter@chromium.org>
Reviewed-by: Robert Ginda <rginda@chromium.org>
3 years agoentd: wait for cryptohomed to initialize opencryptoki tpm token
Ken Mixter [Fri, 20 May 2011 00:32:51 +0000 (17:32 -0700)]
entd: wait for cryptohomed to initialize opencryptoki tpm token

Also blow away the old pkcs11.cc since it's old enough now and we
don't want to it to initialize early.

BUG=chromium-os:14462 chromium-os:9982
TEST=below: (requires pending 15495 fix)
Do these both with secure_certs on and off
1) blow away user's .tpm directory
2) log in as user
3) verify that eventually enterprise daemon shows an initialized
TPM token (or in non-secure certs, that you can click the initialize
button and initialize the token)
4) install a certificate

Change-Id: If364261e15b312963bcb45da527c6f72f9d0bde7
Reviewed-on: http://gerrit.chromium.org/gerrit/1224
Reviewed-by: Robert Ginda <rginda@chromium.org>
Tested-by: Ken Mixter <kmixter@chromium.org>
3 years ago[entd] Roll forward to new libchrome
Chris Masone [Thu, 12 May 2011 21:09:35 +0000 (14:09 -0700)]
[entd] Roll forward to new libchrome

BUG=chromium-os:14304
TEST=build, unit tests

Change-Id: I8d65eb5922c7a2cd7c1e0020c5487930d4c4bc29
Reviewed-on: http://gerrit.chromium.org/gerrit/817
Reviewed-by: Robert Ginda <rginda@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
3 years agoentd: move opencryptoki initialization out of entd 0.12.433.B 0.12.433.B109 0.12.433.B62 0.13.434.B 0.13.509.B
Ken Mixter [Tue, 19 Apr 2011 18:38:56 +0000 (11:38 -0700)]
entd: move opencryptoki initialization out of entd

Look for a file /home/chronos/.cryptohome-init-pkcs11 and expect cryptohome to initialize the PKCS#11 token, disabling that interface in newer extensions.

Change-Id: I363ec0ef093d58d793a3d75e22dee96b58bdacd3

R=rginda@chromium.org
BUG=chromium-os:12304
TEST=
old extension / new entd (w/ and w/o flag)
new extension / old entd:
new extension / new entd (w/ and w/o flag):

When flag is set with new entd, Initialize button disappears and we wait for cryptohomed to signal the TPM token is ready.

Review URL: http://codereview.chromium.org/6821025

3 years agoentd: require a per-entd-invocation session id in every request
Ken Mixter [Tue, 19 Apr 2011 17:36:30 +0000 (10:36 -0700)]
entd: require a per-entd-invocation session id in every request

Change-Id: Ic63af59fa1371a0ac4ea9f1576acdab79216afb1

BUG=chromium-os:5813
TEST=
old extension / new entd
1) open extension options
2) loading fails with a message about entd not starting, logs indicate failure

new extension / old entd
1) open extension options
2) works as expected since all old headers still are sent and new one is
ignored

new extension / new entd
1) open extension options
2) works as expected - session id is sent in every request as expected by entd

Review URL: http://codereview.chromium.org/6874035

3 years agoAdd chromeos_network_deprecated.h 0.11.241.B 0.11.257.B 0.11.257.B90 0.12.362.B 0.12.369.B 0.12.392.B 11.1.241.B
Steven Bennetts [Fri, 4 Mar 2011 00:38:04 +0000 (16:38 -0800)]
Add chromeos_network_deprecated.h

Change-Id: Ib2d733e6044a4581e48b1542c2d288559bb38f30

BUG=Build broke due to http://codereview.chromium.org/6606024/
TEST=Ensure builds.

Review URL: http://codereview.chromium.org/6609045

3 years agoentd: Factor out syslog_logger code and start using it
Ken Mixter [Thu, 3 Mar 2011 16:55:39 +0000 (08:55 -0800)]
entd: Factor out syslog_logger code and start using it

Change-Id: I4a136cbe89605460e4c355c7a2009c3cef704af8

BUG=none
TEST=Fire up entd and verify it logs to /var/log/messages

Review URL: http://codereview.chromium.org/6594001

3 years agoentd: Fix problem where a future date setting causes TPM token to be cleared often
Ken Mixter [Wed, 9 Feb 2011 17:30:39 +0000 (09:30 -0800)]
entd: Fix problem where a future date setting causes TPM token to be cleared often

Change-Id: Icd14783f08c6761c74a35cec10821e3e97ce74ae

BUG=chrome-os-partner:2227
TEST=gmerge to device, set file to future, see .tpm directory persist

Review URL: http://codereview.chromium.org/6312172

3 years agoExplicitly logging out the token to avoid leaving it in a non-stable state.
Nelson Araujo [Tue, 18 Jan 2011 23:57:39 +0000 (15:57 -0800)]
Explicitly logging out the token to avoid leaving it in a non-stable state.

Just calling session.close() will, sometimes, leave the TPM in an inconsistent state which will cause it to generate a bad RSA key, despite reporting key generation successful. Further use of the key will generate incorrect signatures.

Problem does not reproduce all the time, and the likelihood of happening appears to vary depending on the hardware used (Cr-48 > AGZ > L13). Calling session.logout() before session.close() fixes the issue.

Change-Id: Ib601818e180243ecf1f59e40f46d141e1d826286

BUG=chromium-os:10536
TEST=enroll a certificate and successfully connect to Google-A on Cr-48 device.

Review URL: http://codereview.chromium.org/6338003

3 years agoRemoving isInstalledComplete (not needed).
Nelson Araujo [Mon, 10 Jan 2011 23:25:59 +0000 (15:25 -0800)]
Removing isInstalledComplete (not needed).

Change-Id: Iab99c7a8e4cc4ce6f345b4cf715f945bf0ecc89b

BUG=chromium-os:331
TEST=all pkcs11 run_tests.sh passed.

Review URL: http://codereview.chromium.org/6176006

3 years agoPolicy changes for 802.11x to use new PKCS#11 API.
Nelson Araujo [Tue, 21 Dec 2010 17:58:25 +0000 (09:58 -0800)]
Policy changes for 802.11x to use new PKCS#11 API.

Change-Id: Ic2d0af12ca72ec5ca4cd59bb1f4cebb5de198f5b

BUG=chromium-os:331
TEST=all pkcs11 run_tests.sh passed.

Review URL: http://codereview.chromium.org/5418001

3 years ago- OpenSSL engine
Nelson Araujo [Mon, 13 Dec 2010 20:32:46 +0000 (12:32 -0800)]
- OpenSSL engine
- OpenSSL CSR object

  Generates X.509 certificate requests using a private key
  stored in the PKCS#11 device.

- OpenSSL X.509 object

  Loads and converts X.509 objects from/to:
  DER, PEM and PEM-text.

- Test cases

BUG=chromium-os:9982
TEST=all pkcs11 entd/run_tests.sh succeeded.

Review URL: http://codereview.chromium.org/5356005

Change-Id: I16a25cdd8847c85f2b28ef60f71f29010fe05d91

3 years ago- PKCS#11 API implementation for EntD
Nelson Araujo [Mon, 13 Dec 2010 19:51:44 +0000 (11:51 -0800)]
- PKCS#11 API implementation for EntD
  * GenerateKeyPair
  * CreateObject
  * DestroyObject
  * FindObjects
- API test cases

BUG=chromium-os:9982
TEST=all pkcs11 entd/run_tests.sh succeeded.

Review URL: http://codereview.chromium.org/4813003

Change-Id: Iefffb3d907a53a26462ed595a43f4d1f9df885fe

3 years agoentd: Add logging to aid in debug/test
Ken Mixter [Tue, 23 Nov 2010 21:25:22 +0000 (13:25 -0800)]
entd: Add logging to aid in debug/test

Change-Id: I0df37d112b1f894e3dd8f78bbf31d951e24d2452

BUG=9282
TEST=logging_DBusCalls

Review URL: http://codereview.chromium.org/5192003

3 years agoentd: Finalize PKCS11 API on exit
rginda [Tue, 16 Nov 2010 18:14:06 +0000 (10:14 -0800)]
entd: Finalize PKCS11 API on exit

Unfortunately this doesn't fix the problem with pkcsslotd refusing to exit, but it does seem like a good idea to call C_Finalize anyways.

BUG=chromium-os:9218
TEST=./run_tests.sh on local machine; gmerge onto device and observe the log message.

Review URL: http://codereview.chromium.org/4949001

Change-Id: I8c2140b2ab733fffb6711abab1ba166fb94ad730

3 years ago[entd] switch to curl instead of wget
Chris Masone [Mon, 25 Oct 2010 20:50:33 +0000 (13:50 -0700)]
[entd] switch to curl instead of wget

entd already depends on curl, and had an implicit dep on wget.  wget went away and broke entd.  Switch to curl to mitigate.

BUG=8094
TEST=install entd on the device and do enterprise_ca_approve

Change-Id: I2b4f3712a1c9cb5e76a6c93e4fe2184b48ee3b91

Review URL: http://codereview.chromium.org/4034009

3 years agodisable certificate chaining by default
rginda [Thu, 21 Oct 2010 16:11:03 +0000 (09:11 -0700)]
disable certificate chaining by default

After this change, the approved cert must be exactly the same as the one used to sign the enterprise extension.  This is to mitigate the risk of not enforcing a particular key usage on the signing cert.  Anyone who still wants the old behavior can get it by approving with the --allow_chaining option.

BUG=chromium-os:7977
TEST=test in chroot, gmerge on device

Review URL: http://codereview.chromium.org/4026001

Change-Id: I60100caaaaf99a1731bbc36e0718bab5e769aa50

3 years agodon't start entd for gmail users
rginda [Wed, 20 Oct 2010 21:36:07 +0000 (14:36 -0700)]
don't start entd for gmail users

BUG=None
TEST=gmerge onto device, log in @gmail.com with extension installed and watch for the new log message.  log in @google.com and ensure entd still works.

Review URL: http://codereview.chromium.org/3991001

Change-Id: I32b9c509d52b9733d09dcf469252285c03af2143

3 years agoentd: display useful messages based on the current status of the tpm
rginda [Wed, 20 Oct 2010 20:26:34 +0000 (13:26 -0700)]
entd: display useful messages based on the current status of the tpm

BUG=
TEST=Simulate failures on local box, install on device

Review URL: http://codereview.chromium.org/3870002

Change-Id: Ie47591053f865d21439a88036d865d6605936e85

3 years agoEntd: verify that callback requests come from the correct origin
rginda [Tue, 19 Oct 2010 21:51:16 +0000 (14:51 -0700)]
Entd: verify that callback requests come from the correct origin

This patch teaches entd to refuse any callback request that does not come from the expected
extension, as determined by the Origin header.

BUG=chromium-os:7280
TEST=gmerge onto device

Review URL: http://codereview.chromium.org/3906002

Change-Id: I26232be3bbb2022c1b1e0879262e964c55e35dbc

3 years agoentd.tpm: Add isOwned and isBeingOwned
rginda [Mon, 11 Oct 2010 23:14:35 +0000 (16:14 -0700)]
entd.tpm: Add isOwned and isBeingOwned

Change-Id: I519078d6703796cbd21fa5070918bfa5bf193412

BUG=None
TEST=./run_tests.sh

Review URL: http://codereview.chromium.org/3721002

3 years agoentdwife: add approve/revoke commands
rginda [Mon, 11 Oct 2010 18:38:00 +0000 (11:38 -0700)]
entdwife: add approve/revoke commands

Change-Id: I6d95fe6356802c315d67f41a5fe3090a91513f66

BUG=chromium-os:4621
TEST=in progress

Review URL: http://codereview.chromium.org/3550022

3 years agoentd: add libdl for dlopen and friends
rginda [Tue, 5 Oct 2010 21:20:41 +0000 (14:20 -0700)]
entd: add libdl for dlopen and friends

This is needed by libcrosapi.  A cleaner fix would be to add a pkgconfig to libcrosapi, which
entd would use to determine its dependencies, but this is much more expedient.

Change-Id: Idfedcd3c3025a64e836b3e65e8c3d9bfb24998ee

BUG=None
TEST=re-make entd in chroot, verify that -ldl appears in linker command line

Review URL: http://codereview.chromium.org/3575015

3 years agoentd: Add policy signatures
rginda [Mon, 4 Oct 2010 23:33:42 +0000 (16:33 -0700)]
entd: Add policy signatures

This is a first pass at signed enterprise policies.  A single script is provided that can sign policies and verify signatures.  Another CL will use this script to start the enterprise daemon after verifying the signature.

In the future the signature verification should be baked directly into entd.

entdwife.sh: initial add of utility script to sign and verify policies.
main.cc: check for root-cert.pem, root_cert.pem as a backup.
fix_pkcs11_token.sh: add lcense header.
add trailing / to 127.0.0.1 permission check.

BUG=chromium-os:4621
TEST=gmerge onto device and test with signed and unsigned policies

Review URL: http://codereview.chromium.org/3541011

Change-Id: I5ccfa07697e61b80e389787637e5c6ec7ba32d53

3 years agoentd: Fix flag-splitting in SConstruct.
Daniel Erat [Thu, 9 Sep 2010 00:19:39 +0000 (17:19 -0700)]
entd: Fix flag-splitting in SConstruct.

Compiler flags taken from the environment weren't being
split correctly, which resulted in them being ignored when
set in the SConstruct file.

Change-Id: I0daa0be3666cda79341fabb18f9765196ccdd62c

BUG=none
TEST=tested that the package builds with the existing ebuild, and that the compiler flags that I'm providing in another change that I'm working on are now honored

Review URL: http://codereview.chromium.org/3357016

3 years agoentd: Call logging::InitLogging
rginda [Tue, 7 Sep 2010 19:49:31 +0000 (12:49 -0700)]
entd: Call logging::InitLogging

Change-Id: I87de5ac2fa45a05dc9889729e6d7b52b5b184c7d

BUG=chromium-os:6447
TEST=start entd in chroot with stdout as a terminal and again redirected to a file

Review URL: http://codereview.chromium.org/3303012

3 years agofix_pkcs11_token: detect if a token is from a previous tpm owner
rginda [Thu, 2 Sep 2010 23:56:25 +0000 (16:56 -0700)]
fix_pkcs11_token: detect if a token is from a previous tpm owner

There is a bit of refactoring in here too, to avoid stairstepping if/thens.

BUG=chromium-os:6064
TEST=simulate various failures in dev environment

Change-Id: Ic4d8ce36671c8ab289ff91c7063c7a8523e71efa

Review URL: http://codereview.chromium.org/3362005

3 years agolook for NVTOK.DAT rather than public key
rginda [Thu, 2 Sep 2010 22:00:02 +0000 (15:00 -0700)]
look for NVTOK.DAT rather than public key

This script bailed out if PUBLIC_ROOT_KEY.pem was missing, because I assumed that this file would always appear if we started to initialize the token.  It turns out that that is not the case.  NVTOK.DAT is a much more reliable file to test for, since it is created before we set any token PINs.

BUG=6064
TEST=none

Change-Id: I815a4bd764dc7f0ed92c332fb6200d0989a8774c

Review URL: http://codereview.chromium.org/3302004

3 years agoentd: Cope with timeout during user pin initialization
rginda [Wed, 25 Aug 2010 17:24:29 +0000 (10:24 -0700)]
entd: Cope with timeout during user pin initialization

Turns out that when we fail due to a timeout when initializing the user pin, we end up without some
important files in the TOK_OBJ directory.  This patch detects that problem and removes the broken
token.  It also makes sure the script emits a log line explaining what it found each time it runs.

BUG=chromium-os:6064
TEST=tested various permutations in chroot.

Change-Id: I60c6131224da24bae71abd4c9287216688f1e5cf

Review URL: http://codereview.chromium.org/3200009

3 years agoRemove obsolete file chromeos_tpm_init
Luigi Semenzato [Wed, 25 Aug 2010 14:13:51 +0000 (07:13 -0700)]
Remove obsolete file chromeos_tpm_init

Review URL: http://codereview.chromium.org/3152039

Change-Id: Ia1ef6f91ee4a72e72539e35624f4f7c1134e0229

3 years agoentd: Restart on token init failure
rginda [Tue, 24 Aug 2010 01:01:56 +0000 (18:01 -0700)]
entd: Restart on token init failure

This change causes us to restart entd if token initialization fails.

The most common cause for token init to fail is a hardware timeout, which
leaves the token in a state which we can't easily recover from.

After this change (and changes in init and the ebuild), we will restart entd,
detect and delete the broken token, and the user will be able to retry the
initialization.

BUG=None
TEST=gmerge onto gadget, force a failure, and witness the recovery.

Change-Id: Iaf7a8472392ffd928f3852262db49d378ca60fdd

Review URL: http://codereview.chromium.org/3107031

4 years agoFix success criteria for shot(Cert|Token)Details.
rginda [Thu, 19 Aug 2010 18:43:26 +0000 (11:43 -0700)]
Fix success criteria for shot(Cert|Token)Details.

In a revious changelist the "success state" for certs and tokens was changed to be "stop:ready" for both.  The details dialog missed the memo.

BUG=None
TEST=test in dev environment

Change-Id: I063e28942dd5f971d94812f37b5868447bd549d0

Review URL: http://codereview.chromium.org/3174019

4 years agopay attention to the requestHeaderValue in the manifest
rginda [Wed, 18 Aug 2010 23:14:10 +0000 (16:14 -0700)]
pay attention to the requestHeaderValue in the manifest

The current reference extension uses the default request header value of "magic".  This means that any extension that knows (or guesses) that is able to send commands to the enterprise daemon.

This change makes the exploit slightly smaller, by paying attention to the manifest.requestHeaderValue.  Now only extensions that know which value is expected by the enterprise policy will be able to send commands to entd.

BUG=chromium-os:5813
TEST=run in test environment

Change-Id: I96ac612fd1e0364bc82308b87e6dfc9ecb4fec91

Review URL: http://codereview.chromium.org/3181021

4 years agofix auto-hideModal code
rginda [Tue, 17 Aug 2010 21:37:35 +0000 (14:37 -0700)]
fix auto-hideModal code

The previous change tried to remove some boilerplate hideModal(...showModal..) code, but got it
slightly wrong.  The new client.modalContext would get set before the previous modal went away.  When
the previous modal finaly did go away, it cleared out the new modal's context.

This fixes the issue by moving the asychronous code a little further up the stack, pausing the entire
show call until the previous modal has been hidden.

BUG=None
TEST=install on the device

Change-Id: I37a2cd834a07936ac61ab4bc037d5cc4d073fe16

Review URL: http://codereview.chromium.org/3181020

4 years agoadd missing underscore
rginda [Tue, 17 Aug 2010 18:31:10 +0000 (11:31 -0700)]
add missing underscore

Change-Id: Ic4c9034b9f65a3cb251b1fd815582c077922cf94
TBR: cmasone@chromium.org

4 years agoGive feedback when tpm is disabled or not ready
rginda [Tue, 17 Aug 2010 18:13:16 +0000 (11:13 -0700)]
Give feedback when tpm is disabled or not ready

Show some dialogs to the user if their tpm is in a funny state.
This patch includes a change to showModal so that it hides any existing modal first, so that the
hideModal(...showModal...) pattern can go away.

BUG=chromium-os:5428
TEST=tweak test environment to fake a disabled and unowned tpm.

Change-Id: I621187f454af78dc66113441e9750d07ea1b7fc7

Review URL: http://codereview.chromium.org/3108026

4 years agoadd entd.tpm.(isReady.isEnabled)
rginda [Tue, 17 Aug 2010 01:11:00 +0000 (18:11 -0700)]
add entd.tpm.(isReady.isEnabled)

Review URL: http://codereview.chromium.org/3132013

Change-Id: I0ae40f72657969ee2622dbeea0d7c8ca3ca85bed

4 years agoentd: fix testcases
rginda [Mon, 16 Aug 2010 20:49:58 +0000 (13:49 -0700)]
entd: fix testcases

Added missing http-leak.js testcase, which had never made it into git
Added isa-cros-policy files to make the extension detection pass
Modify run_tests.sh to do a bit of pkcs11 initializaton, and warn if the current user is not in the
pkcs11 group.

BUG=None
TEST=run_tests.sh

Change-Id: I449db16c668b29b525151f8e63b50bd0f089ac62

Review URL: http://codereview.chromium.org/3189002

4 years agoentd: Messaging cleanup
rginda [Mon, 16 Aug 2010 20:12:31 +0000 (13:12 -0700)]
entd: Messaging cleanup

This clears up a few messages from the policy extension, and guides the user to initalize their
token before installing the certificate.

There is also a change to crypto_pkcs11.cc so that pkcs11 error codes appear as their mnemonics,
rather than hex values.

Review URL: http://codereview.chromium.org/3171009

Change-Id: I7c528ac47f705aeb54876c5b6c4aca738bada4ab

4 years agoAdd "chrome enterprise" support to entd
rginda [Wed, 11 Aug 2010 16:56:29 +0000 (09:56 -0700)]
Add "chrome enterprise" support to entd

This CL makes it posible to specify a chrome enterprise browser policy as part of the chromeos
enterprise policy.

BUG=chromium-os:5445
TEST=run_tests.sh && configure proxy from extension on actual gadget

Change log:

* policy-utils.js
  Add logic to load browser policy from the extension manifest.  Policy comes
from the manifest rather that from a cb:callback because enterprises are going
to want to force some settings that the user isn't allowed to change.  A
cb:callback could be trivially invoked by a user from the javascript console.

  Pass back to the policy UI a flag indicating whether or not the policy has
changed.  If it has, the UI probably wants to tell the user they should restart.

* browser.cc/h
  New "entd.browser" object.  This object has "managedPolicy" and
"recommendedPolicy" objects which can be modified by the enterprise policy.
V8 "named property handlers" are used to intercept reads and deletes from these
objects so they can be persisted to disk.

* crypto_pkcs11.cc/h
  Small tweaks to move the "ThrowNoScriptableConstructor" method onto the
base Scriptable class, so entd::Browser can use it too.

* entd.cc
  Init the entd.browser object.

* client.js/options.html
  Tell the user if they should restart their browser.
  Also, reorder ok/cancel buttons to avoid a chrome bug that would otherwise consider "cancel" as the default.

* run_tests.sh/browser-policy-*.js
  Unit tests for entd.browser.*

* scriptable.h
  Move ThrowNoScriptableConstructor from the crypto::Pkcs11 class to here.

Review URL: http://codereview.chromium.org/3110001

4 years agoentd: add more distinct filename to the list of things required to make a policy...
rginda [Wed, 11 Aug 2010 00:52:59 +0000 (17:52 -0700)]
entd: add more distinct filename to the list of things required to make a policy out of an extension

BUG=chromium-os:4660
TEST=install on gadget with new and old extension

Review URL: http://codereview.chromium.org/3131006

4 years agocomment fixups to scriptable.h
rginda [Tue, 10 Aug 2010 20:09:44 +0000 (13:09 -0700)]
comment fixups to scriptable.h
TBR: cmasone@chromium.org

4 years agoAdd LICENSE file
J. Richard Barnette [Thu, 5 Aug 2010 21:13:48 +0000 (14:13 -0700)]
Add LICENSE file

4 years agochanges to policy-utils and reference extension to support token initialization, etc
rginda [Mon, 2 Aug 2010 22:10:39 +0000 (15:10 -0700)]
changes to policy-utils and reference extension to support token initialization, etc

This patchbomb uses the new entd.crypto.pkcs11 API to present much better feedback to the user during token initialization and the CSR workflow.

It also adds a dependency from the reference extension to jquery, in order to make the DOM manipulation less hairy.

BUG=chromium-os:4666
TEST=manually drive the UI with/without entd and pkcsslotd running, on workstation and on the gadget.

Review URL: http://codereview.chromium.org/3061033

4 years agoUse ConfigureWifiService() instead of GetWifiService() to avoid the
Nathan Williams [Mon, 2 Aug 2010 18:52:16 +0000 (14:52 -0400)]
Use ConfigureWifiService() instead of GetWifiService() to avoid the
side-effect of creating a hidden network.

BUG=4822 (CL 3 of 3)
TEST=Set up enterprise policy and certificates, then log in where
Google or Google-A network is not present. Confirm that those
do not appear in the network menu, and that no services or networks
with that name are currently known by flimflam (via list-services and
list-networks).

Review URL: http://codereview.chromium.org/2836076

4 years agoGeneratePrivateKey(): Don't treat failures to read or write seed files as fatal;
Nathan Williams [Fri, 30 Jul 2010 13:47:45 +0000 (09:47 -0400)]
GeneratePrivateKey(): Don't treat failures to read or write seed files as fatal;
if the PRNG doesn't have enough entropy, the actual key-generation call will fail.

TEST=Create ~/.rnd owned by root and mode 600; try to generate a new
certificate.
BUG=none

Review URL: http://codereview.chromium.org/2842051

4 years agocrypto_pkcs11 fixups.
rginda [Thu, 29 Jul 2010 22:48:52 +0000 (15:48 -0700)]
crypto_pkcs11 fixups.

add token.closeAllSessions()
    token.slotId
    session.refresh()
    session constants
    C_CloseSession in ~Pkcs11::Session()
    pkcs11 CKR_* constants

closeAllSessions was needed because we have two chunks of code opening sessions (the existing pkcs11.cc and now crypto_pkcs11.cc) and it seems sometimes pkcs11.cc doesn't close its session properly, *and* opencryptoki doesn't allow you to have more than one session of the same type open at any given time.

Session.refresh() and the session constants were used while I was debugging a session issue.  They're good to keep for completeness sake.

Token.slotId was needed for the UI changelist.

I added all the CKR_ error codes because I'd like to write some JS to convert PKCS11 error codes into readable text.  I haven't gotten around to it yet.

I discovered a bug in session.logout() when using the TPM emulator, that makes it impossible to ever log into the token again as that user during the process lifetime.  I've switched all the js code that cared over to using only session.close(), and modified the testcase to do the same.

BUG=none
TEXT=run_tests.sh

Review URL: http://codereview.chromium.org/2873079

4 years agoAdd entd.crypto.pkcs11
rginda [Wed, 21 Jul 2010 21:07:42 +0000 (14:07 -0700)]
Add entd.crypto.pkcs11

This CL adds a new pcks11 API without disturbing what's already in place.  As this gains functionality
the old API from entd.pkcs11 will be deprecated and eventually removed.

The new API allows script to...
* Detect C_Initialize failures (they happen when pkcsslotd isn't running) and try again after a delay.
* Enumerate all slots and tokens on the system.
* Initialize tokens (!!!)

It still needs to be able to store and retrieve data from a PKCS11 token, but that should be fairly
straightforward from here.  Then we'll need to integrate with the CSR generation.

I've also juggled run_tests around a bit.  Since I've got the TPM emulator running in my dev environment
now, I can run all of the tests in the chroot.  This found a few issues with the existing pkcs11 tests.

There are two tag-along changes in scriptable.  The first is to move the initialization of
"instanceCount" until after the subclass has had a chance to modify the constructor template.  This is
because setting up the instanceCount accessor required a call to ctor_t->GetFunction().  That function
seems to create a function object based on the current template, and that function object is
cached forever so the subclass' changes are never seen.

The second change adds a UnwrapOrWarn, for cases where you can't throw a V8 exception for some reason.

BUG=chromium-os:4655
TEST=run_tests.sh

Review URL: http://codereview.chromium.org/3039017

4 years agonew readme about the dev/test cycle for entd
rginda [Wed, 21 Jul 2010 17:53:15 +0000 (10:53 -0700)]
new readme about the dev/test cycle for entd

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/3050009

4 years agoREADME.pkcs11: Fix typos
Gaurav Shah [Wed, 21 Jul 2010 17:00:12 +0000 (10:00 -0700)]
README.pkcs11: Fix typos

Noticed some minor typos. Thought that might as well fix 'em.

Review URL: http://codereview.chromium.org/3048004

4 years agoentd: Create a watchlist
Gaurav Shah [Wed, 21 Jul 2010 16:58:10 +0000 (09:58 -0700)]
entd: Create a watchlist

So that I (and more importantly, you) automatically get CC'ed on all code reviews.

Review URL: http://codereview.chromium.org/3041014

4 years agoDon't call the script ctor when constructing from native code
rginda [Mon, 19 Jul 2010 22:05:13 +0000 (15:05 -0700)]
Don't call the script ctor when constructing from native code

The existing Scriptable class causes the Construct() method to be called, even when constructing an instance from native code.

This is a problem because Construct() is expected to parse the v8::Arguments for arguments passed to the constructor from script.  There is a way to provide this argument list from native code, but it would mean callers would have to marshall the args over to v8::Values, and then back again in Construct.

The recommended way of constructing from script is to manually invoke an Initialize method, as in:

  Foo::Reference foo(Foo::New());
  foo->Initialize(arg1, arg2);

Which doesn't require the Construct() method at all.

So, this change makes it so that we don't invoke any of the construct-from-script logic when constructing from native code.

There is a tag-along change in here to add better debug logging when construction go wrong, and to use the correct T::class_name() method where applicable.

BUG=None
TEST=run_tests.sh

Review URL: http://codereview.chromium.org/2858057

4 years agoInitial add of Entd readme.
rginda [Mon, 19 Jul 2010 21:16:41 +0000 (14:16 -0700)]
Initial add of Entd readme.

At the moment it's only got info on how to get the TPM and PKCS11 emulator running on a dev box, so that you don't need to mess around with a gadget for unit tests.

In the future there should be some more info, like how to build entd, or something.

BUG=None
TEST=None

Review URL: http://codereview.chromium.org/3014006

4 years agoAdd Scriptable<>::BindMethod utility function
rginda [Mon, 19 Jul 2010 21:01:57 +0000 (14:01 -0700)]
Add Scriptable<>::BindMethod utility function

BindMethod() simplifies the process of binding a C++ class method to a JavaScript object.

It removes the need for the boilerplate static function to unwrap/verify the native object and dispatch
to the proper method on the native instance.

This patch includes a small change to the http class to switch to BindMethod.  The savings are much
larger in classes that have more bound methods (such as the upcoming pkcs11 work.)

BUG=None
TEST=run_tests.sh

Review URL: http://codereview.chromium.org/2868056

4 years agoAdd Scriptable<> base class to replace JSObjectWrapper<>
rginda [Mon, 12 Jul 2010 22:19:06 +0000 (15:19 -0700)]
Add Scriptable<> base class to replace JSObjectWrapper<>

BUG=chromium-os:4564
TEST=run_tests.sh

This CL creates a new templatized base class Scriptable<> to replace JSObjectWrapper<>.  Scriptable
classes maintain weak pointers to their associated javascript objects, so that they can eventually be
freed.

The Scriptable class comes with a nested Scriptable::Reference class that makes it easier to keep a
long-lived reference to a scriptable instance.

Care and feeding of these classes is documented in the code.

I've switched http.cc over from JSObjectWrapper to Scriptable, the rest will follow in another CL.

Review URL: http://codereview.chromium.org/2957007

4 years agoremove pkcs11 prefix
rginda [Tue, 29 Jun 2010 17:55:48 +0000 (10:55 -0700)]
remove pkcs11 prefix

Removed the "Pkcs11" prefix from classes in pkcs11.* to make the names a little more readable.

BUG=None
TEST=compile && run_tests.sh

Review URL: http://codereview.chromium.org/2819030

4 years agoGet request header magic from the extension manifest
rginda [Tue, 29 Jun 2010 00:58:02 +0000 (17:58 -0700)]
Get request header magic from the extension manifest

BUG=None
TEST=run_tests.sh

This change allows the extension to specify the magic header value in the manifest file.  If not
specified it defaults to "magic".

This means each enterprise can pick a different header value, and so the chance that someone will be able
to exploit all policies with a generic hack is slightly reduced.

Review URL: http://codereview.chromium.org/2855027

4 years agoRefactor pkcs11, round one
rginda [Thu, 24 Jun 2010 21:03:52 +0000 (14:03 -0700)]
Refactor pkcs11, round one

These changes make it possible to start entd before opencryptoki is ready.
This will make possible another set of changes to give the user more
feedback about the status of the tpm/opencryptoki initialization.

There is a substantial amount of cleanup in this CL, and some new TODO
comments pointing out refactoring that I'd like to do later.

BUG=None
TEST=Unit tests from this CL pass.  Haven't tested on a device yet.

Review URL: http://codereview.chromium.org/2808023

4 years agoEliminate stale pkcs11 certificate handler implementations.
stevenjb [Wed, 16 Jun 2010 00:20:36 +0000 (17:20 -0700)]
Eliminate stale pkcs11 certificate handler implementations.
Cleaned up pkcs11 initiailization code.

Review URL: http://codereview.chromium.org/2833006

4 years agohttp class cleanup.
stevenjb [Wed, 16 Jun 2010 00:10:22 +0000 (17:10 -0700)]
http class cleanup.
Some code was refactored and moved for better readability, but no functionality should have changed.

Review URL: http://codereview.chromium.org/2715007

4 years agoImplemented pkcs11 using libcrypto instead of system('openssl...').
stevenjb [Fri, 11 Jun 2010 21:45:35 +0000 (14:45 -0700)]
Implemented pkcs11 using libcrypto instead of system('openssl...').
Cleaned up return codes in pkcs11 and thow exceptions on errors.
Exit correctly on initialization errors in Entd::ConstructEntd.
Fixed a bug where C_CloseSession was not getting called correctly in ReadObjectsFromSlot().
Changed pkcs11.clear(SlotObject s) back to pkcs11.remove(slot_object_label) and implemented correctly.
Added ReadFromFile to move more testing into JS.
Fixed up tests.

Review URL: http://codereview.chromium.org/2786001

4 years agos/firstOnstall/firstInstall/
rginda [Fri, 11 Jun 2010 18:34:07 +0000 (11:34 -0700)]
s/firstOnstall/firstInstall/

Review URL: http://codereview.chromium.org/2753009

4 years agoEnable the device to resolve localhost, so that tcsd does not fail at startup
Chris Masone [Thu, 10 Jun 2010 22:11:14 +0000 (15:11 -0700)]
Enable the device to resolve localhost, so that tcsd does not fail at startup

BUG=3843
TEST=boot a device with an enabled TPM.  Wait until chromeos_tpm_init is done, and verify the existence of /var/lib/.tpm_owned

Review URL: http://codereview.chromium.org/2793004

4 years agopolicy-utils.js: reset cert.path in onInstall after a restart
rginda [Tue, 8 Jun 2010 22:47:01 +0000 (15:47 -0700)]
policy-utils.js: reset cert.path in onInstall after a restart

Now that we're remembering certs between restarts, we exposed a bug in how cert.path is set.  This resulted in the certificate path being blown away on the second startup.

Review URL: http://codereview.chromium.org/2694001

4 years agoImplemented ReadObjectsFromSlot() to populate pkcs11.slots on initialization.
stevenjb [Thu, 3 Jun 2010 18:45:48 +0000 (11:45 -0700)]
Implemented ReadObjectsFromSlot() to populate pkcs11.slots on initialization.

Review URL: http://codereview.chromium.org/2523001

4 years agoFixed argument to pkcs11.remove()
stevenjb [Tue, 1 Jun 2010 17:49:30 +0000 (10:49 -0700)]
Fixed argument to pkcs11.remove()

BUG=1778

Review URL: http://codereview.chromium.org/2333006

4 years agoAdded support for an empty passphrase.
stevenjb [Fri, 28 May 2010 21:51:09 +0000 (14:51 -0700)]
Added support for an empty passphrase.
Changed default PIN to 111111.
Made changes to allow policy-utils.js to remove prexisting matching objects.

BUG=1178

Review URL: http://codereview.chromium.org/2311001

4 years agoAdded --allow-write-to-file
stevenjb [Fri, 28 May 2010 17:06:09 +0000 (10:06 -0700)]
Added --allow-write-to-file

Review URL: http://codereview.chromium.org/2356001

4 years agoAvoid re-initializing the TPM if already owned -- or if not enabled
Chris Masone [Fri, 28 May 2010 17:04:22 +0000 (10:04 -0700)]
Avoid re-initializing the TPM if already owned -- or if not enabled

Review URL: http://codereview.chromium.org/2274006

4 years agoAdded Pkcs11::InitializeGLaptop() and SlotHandler::AddPrivateKey().
stevenjb [Thu, 27 May 2010 16:51:07 +0000 (09:51 -0700)]
Added Pkcs11::InitializeGLaptop() and SlotHandler::AddPrivateKey().
Replaced std::vecotor with chromeos::Blob.

Review URL: http://codereview.chromium.org/2280004

4 years agoentd reference policy: Place the submit button first to avoid chrome bug
rginda [Wed, 26 May 2010 23:24:25 +0000 (16:24 -0700)]
entd reference policy: Place the submit button first to avoid chrome bug

Also, modify the initial message so it's clear what we're waiting on.

BUG=None
TEST=Installed and ran on the gadget

Review URL: http://codereview.chromium.org/2271003

4 years agoImplemented Pkcs11SlotHandlerOpenCryptoki and Pkcs11CertificateHandlerOpenSslPkcs11En...
stevenjb [Wed, 26 May 2010 20:06:17 +0000 (13:06 -0700)]
Implemented Pkcs11SlotHandlerOpenCryptoki and Pkcs11CertificateHandlerOpenSslPkcs11Engine.
+ Added command line argument to set the openssl conf file.
+ Added openssl.conf to the base policy.
+ Changed how test/openssl/opencryptoki modes are set for pkcs11.

Review URL: http://codereview.chromium.org/2157001

4 years agoentd: stopgap tpm initialization script
Will Drewry [Wed, 26 May 2010 00:37:58 +0000 (19:37 -0500)]
entd: stopgap tpm initialization script

This script prepares a completely unowned, unconfigured
TPM chip on COTS hardware to be used.  A second script will
follow which initializes a per-user opencryptoki store for
use with PKCS#11 for entd.

In the long run, this functionality should be fully enveloped
into the login-manager initial setup functionality.

BUG=none
TEST=manually on a laptop with a tpm

Review URL: http://codereview.chromium.org/2170002

4 years agoMake entd log to syslog.
rginda [Tue, 25 May 2010 22:50:30 +0000 (15:50 -0700)]
Make entd log to syslog.

After this patch, entd will send log messages to syslog if stdout is not a tty.  This autodetection can
be overridden with --enable-syslog or --disable-syslog.

BUG=None
TEST=Run entd with and without stdout redirected to /dev/null, run entd with a bogus policy file to check
exception reporting

Review URL: http://codereview.chromium.org/2095028

4 years agoinherit review settings
Mandeep Singh Baines [Mon, 24 May 2010 18:35:46 +0000 (11:35 -0700)]
inherit review settings

TBR=cmasone

Review URL: http://codereview.chromium.org/2109017

4 years agoadd --root-ca-file option
rginda [Sat, 22 May 2010 00:29:14 +0000 (17:29 -0700)]
add --root-ca-file option

BUG=None
TEST=Ran entd with a bogus root cert, a valid cert, and no cert

Review URL: http://codereview.chromium.org/2082017

4 years agowrite key file to disk, and other things
rginda [Thu, 20 May 2010 23:00:34 +0000 (16:00 -0700)]
write key file to disk, and other things

BUG=None
TEST=Installed on the gadget

Review URL: http://codereview.chromium.org/2085014

4 years ago[entd] providing a passphrase and -nodes when creating a keypair doesn't make sense
Chris Masone [Thu, 20 May 2010 21:08:42 +0000 (14:08 -0700)]
[entd] providing a passphrase and -nodes when creating a keypair doesn't make sense

Review URL: http://codereview.chromium.org/2130009

4 years agoDon't request user input if none is required, update status message after initiating CSR
rginda [Thu, 20 May 2010 17:01:18 +0000 (10:01 -0700)]
Don't request user input if none is required, update status message after initiating CSR

This patch fixes two things.  First, we no longer present an empty dialog when no user input is required for a CSR.  Second, we show immediate feedback when a CSR is initiated, so the user knows we're doing something.

* clear out policy.userVariables if none was defined, so that we don't prompt for variables when none are required.

* return the status message from policy.info/warn/error, so that it can be used by the caller for other reasons.

* Return the status message from cb:initiateCSR, so the caller knows what's up without having to call cb:listCertificates right away.

BUG=None
Test=Tested against the reference policy with and without user vars.

Review URL: http://codereview.chromium.org/2095016

4 years agoValidate extension manifests before accepting the policy
rginda [Wed, 19 May 2010 22:32:33 +0000 (15:32 -0700)]
Validate extension manifests before accepting the policy

This adds an entd.verifyManifest function which is called after the utility file loads, but before the
policy file.  If this function returns false then entd exits and should not be restarted.

This patch also specifies the meaning of exit codes.  See the comment in main.cc for the details.

BUG=None
TEST=Ran reference policy with bogus manifest, ran test suite.

Review URL: http://codereview.chromium.org/2075014

4 years agomake pkcs11 put tmp files in /tmp
Chris Masone [Wed, 19 May 2010 22:29:29 +0000 (15:29 -0700)]
make pkcs11 put tmp files in /tmp

If we don't do this, it tries to put files on the read only partition and fails.

Review URL: http://codereview.chromium.org/2106017

4 years agoAdded JS writeToFile().
stevenjb [Wed, 19 May 2010 18:09:18 +0000 (11:09 -0700)]
Added JS writeToFile().
Added passphrase to key generation and enabled access for CSR construction.
Renamed SlotToken to SlotObject to match spec
Switched to using std C file operations for read/write.

Review URL: http://codereview.chromium.org/2117015

4 years agopost url-encoded forms rather than multipart
rginda [Wed, 19 May 2010 16:03:58 +0000 (09:03 -0700)]
post url-encoded forms rather than multipart

Bug=None
Test=./run_tests.sh, valid against a CSR authroity

Review URL: http://codereview.chromium.org/2131012

4 years agoModify policy-utils.js to call onInstall when a cert is installed
rginda [Tue, 18 May 2010 21:38:56 +0000 (14:38 -0700)]
Modify policy-utils.js to call onInstall when a cert is installed

...and update the reference extension to use it.

BUG=None
TEST=Ran entd with the reference policy, verified that onInstall and onUnload were called.

Review URL: http://codereview.chromium.org/2096009

4 years agoAdd onUnload to entd
rginda [Tue, 18 May 2010 21:36:41 +0000 (14:36 -0700)]
Add onUnload to entd

Policy files will hook this event so that they can un-configure a network before shutting down.

* Added "endt.scheduleShutdown(code, interval)" call.  Code is optional exit code, interval is optional
number of milliseconds to wait before shutting down.  0 is the default, and means shut down when the
current stack completes.

I went with "scheduleShutdown" rather than "exit", since a synchronous-but-clean shutdown is actually
difficult to implement.  This name should make it clear that the call is not synchronous.

* Use libevents EV_SIGNAL events to capture signals.

* Add "--allow-dirty-exit" command line flag, which suppresses the EV_SIGNAL events.  This allows entd to
exit on its own when all events are processed, rather than relying on the policy to explicitly call
"scheduleShutdown()", which would make testing more difficult.

* Refactored initialization code; Changed return value of ConstructEntd, and added
StartScriptingEnvironment and StopScriptingEnvironment

Review URL: http://codereview.chromium.org/2133005

4 years agopass the correct content type
rginda [Tue, 18 May 2010 20:24:13 +0000 (13:24 -0700)]
pass the correct content type

forgot to include this in 2111004

Review URL: http://codereview.chromium.org/2079009

4 years agoadd charset-UTF-8 to the content type for callback requests
rginda [Tue, 18 May 2010 17:53:59 +0000 (10:53 -0700)]
add charset-UTF-8 to the content type for callback requests

Review URL: http://codereview.chromium.org/2111004

4 years agoAdd basic http auth capability
rginda [Tue, 18 May 2010 17:52:36 +0000 (10:52 -0700)]
Add basic http auth capability

policy-utils.js
* Add 'auth' config option.
* Make the error messages make a little more sense.

certserver.py
* Enforce that all requests have http auth set to "$username:${username}_password"

http.cc
* Set CURLOPT_USERPWD if the request has a non-empty auth property.

reference_extension/policy.js
* Send http auth information along with the CSR and issue requests.

Review URL: http://codereview.chromium.org/2128002