11 Commits
Author SHA1 Message Date
Tudor Marcu fd6b54d964 Try to recover from invalid certificate date
The system clock may be terribly off, especially on new hardware that has not
yet been calibrated. Updates rely on the certificate and system time being
sane to verify validity, so if a mismatch is found the certificate will
be deemed invalid and the update stopped. This patch attempts to fix the
system time to something sane using the time from the swupd binary itself,
which should not have been touched by any user except root. If the time is
normal and verification fails, the cert cannot be trusted.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2017-03-25 00:00:41 -07:00
Tudor Marcu bfb26b5c40 Change certpath to be full path of certificate
The mixer and image creator treat the certpath as the full path of the
certificate filename, and swupd should too. If someone is overriding the
certificate with the cert path option, use the supplied string and don't
append a pre-defined name to it.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2017-02-27 11:40:11 -08:00
Patrick McCarty 54d494b0fb test: update swupdlib to not consume .signed files
These files are not used by swupd-client, so do not add them to the MoM
tarball.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-01-31 12:39:09 -08:00
Tudor Marcu a1c0d9995a Update swupd signature verification certificate
The current certificate used to verify the Manifest.MoM signature is also used
to verify various build artifacts, and thus should be split up into multiple,
single function certs. This introduces a new certificate that will be used
exclusively to verify signatures for updates, while the old one will be used
to verify build artifacts like the image.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2017-01-26 01:19:11 -08:00
Tudor Marcu a565cd0304 Update tests for mandatory signature verification
With mandatory signature verification being enabled, the tests will have
to generate a certificate and sign their Manifest.MoMs to properly run the
swupd operations.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-12-20 16:13:55 -08:00
Patrick McCarty c2d2e244a9 Support an output line ignore list for tests
There are several output lines that are not very interesting to check
for functional tests, so ignore those lines completely for testing by
adding some specific regular expressions for matching.

This also enables detection of unexpected error messages that may arise
when running the tests.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-03 09:32:30 -07:00
Patrick McCarty 1c23a7bea3 Remove obsolete helper function for tests
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-02 21:04:17 -07:00
Patrick McCarty 10dcbb5fa9 Add new interface for functional test framework
This commit adds a new helper function for functional tests that enables
a more streamlined mechanism for declaring a fixed set of output lines
to check for and to compare against the swupd-client output.

To use this new interface, lines of output to be checked for a given
test will live in the "lines-checked" file within the test directory,
with the swupd-client output dumped to "lines-output".  Each line of
"lines-checked" is either interpreted as a literal string, or as a
regular expression; regular expression lines are denoted with the
"REGEXP:" prefix, and all other lines are literal strings.

Note that swupd-client may emit more output lines than those checked for
in "lines-checked", and that the checked lines should be declared in
order.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-02 21:01:15 -07:00
Patrick McCarty 3e0fff6a47 Ignore signature verification errors in functional tests
Because signature verification is a feature that we need separate
testing for, and swupd's output may print a verification error (or not)
depending on how swupd was built, add a helper function to remove the
verification error message when swupd is built with verification
enabled. If verification is not enabled, swupd will not print any
message, and the function is a no-op.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-06-27 11:56:01 -07:00
Patrick McCarty a384265d88 Refactor test cases; update bundle manifest hashes
This commit expands the swupd BATS library to encapsulate more of the
boilerplate steps in the test cases.

Additionally, bundle manifest hashes needed updating now that swupd is
emitting warnings (and later on, errors). Better to be prepared for the
switch to errors on mismatches.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-06-22 16:12:38 -07:00
William Douglas a52eeb42cb Move functional tests to use the BATS framework 2016-04-26 22:15:04 +00:00