295 Commits
Author SHA1 Message Date
Tudor Marcu e4d6189073 Release v3.7.4
This release adds telemetry status output for bundle add and remove.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v3.7.4
2016-12-08 10:28:38 -08:00
Auke Kok 8fd8720497 Telemetry: add telemetry for bundle add, remove.
This adds telemetry status output for bundle add and remove.

In the case of remove, we expect a single bundle name.

In the case of remove, we make a nice string with all the bundle
names as we iterate and use that in the telemetry output.
2016-12-08 10:32:01 -08:00
Auke Kok 76f7ae7f5d Change telemetry API - add class component.
We change the telemetry API to pass a class record identifier,
which will be part of the telemetry record file name. This allows
us easier to send different telemetry class records to the server,
which will make parsing simpler in the probe and on the backend.

Rev record version to #2 because of this change.
2016-12-08 10:32:01 -08:00
Tudor Marcu 462bf6f857 Release v3.7.3
This release includes several significant fixes and additions to swupd-client:
- Renable telemetry in the client with a new implementation, writing records to
  a file and not blocking swupd operations at all.
- Enable travis-ci integration
- Fix xattrs enable flag in conjunction with enabling bsdtar
- Ignore xattrs when processing manifests
- Enable out of tree builds
- Enable automatic updates through timer units
- Adds man pages
- Re-enable updating of config files
- Remove block on post-update triggers, saving another 1.5-2 seconds for update
- Miscellaneous fixes for typos and updates to autotools files for completeness

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v3.7.3
2016-11-29 23:14:21 -08:00
Auke Kok 9bbf879f5a Telemetry: Add telemetry function, and 3 uses.
The telemetry function only works insire swupd_init() / swupd_deinit()
functions, as it accesses state_dir from globals. This restricts the
use of it a bit, so we move the timekeeping function into
main_update().

Aside from update, I've added a telemetry point in verify as well.

With this, we have several easy telemetry points in swupd that
should give us an indication how swupd is performing without divulging
lots of detailed information.

The swupd.h file contains easy defines for level, and the telemetry()
function itself is as failsafe as it can be - any error results in
a continuing swupd program, although these errors would occur in
a system that is already hopeless (disk full) anyway.
2016-11-29 18:15:06 -08:00
Auke Kok 0c141a9970 Create telemetry data drop folder.
This folder will be collecting output for telemetry. The
output will only ever be written by swupd. A separate
component will be collecting these telemetrics at a later
time to send them.

Cleaning this folder should be done through tmpfiles.d.
2016-11-29 18:15:06 -08:00
Auke Kok 37e60bb7ea Rename dirs to state_dirs.
This better reflects the name of the array as these are
all state dirs.
2016-11-29 18:15:06 -08:00
Auke Kok 0f7906de3b Remove obsolete telemetry symbols.
These were removed earlier and are not in use.
2016-11-29 18:15:06 -08:00
Patrick Ohly 09c26658d3 verify_file: ignore xattrs when verifying Manifest files
When IMA or Smack are active on the client, the downloaded Manifest
files will be assigned certain xattrs (security.ima
resp. security.SMACK64). Those xattrs did not exist on the server side
(because it is most likely not having those kernel features enabled)
and besides, the swupd-server code wouldn't include them in the
Manifest hashes even if they existed (see write_manifest_plain() in
src/manifest.c).

Therefore the client must ignore xattrs when verifying Manifest files.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-11-28 10:16:12 -08:00
Patrick McCarty 14d4a622e6 Add travis-ci integration for functional testing
For now, the config simply installs missing build dependencies and works
around the umask discrepancy for running the functional test suite.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-22 15:22:24 -08:00
Patrick McCarty 8a80b3422a test: update ignore list for Ubuntu support
Ubuntu's /bin/sh is Dash, which has different error strings than Bash
for equivalent errors.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-22 15:22:24 -08:00
Patrick McCarty b1cd998670 Setting CURLOPT_PIPEWAIT is optional
Depending on how libcurl is configured, CURLOPT_PIPEWAIT may not be
supported, so make the unsupported case non-fatal.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-22 15:22:24 -08:00
Patrick McCarty 87939567a5 build: lower libcrypto version requirement
The build succeeds with libcrypto 1.0.1f installed, so lower the build
requirement.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-22 15:22:24 -08:00
Tudor Marcu adf2e39eb1 Do not block on systemctl post-update triggers
We call systemctl to update triggers once an update finishes, which enqueues a
task and then waits to finish by default thus blocking the system() call. This
adds unnecessary time to the update, so set --no-block and move on since we
already reached the end of the update.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-22 15:12:55 -08:00
Patrick McCarty 3571f9a77b Fix typo in Makefile.am
The backslash for the second-to-last entry in EXTRA_DIST was omitted,
leading to a dist issue.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-22 11:46:17 -08:00
Joshua Lock c77808fb81 Add configure option to re-enable updating of config files
This is required by distros which ship configuration files under
/etc. Those files then are considered read-only and must be updated as
part of OS updates.

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>

Extended the commit message and fixed the case where --enable-stateless
is explicitly given.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-11-21 11:00:11 -08:00
Patrick Ohly 5cda10c326 swupd-build-variant.h: clean up comments for tar defines
The comment from commit fc0f570 was a bit misleading. Adding more
information about which combinations are valid and tested instead.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-11-21 10:59:24 -08:00
Patrick Ohly a2b80dc695 fix --enable-xattr
Commit fc0f570d added a check that prevents using --enable-xattr
together with --enable-bsdtar, perhaps because it was assumed that this
wouldn't work because there is no special tar option as in the GNU tar
case.

But bsdtar worked fined in combination with IMA and Smack xattrs in
Ostro OS. Xattrs are set accordingly there on the server side, so the
check needs to be removed to allow the combination.

Besides that, enabling xattrs also had no effect because xattrs.c
never got to see the SWUPD_WITH_XATTRS define due to not including
config.h.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-11-21 10:59:24 -08:00
Auke Kok b43ad9748e Add generated troff files.
These are the files we will actually install on the system,
and the ones that are shipped in the tarball release.
2016-11-17 00:52:22 -08:00
Auke Kok 74b8515cd5 Add man (manual) pages.
Add a large amount of manual pages to swupd-client project. These are
meant to cover a large amount of topics and should cover the needed
material for people who are either using, or mixing with swupd,
and so this goes a bit further than end user documentation.

I've put the unit stuff in section 4. Any other section seemed
less related.
2016-11-17 00:52:22 -08:00
Auke Kok 888867858b Add autogen.sh
Boilerplate/template autogen.sh. This is useful since it sets
prefix to /usr, which will help test changes easily for devs.
2016-11-17 00:52:22 -08:00
Auke Kok 341fe280b4 Move to automatic updates: unit changes.
We disable check-update.timer by default. Having a message in the
journal isn't helpful, and there currently is no API to properly
query for update (except for running swupd check-update).

We add auto-update timer units. These can be masked (`systemctl
mask swupd-update.service`) to disable auto-updates, or enabled
if the OS ships with them not enabled. The project ships with
them not enabled for now, may end up enabling them later in time.
2016-11-17 00:52:22 -08:00
André Draszik b89d002a7d build: allow out of tree builds
When doing out-of-tree builds, the distributed
scripts are in different directory than where
the build is happening. This doesn't work:

  make  install-exec-hook
  make[2]: Entering directory '<builddir>'
  perl scripts/findstatic.pl */*.o | grep -v Checking ||:
  Can't open perl script "scripts/findstatic.pl": No such file or directory
  make[2]: Leaving directory '<builddir>'

We therefore need to give perl the full path
of the perl-script to run using the standard
automake variable top_srcdir:

  make  install-exec-hook
  make[2]: Entering directory '<builddir>'
  perl ../../../../../../../../tmp/swupd-client.git/scripts/findstatic.pl */*.o | grep -v Checking ||:
    'bin_paths' is unique to src/search.o, should be static?  (initialised variable)
    'do_search' is unique to src/search.o, should be static?  (function)
    'download_manifests' is unique to src/search.o, should be static?  (function)
    'file_search' is unique to src/search.o, should be static?  (function)
    'lib_paths' is unique to src/search.o, should be static?  (initialised variable)
    'report_find' is unique to src/search.o, should be static?  (function)
    'scope' is unique to src/search.o, should be static?  (initialised variable)
    'search_type' is unique to src/search.o, should be static?  (initialised variable)
  make[2]: Leaving directory '<builddir>'

Signed-off-by: André Draszik <git@andred.net>
2016-11-17 00:27:51 -08:00
Patrick McCarty 5cab68ab9e Merge tag 'v3.7.2' 2016-11-15 20:50:58 -08:00
Tudor Marcu 6546c716a0 Release v3.7.2
This release removes certificate pinning to enable the client to communicate with a CDN for update operations, minimizing syscalls to fdopen/fclose during file downloads and using the default curl write handler to improve performance, and returning proper return codes when calling check-update.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-15 18:45:18 -08:00
Tudor Marcu 769413be4e Release v3.7.2
This release removes certificate pinning to enable the client to communicate with a CDN for update operations, minimizing syscalls to fdopen/fclose during file downloads and using the default curl write handler to improve performance, and returning proper return codes when calling check-update.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v3.7.2
2016-11-15 18:30:24 -08:00
Icarus Sparry 5d637de5be swupd-client check-update return 1 if none available
make the return code for swupd-client be 1 if there is no update
available. This follows in the tradition of grep, which returns 0 if
there are matches, 1 if there are not, and 2 for errors.

Do the same for swupd-client update --status

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2016-11-15 16:59:06 -08:00
Patrick Ohly 4e35578896 downloads: open FILE in advance and use default write handler
Now that the number of pending downloads is kept below a certain limit
(see poll_fewer_than()) it is possible to open files before starting
the transfer. Using the default curl write handler and explicit
open/close of the file makes the code simpler.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-11-15 16:42:51 -08:00
Patrick Ohly e6653ad185 downloads: minimize syscalls to improve performance
The previous approach was to open/fdopen/fclose the file for each
chunk that gets passed from curl. This incurrs a huge performance hit
when close() triggers a hashing of the file content on systems where
integrity protection via IMA is enabled.

Now the file is opened only once and kept open until the download is
complete. In addition, the unnecessary usage of C file IO is avoided.

The semantic is changed as little as possible:
- file gets created only after the first chunk of data arrived
- file descriptors do not leak to child processes (O_CLOEXEC)
- data gets appended to existing files (via O_APPEND, used
  to keep the code simple and avoid an additional lseek)
- data gets flushed explicitly for each chunk (via fdatasync(),
  which somewhat approximates the effect that an explicit
  close() may have had)

As an additional improvement, failures during close() are checked. To
keep error handling as much as before, the completion function which has
the close() takes the current curl error code and replaces it if it
encounters a write error.

[v2 of the patch with fixes by Dmitry Rozhkov, see https://github.com/pohly/swupd-client/pull/1]

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-11-15 16:42:51 -08:00
Tudor Marcu 7e08709241 Remove certificate pinning
To enable swupd-client to communicate with a CDN for updates, the custom
cert pinning must be removed.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-14 17:10:32 -08:00
Tudor Marcu 2743e7e8e7 Release v3.7.1
This release changes swupd-client to ignore xattrs by default, fixing errors on systems where xattrs were enabled thus changing the hash of files on system and mismatching hashes in update manifests; printing diagnostic info on network-connectivity problems to easier debug update failures, and fixing some build warnings from autoreconf.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v3.7.1
2016-11-11 11:52:07 -08:00
Patrick McCarty 5445fccd12 build: track m4 directory to avoid aclocal warning
When running 'autoreconf', aclocal warns that the "m4" directory does
not exist, even though AC_CONFIG_MACRO_DIR in configure.ac declares that
it should exist.

To avoid the warning, track the directory in the git tree.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-11 10:52:05 -08:00
Patrick McCarty 70bfd532f5 Print error message for CURLE_COULDNT_CONNECT
Certain types of network-connectivity problems hit this curl error, so
print a diagnostic message when it occurs.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-08 17:48:31 -08:00
Icarus Sparry 583ed66ed8 Add options to handle xattr at compile time.
Swupd used to use a sorted blob of extended file attributes as part of
the data that was used to verify the contents. This caused problems if
extra attributes were added. In particular if a clearlinux system was
being run in a container that had selinux enabled in the base OS.

Add a configure option to allow the attributes to be considered or
not. Based on advice, the default is to ignore them, as this is what
everyone expects.

Tidied up passing a --selinux flag to tar, this is also handled by a new
config option.

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2016-11-08 17:44:02 -08:00
Icarus Sparry fc0f570d20 Add options to handle xattr at compile time.
Swupd used to use a sorted blob of extended file attributes as part of
the data that was used to verify the contents. This caused problems if
extra attributes were added. In particular if a clearlinux system was
being run in a container that had selinux enabled in the base OS.

Add a configure option to allow the attributes to be considered or
not. Based on advice, the default is to ignore them, as this is what
everyone expects.

Tidied up passing a --selinux flag to tar, this is also handled by a new
config option.

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2016-11-08 17:44:02 -08:00
Tudor Marcu 8300b1c4a9 Release v3.7.0
This release includes major updates to various components of swupd-client:

A rework of the bundle subscription code, making the consolidation steps
simpler, reporting bundle changes for updates instead of "manifest" changes,
accounting fixes for the update stats, and reworking the update list creation
logic to massively improve performance by not calling verify_file() when
not needed.

The interface for functional tests was changed to better accommodate updating
test cases when output changes (because of code changes/fixes), such that
each test case has a single expected output that is tracked as a whole,
rather than individual output lines.

Many performance enchancements to drastically reduce client update time:
- Cutting down the amount of recursion when adding subscribed bundles.
- Caching the latest version number.
- Caching manifest hash checks if they succeed.
- Checking only the manifest headers on paths where the whole manifest does not
  need to be parsed.
- Enabling multiplexing in curl.
- Setting nosync on staging dir removal operations.
- Fixing statistics and time reporting for updates.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
v3.7.0
2016-11-04 17:41:43 -07:00
Tudor Marcu 5f5c7dcaf2 Remove more unneeded printfs
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Tudor Marcu d2804fb2ee Use bool for header_only flag
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Tudor Marcu 26658ca8e0 Update tests for new ouput
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Arjan van de Ven d428e3b28e Reduce verbosity
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Arjan van de Ven a4eb3fa491 Remove unneeded prints
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Arjan van de Ven aa3da77a8b Fix time reporting for updates
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Arjan van de Ven 653bb9ffb6 Fix serious bug in list sorting
We can't sort the update list inside a helper function
that only gets a pointer to the list; the list head can get
updated as part of the sort, and this update to the list
head doesn't get reflected in the caller, leading
to a corrupted linked list.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Arjan van de Ven 6aadfdd9d3 Count and report what files are not present in packs
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Arjan van de Ven 7dde28cf3e Set nosync on removing staging dir
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Tudor Marcu 9a43e529c4 Enable multiplexing in curl
Adding CURLPIPE_MULTIPLEX | CURLPIPE_HTTP1 is now possible with libcurl >=
7.43.0. The value 1 tells it to first check if multiplexing is supported on
a connection before attempting any transfers.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Arjan van de Ven 66a537fa43 Add ability to check manifest header only
We spend a lot of wasted time parsing the entire manifest in some areas, when
only the header is needed. This patch adds a header_only flag that tells the
appropriate load manifest functions to quit early after the header is read,
instead of parsing the entire (possibly very large) manifest. Another
optimization is calling fopen() with the 'm' flag, which tries to use mmap to
access the file (for reading only).

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Arjan van de Ven 0dc5adcec5 Cache Manifest hash checks if succeeded
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Arjan van de Ven aa2ce3245b Cache latest version number
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Arjan van de Ven d52f835ae0 Fix recursion of manifest includes
This patch cuts down the amount of recursion that happens by skipping a
subsequent rescursive calls to add_subscriptions if we hit a bundle that is
already subscribed.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00