[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#833785: apt: please add configuration option to never allow installation of unauthenticated packages



Hi,

> I've heard this is a blocker for wider Debian adoption by some > people/projects/organisations.

I would be very interested to know more.

Have they considered simply patching apt? The patch (attached) is
somewhat trivial.


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby@debian.org / chris-lamb.co.uk
       `-
diff --git a/apt-private/private-download.cc b/apt-private/private-download.cc
index 4ffe78b..b1ad307 100644
--- a/apt-private/private-download.cc
+++ b/apt-private/private-download.cc
@@ -41,42 +41,7 @@ bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser)
       if (!(*I)->IsTrusted())
 	 UntrustedList.push_back((*I)->ShortDesc());
 
-   if (UntrustedList.empty())
-      return true;
-
-   return AuthPrompt(UntrustedList, PromptUser);
-}
-									/*}}}*/
-bool AuthPrompt(std::vector<std::string> const &UntrustedList, bool const PromptUser)/*{{{*/
-{
-   ShowList(c2out,_("WARNING: The following packages cannot be authenticated!"), UntrustedList,
-	 [](std::string const&) { return true; },
-	 [](std::string const&str) { return str; },
-	 [](std::string const&) { return ""; });
-
-   if (_config->FindB("APT::Get::AllowUnauthenticated",false) == true)
-   {
-      c2out << _("Authentication warning overridden.\n");
-      return true;
-   }
-
-   if (PromptUser == false)
-      return _error->Error(_("Some packages could not be authenticated"));
-
-   if (_config->FindI("quiet",0) < 2
-       && _config->FindB("APT::Get::Assume-Yes",false) == false)
-   {
-      if (!YnPrompt(_("Install these packages without verification?"), false))
-         return _error->Error(_("Some packages could not be authenticated"));
-
-      return true;
-   }
-   else if (_config->FindB("APT::Get::Force-Yes",false) == true) {
-      _error->Warning(_("--force-yes is deprecated, use one of the options starting with --allow instead."));
-      return true;
-   }
-
-   return _error->Error(_("There were unauthenticated packages and -y was used without --allow-unauthenticated"));
+   return UntrustedList.empty();
 }
 									/*}}}*/
 bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure)/*{{{*/
diff --git a/apt-private/private-download.h b/apt-private/private-download.h
index d829e8b..4358af8 100644
--- a/apt-private/private-download.h
+++ b/apt-private/private-download.h
@@ -12,10 +12,6 @@
 // Check if all files in the fetcher are authenticated
 bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser);
 
-// show a authentication warning prompt and return true if the system
-// should continue
-bool AuthPrompt(std::vector<std::string> const &UntrustedList, bool const PromptUser);
-
 APT_PUBLIC bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure);
 
 bool CheckFreeSpaceBeforeDownload(std::string const &Dir, unsigned long long FetchBytes);
diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc
index fab1b45..47ece7f 100644
--- a/apt-private/private-source.cc
+++ b/apt-private/private-source.cc
@@ -485,7 +485,7 @@ bool DoSource(CommandLine &CmdL)
    }
 
    // check authentication status of the source as well
-   if (UntrustedList.empty() == false && AuthPrompt(UntrustedList, false) == false)
+   if (UntrustedList.empty() == false)
       return false;
 
    // Run it

Reply to: