#578540 APT::Authentication::TrustCDROM "false"; is not working

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Andreas Miller
Date:
2010-05-08 11:16:03 UTC
Severity:
normal
#578540#5
Date:
2010-04-20 17:15:39 UTC
From:
To:
Hello,

when I set APT::Authentication::TrustCDROM "false"; I can import the original cdrom with apt-cdrom add.

If I try to import a signed CD-ROM I get the following error:

# apt-cdrom add
Using CD-ROM mount point /cdrom/
Unmounting CD-ROM
Waiting for disc...
Please insert a Disc in the drive and press enter
Mounting CD-ROM...
Identifying.. [2b17ce42747853c1d4d0119cebd5d574-2]
Scanning disc for index files..
Found 1 package indexes, 0 source indexes, 0 translation indexes and 1 signatures
Found label 'Debian GNU/Linux 5.0.4 _Lenny_ - Official i386 CD Binary-1 20100131-18:53'
This disc is called:
'Debian GNU/Linux 5.0.4 _Lenny_ - Official i386 CD Binary-1 20100131-18:53'
Copying package lists...gpgv: Signature made Tue 20 Apr 2010 06:17:29 PM CEST using RSA key ID E0E2DBA4
gpgv: Can't check signature: public key not found
E: Sub-process gpgv returned an error code (2)
W: Signature verification failed for: /cdrom/dists/lenny/Release.gpg

I have to unmount the cdrom now.
Blocking is the correct behaviour, but I have to unmount manual.

# umount /media/cdrom0

Then I import the signing key used to sign the CD-ROM into the keyring of the trusted repositories i.e. /etc/apt/trusted.gpg

# gpg -a --export 548ED131 | apt-key add -

# apt-cdrom add
Using CD-ROM mount point /cdrom/
Unmounting CD-ROM
Waiting for disc...
Please insert a Disc in the drive and press enter
Mounting CD-ROM...
Identifying.. [2b17ce42747853c1d4d0119cebd5d574-2]
Scanning disc for index files..
Found 1 package indexes, 0 source indexes, 0 translation indexes and 1 signatures
Found label 'Debian GNU/Linux 5.0.4 _Lenny_ - Official i386 CD Binary-1 20100131-18:53'
This disc is called:
'Debian GNU/Linux 5.0.4 _Lenny_ - Official i386 CD Binary-1 20100131-18:53'
Copying package lists...gpgv: Signature made Tue 20 Apr 2010 06:17:29 PM CEST using RSA key ID 548ED131
gpgv: Good signature from "secXtreme GmbH Debian Archive Signing Key (2009) <debsign@sec-xtreme.com>"
Reading Package Indexes... Done
Writing new source list
Source list entries for this disc are:
deb cdrom:[Debian GNU/Linux 5.0.4 _Lenny_ - Official i386 CD Binary-1 20100131-18:53]/ lenny main
Unmounting CD-ROM...
Repeat this process for the rest of the CDs in your set.

If I import an unsigned CD-ROM it is always imported.
Why does apt-cdrom not prevent the import of an unsigned CD-ROMs?

Regards
Andreas

#578540#10
Date:
2010-05-07 06:01:55 UTC
From:
To:
Hello,

Situation:

Unsigned CD-ROM

When an unsigned CD-ROM is added with the command "apt-cdrom add" no
copy of the Release-File will be done to /var/lib/apt/lists.

Signed CD-ROM

If the CD-ROM is signed and verified against /etc/apt/trusted.gpg the
Release- and the Release.gpg will be copied to /var/lib/apt/lists.

Bugfix:
With the patch in debmetaindex.cc an unsigned CD-ROM will only be used
for the installation when APT::Authentication::TrustCDROM "true".

Attached is a small patch to fix the logic.

Best Regards
Andreas

#578540#15
Date:
2010-05-07 12:44:19 UTC
From:
To:
Thanks for your bugreport.
[..]

I'm not entirely sure if I understand the bugreport correctly. So
please correct me if I got the report wrong :)

From how I read it you want that
"APT::Authentication::TrustCDROM="true" allows apt-cdrom add to add a
cdrom even if the signature can be not verified? If so, here is a diff:

=== modified file 'apt-pkg/indexcopy.cc'
--- apt-pkg/indexcopy.cc	2010-01-08 21:28:49 +0000
+++ apt-pkg/indexcopy.cc	2010-05-07 12:35:49 +0000
@@ -591,7 +591,8 @@
       string prefix = *I;

       // a Release.gpg without a Release should never happen
-      if(!FileExists(*I+"Release"))
+      if(!FileExists(*I+"Release") ||
+       _config->FindB("APT::Authentication::TrustCDROM", false) == true)
       {
        delete MetaIndex;
 	 continue;

I think it does make sense to allow this and is in line with what the
switch is suppposed to do.


Cheers,
 Michael

#578540#20
Date:
2010-05-07 12:44:19 UTC
From:
To:
Thanks for your bugreport.
[..]

I'm not entirely sure if I understand the bugreport correctly. So
please correct me if I got the report wrong :)

From how I read it you want that
"APT::Authentication::TrustCDROM="true" allows apt-cdrom add to add a
cdrom even if the signature can be not verified? If so, here is a diff:

=== modified file 'apt-pkg/indexcopy.cc'
--- apt-pkg/indexcopy.cc	2010-01-08 21:28:49 +0000
+++ apt-pkg/indexcopy.cc	2010-05-07 12:35:49 +0000
@@ -591,7 +591,8 @@
       string prefix = *I;

       // a Release.gpg without a Release should never happen
-      if(!FileExists(*I+"Release"))
+      if(!FileExists(*I+"Release") ||
+       _config->FindB("APT::Authentication::TrustCDROM", false) == true)
       {
        delete MetaIndex;
 	 continue;

I think it does make sense to allow this and is in line with what the
switch is suppposed to do.


Cheers,
 Michael

#578540#25
Date:
2010-05-08 11:01:39 UTC
From:
To:
Hello Michael,

thank you for your fast answer.

No, I think your patch is no solution for this situation.

I think the situation is more complex.

It depends from
- the time of the decision
- and the definition of the functionality

Definition of the functionality from the spec:
'TrustCDROM "false"; // consider the CDROM always trusted'

I think a possible interpretation of this spec could be:

The CD-ROM will be imported, when TrustCDROM is set to "true"
	a) even when it is not signed at all.
	b) or even when a verification with gpg has no success (i.e. wrong
gpg-file, not in the keyring,...)

The CD-ROM will not be imported, when TrustCDROM is set to "false",
	a) when a CD-ROM is not signed
	b) or when the signature is not OK.

The CD-ROM will be imported, when TrustCDROM is set to "false" and the
signature is OK. We do not TrustCDROM but the signature!

The trust decision is done here!

Therefore later no check for current TrustCDROM flag will be done in
apt-pkg/deb/debmetaindex.cc. The TrustCDROM part has to be deleted in
this file.
It has been a decision during the import a long time ago.

I think the spec should be changed:

New spec: 'TrustCDROM "true"; // consider the CD-ROM "forever" trusted
even when not signed'

The current implementation in 0.7.20.2+lenny1:
I accept always an unsigned CD-ROM (TrustCDROM has no effect), but when
a CD-ROM is signed, then I accept only a CD-ROM that I can verify.
I.E. if I can not import a signed CD-ROM I have to remaster the CD-ROM
and remove the .GPG-File. Then this new CD-ROM is a "trusted" CD-ROM,
too. This CD-ROM can be imported if TrustCDROM "DON'T CARE".

My "late decision patch" is a dirty solution.

Michael Vogt wrote:

Best Regards
Andreas