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

Allow dl.suse.com in SMT to make CDN switch to Akami work #148

Open
wants to merge 2 commits into
base: SMT12
Choose a base branch
from

Conversation

felixsch
Copy link
Contributor

@felixsch felixsch commented Dec 10, 2024

SMT currently does not detect dl.suse.com and dl-ipv4.suse.com as SUSE owned repositories and automatically disables authentication on these repositories (CATALOGTYPE == 'zypp` instead of 'nu').

To fix this the hosts need to be added to NUHOSTS.

How to test this fix:
(first, prepare for impact, grab a coffee)

Run a SMT using Vagrant. Here the vagrant file:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "https://download.suse.de/install/SLE-12-SP5-Vagrant-GM/SLES12-SP5-Vagrant.x86_64-12.5-libvirt-GM.vagrant.libvirt.box"

  regcode = ENV['REGCODE']

  config.vm.network "forwarded_port", guest: 80, host: 8080

  config.vm.provider "libvirt" do |v|
    v.memory = 4048
    v.cpus = 2
    v.driver = "kvm"
    v.storage :file, :size => "150G", :bus => "virtio"
  end

  config.vm.provision "shell", inline: <<-SHELL
      if [ ! -f /etc/zypp/credentials.d/SCCCredentials ]; then
        sudo SUSEConnect -r #{regcode}
      fi
      sudo zypper --non-interactive update
      sudo zypper --non-interactive install -y bc cron vim ca-certificates
      sudo zypper --non-interactive install -y smt SuSEfirewall2 mariadb e2fsprogs yast2-smt

      sudo rcmysql start
      mysqladmin -u root password root
  SHELL

  config.vm.provision "shell", inline: <<-SHELL
    sudo mkfs.ext4 /dev/vdb
    sudo mkdir -p /srv/www/htdocs
    sudo mount /dev/vdb /srv/www/htdocs
    echo '/dev/vdb  /srv/www/htdocs  ext4  defaults  0  2' | sudo tee -a /etc/fstab
  SHELL
end

When ready connect via vagrant ssh and configure SMT as usual (hint: sudo yast2 smt-wizard)

After that you need a glue with https://github.com/SUSE/happy-customer/pull/7982 applied and configuration updated (you need to point glues default_url_options towards the address for the host inside your vagrant container. Probably something along the line 192.168.121.1).

Run glue and update /etc/smt.conf to point towards your host.

# Update repos, subscriptions etc
# smt-scc-sync

# Enable the 15 SP6 Pool repo (select only x86_64; probably selection 4)
# smt-repos --enable-mirror SLE-Product-SLES15-SP6-Pool

# Mirror the repo
# smt-mirror --repository 6301
# Expect this to work!

# Grab the database data for completeness
$ mysql -u smt -p smt  -e 'SELECT * FROM Catalogs WHERE CATALOGID = 6301'

Now the switchover:

Update SMT from here: https://download.opensuse.org/repositories/home:/fschnizlein:/branches:/SUSE:/SLE-12-SP1:/Update/SLE_12_SP5/home:fschnizlein:branches:SUSE:SLE-12-SP1:Update.repo

# ON GLUE in a rails console
> repo = Repository.find(6301)
> repo.url = "https://dl.suse.com/SUSE/Products/SLE-Product-SLES/15-SP6/x86_64/product"
> repo.save

# ON SMT
$ smt-scc-sync
$ mysql -u smt -p smt  -e 'SELECT * FROM Catalogs WHERE CATALOGID = 6301'
# expect: Data has changed and especially AUTHTOKEN is updated

$ smt-mirror --repository 6301
# expect: See it working, nothing has been downloaded since we uptodate

# again select the x86_64 repo
$ smt-repos --disable-mirror SLE-Product-SLES15-SP6-Pool
$ smt-repos --delete SLE-Product-SLES15-SP6-Pool
$ smt-repos --enable-mirror SLE-Product-SLES15-SP6-Pool
$ smt-mirror --repository 6301
# expect: It fully mirrors the repository

You done it congrats!

Thanks for this review, I know this is not fun

This also updates the default NUUrl path to dl.suse.com
@felixsch felixsch force-pushed the detect-akami-cdn-urls branch from 2c3a880 to befea31 Compare December 17, 2024 15:07
@@ -1607,7 +1608,7 @@ sub _updateProductData
printLog($self->{LOG}, $self->vblevel(), LOG_ERROR, "Cannot connect to database.");
return 1;
}
my $nuurl = URI->new($self->{CFG}->val("NU", "NUUrl", "https://updates.suse.com/"));
my $nuurl = URI->new($self->{CFG}->val("NU", "NUUrl", "https://dl.suse.com/"));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the default value taken when no NUUrl is set when an SMT gets configured without setting this attribute in the config. This mean it only affects new installations which configure SMT without the wizard and do not set this value.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, maybe add this as a comment here for future us?

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.

3 participants