How to differentiate between RHEL+ and Debian+?

We have “windows|mac|linux of operating system”, but is there any inspector-ese way to determine whether a linux version is RPM vs DEB compatible? If there’s no BigFix native inspector for this, what would you recommend? I’ve found that I might be able to test for an “/etc/debian_version” file on Debian+…what is there on RHEL+?

** “RHEL+” = RHEL, CentOS, Fedora, Oracle, Rocky, Alma…
“Debian+” = Debian, Ubuntu, Mint, Raspbian, MX, Kali…

exists property "rpm"
exists property "debianpackage"

4 Likes

Hi @straffin - Something as simple as “name of operating system” should give you the OS name to work some logic on, but @strawgate’s suggestion sounds good for the RPM compatibility.

./qna
Default masthead location, using /etc/opt/BESClient/actionsite.afxm
Q: name of operating system
A: Linux Red Hat Enterprise Server 7.9
T: 4612
I don’t have a Debian box to hand

I use the debainpackage and rpm introspectors as suggested by @strawgate, even to the extent of having 1 fixlet that can cater for downloading just the payload based on the platform using a prefetch block which then avoid having to maitnain a fixlet dpackages and another for rpm.

In case its of any use for others, this is a simple example (appreciate that may not be what you are doing, but no harm in sharing eh :wink: )

begin prefetch block
parameter "type" = "{if (exists properties whose(it as string contains "debianpackage:")) then ("deb") else (if (exists properties whose (it as string contains "rpm:")) then ("rpm") else ("other"))}"
if {(parameter "type") = "deb"}
	add prefetch item name=dpkg.zip sha1=ed326176d4011d57996a4828bacac6b00d913b17 sha256=185566e4b3442b0c9937c89f482234ca4b0a5e3bd7ad008a973f3fc405d294fb size=34934875 url=http://somewhere/mydomain.com:52311/Uploads/dkpg.zip
elseif {(parameter "type") = "rpm"}
	add prefetch item name=rpm.zip sha1=dc8da361bd76f97fc8de570160a153f059a772d4 sha256=d32144722421e7725b3a41c376789534ed1f236b220087feaa660357117f2fa4 size=34940866 url=http://somewhere/mydomain.com:52311/Uploads/rpm.zip
endif
end prefetch block

if {(parameter "type") = "deb"}
	do all the stuff for dpackages
elseif {(parameter "type") = "rpm"}
	do all the stuff for rpms
endif

Maybe its possible to use the name of operating system as suggested by @TivoliDave with a regex match which could then allow you to create a property that has values for the platforms you have, eg

matches (case insensitive regex "(red hat|debian|ubuntu|oracle linux|kali|suse)") of name of operating system

1 Like

I really wish HCL would take this approach with any Fixlet that targets multiple OS’s.

Thanks, @strawgate. exists property is the kind of “under the hood” stuff that I keep forgetting about (and that I need to learn a lot more about).

With the number of Linux distributions we have around here, a name of operating system based solution would be a never-ending game of whack-a-mole. However, they’re all generally based on either RHEL or Debian, so @strawgate’s solution is ideal. Thanks, tho!!

2 Likes

I’m trying to understand the use-case - do you have an example where we should do it that way?
Most of our content built around OS patching uses different download plugins, that need to be targeted by OS and version - we can’t use a RHEL repo to patch a CentOS machine, and the repos are specific to each OS version, even though they are both RPM format for example

I think I got my wires crossed on this topic. In Fixlet 1001: Download BigFix Inventory, the prefetch commands downloads the Linux and Windows installation packages, regardless of the target operating system. It would be helpful if the extra download could be avoided.

We do have another tool in this box with the operating system properties. It’s not a perfect match to your desire, but can be helpful with instances like Windows vs Linux (unix)

windows of operating system
unix of operating system    (includes linuxes)
mac of operating system
android of operating system

big endian of operating system
little endian of operating system

ia64 of operating system
x32 of operating system
x64 of operating system
1 Like