LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-12-2024, 08:46 PM   #1
yvesjv
Member
 
Registered: Sep 2015
Location: Australia
Distribution: Slackware, Devuan, Freebsd
Posts: 566

Rep: Reputation: Disabled
Question How to verify all packages downloaded via mirrors via md5 or sha


Hello everyone,

Was traveling for the last few days and while residing in a hotel, I suspect they had a web proxy in between all clients and the internet.
While in the hotel, did the usual slackpkg update followed with the upgrade-all.
Then noticed quite a few md5 errors on the downloaded packages...

Quick question:-
Days later how do I go about verifying all packages downloaded and installed haven't been messed around with by comparing to the packages on the main repository?

Thanks in advance.
 
Old 04-13-2024, 05:07 AM   #2
SlackCoder
Member
 
Registered: Nov 2020
Posts: 40

Rep: Reputation: Disabled
Did you check whether you still have the packages you installed on disk? Slackpkg stores them under /var/cache/packages. You can check those against ones from a Slackware mirror.
 
Old 04-13-2024, 05:26 AM   #3
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,372

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
I would do it by reinstalling suspect packages.
 
1 members found this post helpful.
Old 04-13-2024, 05:46 AM   #4
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,791

Rep: Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470Reputation: 1470
The default /etc/slackpkg/slackpkg.conf has this set:
Code:
# If CHECKGPG is "on", the system will verify the GPG signature of each package
# before install/upgrade/reinstall is performed.
CHECKGPG=on
It checks the GPG signatures against the security@slackware.com public key you have earlier imported. The hotel doesn't have Patrick's private key to sign the messed around packages.

The md5 errors are possible if you downloaded from a mirror which was updating (or its update had been interrupted) and CHECKSUMS.md5 and the packages did not match at the moment.

Last edited by Petri Kaukasoina; 04-13-2024 at 05:47 AM.
 
2 members found this post helpful.
Old 04-13-2024, 05:59 AM   #5
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 961

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
I would do the following:
  1. Download the file CHECKSUMS.md5 for your version of Slackware
  2. Download the file CHECKSUMS.md5.asc, also from your favorite mirror
  3. Validate the file CHECKSUMS.md5 with the command: "gpg --verify CHECKSUMS.md5"
  4. Once you can trust the big file CHECKSUMS.md5, make a copy and in that copy only keep the lines of the files that you want to test. You might also want to edit the paths to those files if you have stored them somewhere else.
  5. Run the command "md5sum -c my_copy_of_CHECKSUMS.md5"

The following assumes that you since previously have stored the public GPG-KEY in your keyring. If you already haven't done so and don't trust your downloads, you will be able to find that file on old official installation media if you happen to have any such laying around. The man page of gpg describes how to add such a public key to your keyring.

regards Henrik
 
2 members found this post helpful.
Old 04-13-2024, 07:32 AM   #6
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,973

Rep: Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551
Quote:
Originally Posted by SlackCoder View Post
Did you check whether you still have the packages you installed on disk? Slackpkg stores them under /var/cache/packages. You can check those against ones from a Slackware mirror.
Only if DELALL=off. The default is DELALL=on.

From slackpkg.conf.
Code:
# If DELALL is "on", all downloaded files will be removed after install.
DELALL=on
 
2 members found this post helpful.
Old 04-13-2024, 08:36 AM   #7
TheTKS
Member
 
Registered: Sep 2017
Location: Ontario, Canada
Distribution: Slackware, X/ubuntu, OpenBSD, OpenWRT
Posts: 361

Rep: Reputation: 243Reputation: 243Reputation: 243
If you want to check which installed packages have a problem before taking any other action or because you didn't save the list of packages with md5sum error warnings, then do as @henca wrote first.

If you saved the list of files with md5sum error warnings, and you still want to go through those steps, it might save a bit of your time to skip step 4 and change the last command to
Code:
$ md5sum -c --quiet CHECKSUMS.md5
If what you're actually trying to do is most quickly make sure all upgraded packages are verified and installed correctly, then this set of steps probably takes the least amount of your time:

With the list of packages that showed those errors, do as @allend wrote and use slackpkg to try reinstalling each one individually.
Code:
# slackpkg reinstall [packagename1] [packagename2] ... [packagenameN]
ex.
Code:
# slackpkg reinstall curl
You can, but don't need to, write out the full packagename without its extension
ex.
Code:
# slackpkg curl-8.7.1-x86_64-1_slack15.0
If many packages from a set showed md5sum error warning, it might save you more of your time to reinstall the whole set.

If the warnings are because your mirror was syncing while you were upgrading packages or had some other problem, you will have to wait until that's resolved to reinstall, or you could temporarily pick another mirror in /etc/slackpkg/mirrors that is up to date.

TheTKS

Last edited by TheTKS; 04-13-2024 at 08:47 AM.
 
1 members found this post helpful.
Old 04-13-2024, 09:31 AM   #8
viel
Member
 
Registered: Jul 2021
Location: Arcadia
Distribution: Slackware
Posts: 48

Rep: Reputation: Disabled
Quote:
Originally Posted by henca View Post
I would do the following:
  1. Download the file CHECKSUMS.md5 for your version of Slackware
  2. Download the file CHECKSUMS.md5.asc, also from your favorite mirror
  3. Validate the file CHECKSUMS.md5 with the command: "gpg --verify CHECKSUMS.md5"
  4. Once you can trust the big file CHECKSUMS.md5, make a copy and in that copy only keep the lines of the files that you want to test. You might also want to edit the paths to those files if you have stored them somewhere else.
  5. Run the command "md5sum -c my_copy_of_CHECKSUMS.md5"

The following assumes that you since previously have stored the public GPG-KEY in your keyring. If you already haven't done so and don't trust your downloads, you will be able to find that file on old official installation media if you happen to have any such laying around. The man page of gpg describes how to add such a public key to your keyring.

regards Henrik

In commands:

Code:
mkdir /tmp/check.md5
cd /tmp/check.md5/
wget -c https://mirrors.slackware.com/slackware/slackware64-15.0/CHECKSUMS.md5
wget -c https://mirrors.slackware.com/slackware/slackware64-15.0/CHECKSUMS.md5.asc
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 40102233
gpg CHECKSUMS.md5.asc
md5sum /opt/slackware-repositories/x86/slackware/slackware64-15.0/slackware64/a/bash-5.1.016-x86_64-1.txz
grep bash-5.1.016-x86_64-1.txz CHECKSUMS.md5
Change bash for your packages files.

 
2 members found this post helpful.
Old 04-13-2024, 06:31 PM   #9
yvesjv
Member
 
Registered: Sep 2015
Location: Australia
Distribution: Slackware, Devuan, Freebsd
Posts: 566

Original Poster
Rep: Reputation: Disabled
Thanks everyone.
My bad I did not print-screen as I was in a hurry to go into a meet.
Just to be sure, I've decided to download the repo reinstall the packages from scratch.

But OTOH, what mechanisms are in place to thwart a mirror being compromised OR having an mitm such as a packetlogic (nowadays sandvine) hijack the downloads?
 
Old 04-14-2024, 12:21 AM   #10
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,583
Blog Entries: 19

Rep: Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454
Quote:
Originally Posted by yvesjv View Post
But OTOH, what mechanisms are in place to thwart a mirror being compromised OR having an mitm such as a packetlogic (nowadays sandvine) hijack the downloads?
Every package is signed by Patrick's private key, and the corresponding public key is downloaded from a different source, not from the repository itself. Even if the repository were compromised by rogue packages with corresponding md5sums, they couldn't be signed correctly. But this depends on users not switching off signature checking in slackpkg.
 
5 members found this post helpful.
Old 04-14-2024, 01:14 PM   #11
yvesjv
Member
 
Registered: Sep 2015
Location: Australia
Distribution: Slackware, Devuan, Freebsd
Posts: 566

Original Poster
Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by hazel View Post
But this depends on users not switching off signature checking in slackpkg.
Awesome info.
 
Old 04-15-2024, 10:46 AM   #12
SlackCoder
Member
 
Registered: Nov 2020
Posts: 40

Rep: Reputation: Disabled
Quote:
Originally Posted by yvesjv View Post
Hello everyone,

While in the hotel, did the usual slackpkg update followed with the upgrade-all.
Then noticed quite a few md5 errors on the downloaded packages...

Thanks in advance.
I just dug a bit deeper into this, having run into this before myself.

Slackpkg doesn't install packages when an MD5 check fails. An attempt is made to download a package multiple times. Each time a package check fails after download, the error is reported, but when it tries again and succeeds, its installed.

Last edited by SlackCoder; 04-15-2024 at 04:13 PM.
 
Old 04-16-2024, 07:28 AM   #13
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Quote:
Originally Posted by hazel View Post
Every package is signed by Patrick's private key, and the corresponding public key is downloaded from a different source, not from the repository itself. Even if the repository were compromised by rogue packages with corresponding md5sums, they couldn't be signed correctly. But this depends on users not switching off signature checking in slackpkg.
What that won't protect against is a downgrade attack: where a repo is MITM'd to an older state containing older known to be vulnerable packages (complete with their genuine signatures). To prevent that sort of thing Pat would have to start including an incremental sequence number in the signed CHECKSUMS.md5 that could be checked by update tools.
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Git takes baby steps towards swapping out vulnerable SHA-1 hashing algo for SHA-256 LXer Syndicated Linux News 0 02-05-2020 06:45 PM
[SOLVED] ssh client connecting to ssh server for first time verify sha or md5 question mtdew3q Linux - Server 2 01-31-2017 05:01 AM
Off-the-Record plugin, SHA-1 or SHA-2? madbullet Linux - Security 1 06-21-2010 09:28 AM
How to verify downloaded files with MD5 file? ICO Linux - General 3 03-15-2004 11:28 PM
SHA, MD5, LDAP for passwords mastahnke Linux - Security 2 09-25-2003 02:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration