summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-pull.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-09-23 10:23:47 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2017-09-26 18:07:43 +0000
commit25a7c4bd4e8aeaf68689fcd2ddc2f907f2f76f1f (patch)
treee56ab005f95f454507919c7dfbd3ef93ad7b6a0d /src/ostree/ot-builtin-pull.c
parentb6507a930e2604602f9911794c54dc7ba48832a3 (diff)
downloadostree-25a7c4bd4e8aeaf68689fcd2ddc2f907f2f76f1f.tar.gz
lib/pull: Default checksum for archive mirror, add TRUSTED_HTTP flag
I now think commit fab1e113db558cb7d6754e243919558df92d4864 was a mistake; because it breaks the mental model that at least I'd built up that "local repos don't have checksums verified, HTTP does". For example, a problem with this is (with that mental model in place) it's easy for people who set up mirrors like this to then do local pulls, and at that point we've done a deployment with no checksum verification. Further, since then we did PR #671 AKA commit 3d38f03 which is really most of the speed hit. So let's switch the default even for this case to doing checksum verification, and add `ostree pull --http-trusted`. People who are in situations where they know they want this can find it and turn it on. Closes: https://github.com/ostreedev/ostree/issues/1211 Closes: #1212 Approved by: jlebon
Diffstat (limited to 'src/ostree/ot-builtin-pull.c')
-rw-r--r--src/ostree/ot-builtin-pull.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c
index a6fab0e3..e67d5993 100644
--- a/src/ostree/ot-builtin-pull.c
+++ b/src/ostree/ot-builtin-pull.c
@@ -33,6 +33,7 @@ static gboolean opt_dry_run;
static gboolean opt_disable_static_deltas;
static gboolean opt_require_static_deltas;
static gboolean opt_untrusted;
+static gboolean opt_http_trusted;
static gboolean opt_timestamp_check;
static gboolean opt_bareuseronly_files;
static char** opt_subpaths;
@@ -57,6 +58,7 @@ static GOptionEntry options[] = {
{ "mirror", 0, 0, G_OPTION_ARG_NONE, &opt_mirror, "Write refs suitable for a mirror and fetches all refs if none provided", NULL },
{ "subpath", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_subpaths, "Only pull the provided subpath(s)", NULL },
{ "untrusted", 0, 0, G_OPTION_ARG_NONE, &opt_untrusted, "Verify checksums of local sources (always enabled for HTTP pulls)", NULL },
+ { "http-trusted", 0, 0, G_OPTION_ARG_NONE, &opt_http_trusted, "Do not verify checksums of HTTP sources (mostly useful when mirroring)", NULL },
{ "bareuseronly-files", 0, 0, G_OPTION_ARG_NONE, &opt_bareuseronly_files, "Reject regular files with mode outside of 0775 (world writable, suid, etc.)", NULL },
{ "dry-run", 0, 0, G_OPTION_ARG_NONE, &opt_dry_run, "Only print information on what will be downloaded (requires static deltas)", NULL },
{ "depth", 0, 0, G_OPTION_ARG_INT, &opt_depth, "Traverse DEPTH parents (-1=infinite) (default: 0)", "DEPTH" },
@@ -182,8 +184,14 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError **
if (opt_commit_only)
pullflags |= OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY;
+ if (opt_http_trusted)
+ pullflags |= OSTREE_REPO_PULL_FLAGS_TRUSTED_HTTP;
if (opt_untrusted)
- pullflags |= OSTREE_REPO_PULL_FLAGS_UNTRUSTED;
+ {
+ pullflags |= OSTREE_REPO_PULL_FLAGS_UNTRUSTED;
+ /* If the user specifies both, assume they really mean untrusted */
+ pullflags &= ~OSTREE_REPO_PULL_FLAGS_TRUSTED_HTTP;
+ }
if (opt_bareuseronly_files)
pullflags |= OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES;