Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dnf doesn't pick up credentials stored in dnf.conf #2036

Closed
ashuk2000 opened this issue Jan 5, 2024 · 5 comments
Closed

Dnf doesn't pick up credentials stored in dnf.conf #2036

ashuk2000 opened this issue Jan 5, 2024 · 5 comments
Assignees

Comments

@ashuk2000
Copy link

ashuk2000 commented Jan 5, 2024

So I have a yml file where repo info is configured.

`
version: '2'
mpp-vars:
distro_name: rhivos
distro_copr_tree: epel
distro_version: 9
distro_baseurl: https://qartifactory.com/ER4
distro_baseurl_repo: $distro_baseurl/RHIVOS/$arch/os/
distro_repos:

  • id: rhivos
    baseurl: $distro_baseurl/RHIVOS/$arch/os/
    priority: 10
  • id: automotive
    baseurl: https://mirror.stream.centos.org/SIGs/9-stream/automotive/$arch/packages-main/
    distro_devel_repos: []
    distro_debug_repos:
  • id: rhivos-debug
    baseurl: $distro_baseurl/RHIVOS/$arch/debug/
    priority: 10
    distro_module_id: platform:el9
    osname: rhel
    uefi_vendor: redhat
    linux_firmware_rpm: linux-firmware
    release_rpm: redhat-release
    `

This repo needs a username and password to be accessed which I have provided in /etc/dnf/dnf.conf

[qartifactory]
baseurl=https://qartifactory.com/ER4/RHIVOS/aarch64/os
name=rhivos
username=dummy-username
password=dummy-password

but when I build the image dnf gives error saying can't download the metadata,

if I embed the credentials in the url itself and put that in the yaml file it works fine. But I don't want to hardcode credentials in the yml

What am I doing wrong

@jrohel
Copy link
Contributor

jrohel commented Jun 19, 2024

yml file? Is this for another application that generates the configuration for DNF?

DNF configuration - the /etc/dnf/dnf.conf file looks fine at first glance. I don't see the enabled option there, so it uses the value from the global configuration and it is true (unless overridden for example in the main section). A repository with the id qartifactory should use the specified username and password.

I am wondering if there is a problem with some character in the name or password. I don't know what characters were used. At the very least, the ':' character cannot be used in the username option.

@jrohel
Copy link
Contributor

jrohel commented Jun 24, 2024

I can't preproduce the problem. Username and password are used from "dnf.conf". However, I created an issue for a problem with : in username rpm-software-management/libdnf#1669 .

@ashuk2000
Copy link
Author

Hi, the Yml file is part of automotive sample images
https://gitlab.com/CentOS/automotive/src/automotive-image-builder/-/blob/main/distro/autosd.ipp.yml?ref_type=heads

Anyways the issue is seen giving username and password both in
yml file and /etc/dnf/dnf.conf.
As the sample images too somehow uses dnf internally

And yes the username does contain a :
I guess thats the issue

@jrohel
Copy link
Contributor

jrohel commented Jun 24, 2024

@ashuk2000
Hello. Is it possible to change the username to not contain a colon? At least to test if it's the only problem.

@jrohel
Copy link
Contributor

jrohel commented Jul 15, 2024

Looks like the problem was the colon in the username.
The problem with the colon in the username is reported as issue rpm-software-management/libdnf#1669.

And fixed PRs:
rpm-software-management/libdnf#1668
rpm-software-management/librepo#316

I am closing this issue.

@jrohel jrohel closed this as completed Jul 15, 2024
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

No branches or pull requests

2 participants