How to determine system is pfSense?
In ansible we're running into an issue where we need to distinguish between FreeBSD and pfSense (see https://github.com/ansible/ansible/issues/41970). What would be the best way to do this?
Not really my field but maybe:
[2.4.3-RELEASE][firstname.lastname@example.org]/root: sysctl kern.ident kern.ident: pfSense
root@FreeBSD11:~ # sysctl kern.ident kern.ident: GENERIC
I would treat only "pfSense" as pfSense and everything else as FreeBSD because custom built FreeBSD is likely to have a custom kernel as well.
Would a uname -a give you what you want ?
[2.4.3-RELEASE][email@example.com]/root: uname -a FreeBSD pfsense.xxxxxxxxxx.net 11.1-RELEASE-p10 FreeBSD 11.1-RELEASE-p10 #23 r313908+9347c667615(factory-RELENG_2_4): Thu May 10 15:09:29 CDT 2018 firstname.lastname@example.org:/xbuilder/crossbuild-243/pfSense/tmp/obj/xbuilder/crossbuild-243/pfSense/tmp/FreeBSD-src/sys/pfSense amd64 [2.4.3-RELEASE][email@example.com]/root:
Raspberry PI running FreeBSD:-
$ uname -a FreeBSD sftp 11.1-RELEASE FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 14:27:25 UTC 2017 firstname.lastname@example.org:/usr/obj/arm.armv6/usr/src/sys/RPI2 arm $
On modern pfSense installs, there are a number of ways. The
unamedata as already mentioned, the contents of
/etc/platform, the presence of the
pfSensepkg, and likely dozens/hundreds of other methods based on the presence of certain files around the filesystem specific to pfSense.