LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-07-2021, 03:35 PM   #1
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 316

Rep: Reputation: 169Reputation: 169
I have run slackpkg update gpg instead of slackpkg update


On Slackware -current, because I wasn't concentrating, I typed slackpkg update gpg when I meant to type slackpkg update.

I would have run slackpkg update gpg when I first used slackpkg, so this means I have updated the gpg for a second time.

I ran
Code:
slackpkg update
slackpkg install-new
slackpkg upgrade-all
slackpkg clean-system
afterwards and it completed the updates successfully.

Is running slackpkg update gpg by mistake going to cause a problem?
 
Old 08-07-2021, 04:43 PM   #2
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 916

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
No problem
 
Old 08-07-2021, 05:05 PM   #3
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 316

Original Poster
Rep: Reputation: 169Reputation: 169
No problem is reassuring. Thanks for the reply.
 
Old 08-07-2021, 06:47 PM   #4
johnny23
Member
 
Registered: Aug 2009
Location: Lapu-Lapu City, Philippines
Distribution: Slackware
Posts: 62

Rep: Reputation: 44
Quote:
Originally Posted by amikoyan View Post
On Slackware -current, because I wasn't concentrating, I typed slackpkg update gpg when I meant to type slackpkg update.

I would have run slackpkg update gpg when I first used slackpkg, so this means I have updated the gpg for a second time.

I ran
Code:
slackpkg update
slackpkg install-new
slackpkg upgrade-all
slackpkg clean-system
afterwards and it completed the updates successfully.

Is running slackpkg update gpg by mistake going to cause a problem?
I run gpg update every time before update mainly because I use bash history and all the commands are in an && command line, including install-new. It hasn't hurt anything so far.
 
2 members found this post helpful.
Old 08-08-2021, 03:53 AM   #5
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,975

Rep: Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551
Quote:
Originally Posted by amikoyan View Post
Is running slackpkg update gpg by mistake going to cause a problem?
No. Running 'slackpkg update gpg' simply checks your key file for the signatures, if not found, adds them; otherwise nothing is changed. If you look closely at the output of 'slackpkg update gpg' you will see the following after each signature is checked if nothing has changed.

Code:
gpg: Total number processed: 1
gpg:              unchanged: 1
 
1 members found this post helpful.
Old 08-08-2021, 12:22 PM   #6
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 316

Original Poster
Rep: Reputation: 169Reputation: 169
Thank you johnny23 and chrisretusn.

It is reassuring to know I have done no harm.

I must be more careful with slackpkg in future though. I might not be so lucky next time.
 
Old 08-08-2021, 12:37 PM   #7
Regnad Kcin
Member
 
Registered: Jan 2014
Location: Beijing
Distribution: Slackware 64 -current .
Posts: 663

Rep: Reputation: 460Reputation: 460Reputation: 460Reputation: 460Reputation: 460
I typed
Quote:
rm * -Rfv
when what I meant to say was
Quote:
ls -l
 
1 members found this post helpful.
Old 08-08-2021, 03:51 PM   #8
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 316

Original Poster
Rep: Reputation: 169Reputation: 169
I have never managed to do that...

but there's a first time for everything
 
Old 08-09-2021, 06:03 AM   #9
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,975

Rep: Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551
Quote:
Originally Posted by amikoyan View Post
Thank you johnny23 and chrisretusn.

It is reassuring to know I have done no harm.

I must be more careful with slackpkg in future though. I might not be so lucky next time.
slackpkg is fairly safe to use. The gotcha could be 'slackpkg clean-system' and third party packages, if they are not in the blacklist, they could be removed. The good thing is with the default settings in /etc/slackpkg/slackpkg.conf, you get a chance before committing with the selection screen dialog. True is for other options that will upgrade or install new slackware packages.

I use slackpkg with slackpkg+, which allows third party packages to be handled by slackpkg. You don't blacklist third party package in this case as slackpkg+ handles this.
 
Old 08-09-2021, 10:10 AM   #10
drgibbon
Senior Member
 
Registered: Nov 2014
Distribution: Slackware64 15.0
Posts: 1,221

Rep: Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943
Quote:
Originally Posted by johnny23 View Post
I run gpg update every time before update mainly because I use bash history and all the commands are in an && command line, including install-new. It hasn't hurt anything so far.
This actually circumvents the purpose of GPG. From the man page:
Quote:
# slackpkg update gpg
The GPG key doesn't change. This should be a "one time" command - run it once and forget it...
The idea is that you run the command once to obtain Slackware's "true" public key (ignoring all the trust issues around this), which slackpkg subsequently relies on for each update to check that the downloaded files really came from the Slackware team (I didn't look, but I guess it verifies CHECKSUMS.md5.asc, and then the MD5 hashes inside CHECKSUMS.md5 for the individual packages prior to installing. I really wish the Slackware team would stop using MD5 for this purpose, but anyway..).

As an example, let's say someone hacked your favourite mirror and put malware on there: What would normally happen is that they couldn't produce a proper signature which verifies against Slackware's real public key (which your system would have), and slackpkg would notice this and the update would fail. But, if you keep updating the GPG key on every update and the mirror is compromised, then you would overwrite the true Slackware public key with a bogus one from the compromised mirror[1], and then slackpkg will happily install the malware onto your system (since your bogus public key now matches the bogus private key used to sign the malware). In reality slackpkg may warn about this case (the GPG key changing), but I don't know.

Long story short, you only want to run `slackpkg update gpg` one time. That gives you the public key, which is your long-term assurance for genuine downloads as you update from any Slackware mirror.

*edit* [1] This is not true on slackpkg any more, since it grabs the public key from slackware.com instead of the mirror.

Last edited by drgibbon; 08-09-2021 at 04:57 PM.
 
1 members found this post helpful.
Old 08-09-2021, 10:14 AM   #11
drgibbon
Senior Member
 
Registered: Nov 2014
Distribution: Slackware64 15.0
Posts: 1,221

Rep: Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943
Quote:
Originally Posted by johnny23 View Post
because I use bash history and all the commands are in an && command line, including install-new.
You could also just alias this to whatever you like, say in ~/.bashrc
Code:
alias update="slackpkg -batch='on' update && slackpkg install-new && slackpkg upgrade-all && slackpkg clean-system"
 
2 members found this post helpful.
Old 08-09-2021, 12:21 PM   #12
amikoyan
Member
 
Registered: Mar 2021
Distribution: Slackware64 -current
Posts: 316

Original Poster
Rep: Reputation: 169Reputation: 169
Quote:
Originally Posted by drgibbon View Post
This actually circumvents the purpose of GPG. From the man page:

The idea is that you run the command once to obtain Slackware's "true" public key (ignoring all the trust issues around this), which slackpkg subsequently relies on for each update to check that the downloaded files really came from the Slackware team (I didn't look, but I guess it verifies CHECKSUMS.md5.asc, and then the MD5 hashes inside CHECKSUMS.md5 for the individual packages prior to installing. I really wish the Slackware team would stop using MD5 for this purpose, but anyway..).

As an example, let's say someone hacked your favourite mirror and put malware on there: What would normally happen is that they couldn't produce a proper signature which verifies against Slackware's real public key (which your system would have), and slackpkg would notice this and the update would fail. But, if you keep updating the GPG key on every update and the mirror is compromised, then you would overwrite the true Slackware public key with a bogus one from the compromised mirror, and then slackpkg will happily install the malware onto your system (since your bogus public key now matches the bogus private key used to sign the malware). In reality slackpkg may warn about this case (the GPG key changing), but I don't know.

Long story short, you only want to run `slackpkg update gpg` one time. That gives you the public key, which is your long-term assurance for genuine downloads as you update from any Slackware mirror.

It was reading this entry in the man page that prompted my original post - I had unintentionally run the command twice.

So, if i understand correctly: provided that the public key was still genuine, I have not done any harm. However repeatedly running 'slackpkg update gpg' increases the risk that you will download something malicious, even if the probability of this is small.

It was careless of me to do this , but I have learnt something.

Last edited by amikoyan; 08-09-2021 at 12:25 PM. Reason: spelling
 
Old 08-09-2021, 04:53 PM   #13
drgibbon
Senior Member
 
Registered: Nov 2014
Distribution: Slackware64 15.0
Posts: 1,221

Rep: Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943
Quote:
Originally Posted by amikoyan View Post
So, if i understand correctly: provided that the public key was still genuine, I have not done any harm. However repeatedly running 'slackpkg update gpg' increases the risk that you will download something malicious, even if the probability of this is small.
Right, the basic problem to be solved is to obtain the correct public key, so repeatedly downloading it goes against that goal (even with slim odds of getting a bogus key).

Also it looks like my info is out of date on -current and regular slackpkg. Testing with slackpkg+ currently gives the old method (key from mirror):
Code:
~# slackpkg update gpg

2021-08-10 05:45:40 URL:http://mirrors.us.kernel.org/slackware/slackware64-current/GPG-KEY [1572/1572] -> "/tmp/slackpkg.WYYcUG/gpgkey" [1]
pub  1024D/40102233 2003-02-26 Slackware Linux Project <security@slackware.com>
sub  1024g/4E523569 2003-02-26 [expires: 2038-01-19]
but with regular slackpkg:
Code:
~# slackpkg update gpg
Getting key from https://www.slackware.com/infra/keys/GPG-KEY
Slackware Linux Project's GPG key added
So the thing I mentioned about pulling a bogus key from a hacked mirror is no longer true with regular slackpkg (of course the Slackware server could get hacked too, but anyways).
 
Old 08-15-2021, 02:12 AM   #14
johnny23
Member
 
Registered: Aug 2009
Location: Lapu-Lapu City, Philippines
Distribution: Slackware
Posts: 62

Rep: Reputation: 44
Quote:
Originally Posted by amikoyan View Post
It was reading this entry in the man page that prompted my original post - I had unintentionally run the command twice.

So, if i understand correctly: provided that the public key was still genuine, I have not done any harm. However repeatedly running 'slackpkg update gpg' increases the risk that you will download something malicious, even if the probability of this is small.

It was careless of me to do this , but I have learnt something.
The point is, it only breaks anything if one or more of the GPG keys have been compromised. If you're an LQ user it's unlikely you won't have noticed that. Keys have been officially updated during my time using Slackware, so if you don't customarily do the update if you get an error don't jump to the conclusion that it's an exploit, check if the keys need to be updated.
 
  


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
gpg / gpg-agent -- Can't connect to /root/.gnupg/S.gpg-agent jrtayloriv Linux - Security 9 06-03-2019 10:06 AM
[SOLVED] [ENCHANCEMENT] slackpkg+: do not show the notices "pkglist is older than 24h..." and "remember to re-run 'slackpkg update''..."... yars Slackware 1 01-09-2016 09:56 AM
[SOLVED] Slackpkg update error - gpg signature on cheksum stoa Slackware 2 06-13-2015 05:28 PM
Slackpkg refuses to update - always claims a GPG error black hole sun Slackware 14 09-05-2011 12:30 PM
GPG: Bad session key gpg between gpg on linux and gpg gui on windows XP konqi Linux - Software 1 07-21-2009 09:37 AM

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

All times are GMT -5. The time now is 07:45 AM.

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