Bug 1198723

Summary: [RFE] GPG support for Debian packages /repos
Product: [Community] Spacewalk Reporter: schuler.philipp
Component: ServerAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.2CC: bzed, Paul-Andre.Panon, robert.paschedag, tkasparek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-15 07:59:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 737830, 1653216    
Attachments:
Description Flags
apt-transport-spacewalk patch for signed repos
none
apt-transport-spacewalk patch for signed repos
none
spacewalk-server patch for signed repos
none
script for generating metafiles for repo signing
none
spacewalk-server patch for signed repos
none
apt-transport-spacewalk patch for signed repos
none
script for generating metafiles for repo signing none

Description schuler.philipp 2015-03-04 17:13:57 UTC
Description of problem:
repomd should generate Release and Release.gpg files for debian repos in here after

https://github.com/spacewalkproject/spacewalk/blob/master/java/code/src/com/redhat/rhn/taskomatic/task/repomd/DebRepositoryWriter.java#L90

That way the packages can be authenticated by APT.
Its quite simple. Would do it myself but dont know how to build the Spacewalk project :/

Reference: https://wiki.debian.org/SecureApt#Secure_apt_groundwork:_checksums

Comment 1 schuler.philipp 2015-03-09 15:44:34 UTC
Created attachment 999611 [details]
apt-transport-spacewalk patch for signed repos

Comment 2 schuler.philipp 2015-03-09 15:45:21 UTC
Created attachment 999612 [details]
apt-transport-spacewalk patch for signed repos

Comment 3 schuler.philipp 2015-03-09 15:47:04 UTC
Created attachment 999613 [details]
spacewalk-server patch for signed repos

Comment 4 schuler.philipp 2015-03-09 15:52:59 UTC
I have got it working with some patches to package apt-transport-spacewalk for the client side and a small patch to backend/server/rhnRepository.py for server side.
Diffs are attached.

This changes the way the sources.list is layouted, from
deb spacewalk://spacewalk.xxx.lan channels: main precise-spacewalk-client precise-security precise-updates

which is wrong and doesnt follow the debian repo format to

deb spacewalk://spacewalk.xxx.lan precise repodata
deb spacewalk://spacewalk.xxx.lan precise-spacewalk-client repodata
deb spacewalk://spacewalk.xxx.lan precise-security repodata
deb spacewalk://spacewalk.xxx.lan precise-updates repodata


Whats left todo is add the generation of the Release and Release.gpg file to DebRepositoryWriter.java
I have a small bash script for that as cron now. See attachement.

Comment 5 schuler.philipp 2015-03-09 15:53:46 UTC
Created attachment 999617 [details]
script for generating metafiles for repo signing

Comment 6 schuler.philipp 2015-03-10 12:10:33 UTC
Some more info on how to put this together
http://www.devops-blog.net/spacewalk/gpg-signing-apt-repository-in-spacewalk

Comment 7 ppanon-avi 2017-07-20 17:16:16 UTC
Created attachment 1301897 [details]
spacewalk-server patch for signed repos

Updated to work with Spacewalk backend 2.6.78

Comment 8 ppanon-avi 2017-07-20 17:19:14 UTC
Created attachment 1301909 [details]
apt-transport-spacewalk patch for signed repos

Updates two files, pre_invoke.py and spacewalk in current Debian/Ubuntu Spacewalk client.

Comment 9 ppanon-avi 2017-07-20 17:21:23 UTC
Created attachment 1301915 [details]
script for generating metafiles for repo signing

Added command to generate InRelease file used by Debian and Ubuntu 16.04+ apt-get client

Comment 10 ppanon-avi 2017-07-20 17:22:48 UTC
Uploaded updated patches for Spacewalk 2.6 and Ubuntu 16.04

Comment 11 Tomáš Kašpárek 2018-04-06 08:21:05 UTC
spacewalk.git(master): b3dd522b157449be85640625f363b25b0861503e

Comment 12 ppanon-avi 2018-06-07 19:32:28 UTC
I messed up in the spacewalk-server patch update. I saw an error and tried to fix it but didn't do it right. The default content-type is application-gzip. modules.yaml isn't a gzip file, and neither are the Release files. To set content-types correctly the code block should look like

@@ -237,17 +235,13 @@

         if file_name in ["repomd.xml", "comps.xml"]:
             content_type = "text/xml"
+        elif file_name in ["InRelease", "Release", "Release.gpg"]:
+            content_type = "text/plain"
+        elif file_name in ["modules.yaml"]:
+            content_type = "application/x-yaml"
         elif file_name not in ["primary.xml.gz", "other.xml.gz",
                                "filelists.xml.gz", "updateinfo.xml.gz", "Packages.gz"]:
             log_debug(2, "Unknown repomd file requested: %s" % file_name)
             raise rhnFault(6)

Comment 13 ppanon-avi 2018-06-07 19:36:18 UTC
Although maybe "Release.gpg" should have "application/pgp-signature" as content-type

Comment 14 ppanon-avi 2018-06-08 00:10:14 UTC
Um, make that application/gpg-signature

Comment 16 Michael Mráka 2018-11-26 09:43:56 UTC
Move Spacewalk 2.9 bugs ON_QA.

Comment 17 Michael Mráka 2019-01-15 07:59:24 UTC
Spacewalk 2.9 has been released.
https://github.com/spacewalkproject/spacewalk/wiki/ReleaseNotes29