install.crowdsec.net: pygpgme install attempted (and fails) on AlmaLinux/Rocky/RHEL/CentOS Stream 8+
kind/bugneeds/triage
## Summary
The `install.crowdsec.net` script tries to `yum install pygpgme` on AlmaLinux 8 (and other RHEL-family 8+ distros), which fails because `pygpgme` was a Python-2-era package and is no longer in EL8+ repositories.
The install itself still completes successfully (a `WARNING:` is printed and execution continues), but the misleading error output is confusing and looks like a hard failure.
## Reproduce
```sh
# On AlmaLinux 8:
curl -s https://install.crowdsec.net | sudo sh
```
Output (excerpt):
```
Detected operating system as almalinux/8.
...
Installing pygpgme to verify GPG signatures...
...
No match for argument: pygpgme
Error: Unable to find a match: pygpgme
WARNING:
The pygpgme package could not be installed. This means GPG verification is
not possible for any RPM installed on your system.
To fix this, add a repository with pygpgme. Usually, the EPEL repository
for your system will have this.
...
```
Same behaviour on Rocky Linux 8/9, RHEL 8/9, CentOS Stream 8/9.
## Root cause
The script *intends* to skip `pygpgme` on RHEL-family 8+ — that logic exists at the top of the script:
```sh
if [ "\$os" = "ol" ] || [ "\$os" = "el" ] && [ "\$dist" -gt 7 ]; then
_skip_pygpgme=1
else
_skip_pygpgme=0
fi
```
But it only matches `os=ol` (Oracle Linux) or literal `os=el`. `/etc/os-release` reports `ID=almalinux`, `ID=rocky`, `ID=rhel`, `ID=centos`, never literal `el`, so all of those distros fall through to `_skip_pygpgme=0` and trigger the doomed `yum install -y pygpgme` in `finalize_yum_repo()`.
## Proposed fix
Replace the `if/else` with a `case` covering the whole RHEL family:
```sh
case "\$os" in
ol|el|rhel|centos|almalinux|rocky)
if [ "\$dist" -gt 7 ]; then
_skip_pygpgme=1
else
_skip_pygpgme=0
fi
;;
*)
_skip_pygpgme=0
;;
esac
```
Happy to open a PR if the source is in this repo (or another) — please point me at it.
## Context
Originally filed against the wrong project at crowdsecurity/cs-whm-plugin#11; moving here as the script header in `install.crowdsec.net` directs reports to this repo.
3 条评论