hashicorp / consul

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
https://www.consul.io
Other
28.41k stars 4.43k forks source link

RPM packages abuse scriptlets in violation of fedora/redhat packaging guidance #16861

Open drawks opened 1 year ago

drawks commented 1 year ago

Overview of the Issue

When using the rpm packages as provided by this project during install or upgrade scriptlets present in the package

During installation/upgrade of the rpm packages provided by this project several scriptlets are run which do the following:

While these actions are made with good intent they are in some cases fully in violation of the fedora/redhat packaging guidelines and in other cases implemented in a way which can create subtle and disruptive problems for users.

Reproduction Steps

  1. Follow the installations steps as documented for any of the supported rpm based distributions (RHEL, CentOS, Fedora, Amazon Linux).
  2. Run rpm -q --scripts consul and observe that all of the above details of how the rpm package scriptlets behave is true.

Operating system and Environment details

Any currently supported rpm based distribution as detailed in Hasicorp's packaging guide, currently:

Fedora 33, 34, 35, 36, 37
RHEL/CentOS 7, 8, 9
AmazonLinux 2, latest
drawks commented 1 year ago

Just after hitting "create" on this issue I also noticed that the scriptlets delete the consul user in the postuninstall scriptlet if they receive purge as the first argument to the script. Deleting users/groups in scriptlets is very expressly forbidden in the Fedora packaging guidelines, but this code path doesn't actually seem reachable as rpm/yum/dnf do not use the purge argument; it appears that this is perhaps an artifact of deb/apt packaging and/or the use of a tool like alien or fpm to generate multiple platform specific packages simultaneously. I'd advise against using such tools as they tend to result in the types of issues as I've detailed here.

drawks commented 1 year ago

I just spent a little while crawling through the github actions that are used to for building the release artifacts and see now that nfpm is being used to generate both deb and rpm packages. So naturally these scripts should be compliant with the policy requirements and expectations of both flavors of linux distro. I'll see if I can float a PR that addresses my above issues with the rpm packaging and also make similar changes where needed for debian policy compliance.