Skip to content

Fixed initializing the GPG callbacks during registration#3395

Open
lslezak wants to merge 5 commits intomasterfrom
gpg-callbacks
Open

Fixed initializing the GPG callbacks during registration#3395
lslezak wants to merge 5 commits intomasterfrom
gpg-callbacks

Conversation

@lslezak
Copy link
Copy Markdown
Contributor

@lslezak lslezak commented Apr 17, 2026

Problem

Solution

  • Properly initialize the libzypp callbacks so the answer from the profile is not ignored
  • Added more debug logging, might be useful in the future too
  • Expect the GPG key fingerprint in the answer using the human readable format (with spaces) so it matches the previous behavior and documentation.

Testing

  • Tested manually with minimal profile (see bugzilla)
Logs showing importing the GPG key
Apr 17 08:46:04 <6> agama-web-server[80322]: keyringwf.cc(findKey):188: [zypp] Key [488C583D287A0027] openSUSE Backports for SUSE Linux 16 <sle-backports-202500514@opensuse.org> is not trusted
Apr 17 08:46:04 <5> agama-web-server[80322]: agama-software/src/callbacks/security.rs:78: accept_key callback: key_id='488C583D287A0027', key_name='openSUSE Backports for SUSE Linux 16 <sle-backports-202500514@opensuse.org>', key_fingerprint='BF3F9A67D3A2FF98A73F5E07488C583D287A0027'
Apr 17 08:46:04 <5> agama-web-server[80322]: agama-utils/src/question/service.rs:129: Asking question: Question { id: 1, spec: QuestionSpec { text: "The key 488C583D287A0027 (openSUSE Backports for SUSE Linux 16 <sle-backports-202500514@opensuse.org>) with fingerprint BF3F 9A67 D3A2 FF98 A73F 5E07 488C 583D 287A 0027 is unknown. Do you want to trust this key?", class: "software.import_gpg", field: None, actions: [Action { id: "Trust", label: "Trust" }, Action { id: "Skip", label: "Skip" }], default_action: Some("Skip"), data: {"name": "openSUSE Backports for SUSE Linux 16 <sle-backports-202500514@opensuse.org>", "fingerprint": "BF3F 9A67 D3A2 FF98 A73F 5E07 488C 583D 287A 0027", "id": "488C583D287A0027"} }, answer: Some("[FILTERED]") }
Apr 17 08:46:04 <5> agama-web-server[80322]: agama-utils/src/question/service.rs:137: Question 1 answered
Apr 17 08:46:04 <5> agama-web-server[80322]: agama-software/src/callbacks/security.rs:124: Received answer: Answer { action: "Trust", value: None }
Apr 17 08:46:04 <7> agama-web-server[80322]: callbacks.cxx(askUserToAcceptKey):373: Callback askUserToAcceptKey(id: 488C583D287A0027, name: "openSUSE Backports for SUSE Linux 16 <sle-backports-202500514@opensuse.org>", fingerprint: BF3F9A67D3A2FF98A73F5E07488C583D287A0027, repository: SUSE_Package_Hub_16.1_x86_64:Backports-16.1) result: IMPORT
Apr 17 08:46:04 <6> agama-web-server[80322]: keyringwf.cc(findKey):197: [zypp] User wants to trust key [488C583D287A0027] openSUSE Backports for SUSE Linux 16 <sle-backports-202500514@opensuse.org>

.map_err(|e| RegistrationError::RefreshService(name.clone(), e))?;
zypp.load_source(
zypp_agama::callbacks::empty_progress,
&mut zypp_agama::callbacks::security::EmptyCallback,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JFYI: This is the root of the problem, using empty callbacks.

@lslezak lslezak changed the title Gpg callbacks Fixed initializing the GPG callbacks during registration Apr 17, 2026

self.config.as_ref().and_then(|config| {
if let Some(Policy::Auto) = config.policy {
tracing::info!("Returning automatic answer: {:?}", &spec.default_action);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would at least print some info about question so it is easier to see which question gets automatic answer.

#include <systemd/sd-journal.h>

// helper macro for logging messages to systemd journal
#define LOG(level, message) \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need another logger? we already have macros from libzypp that logs to journal - https://github.com/agama-project/agama/blob/master/rust/zypp-agama/zypp-agama-sys/c-layer/lib.cxx#L195

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants