Specifying System ID on non-Netgate Hardware?
-
My MTB-2220, purchased from Netgate, but not built by Netgate, identifies itself in pfsense as an "MBT-2220":
But my Protectli FW4C does not really identify itself, as pfsense reports it as just a generic "pfsense" device:
Is there a way to specify/program/enter this value, so that it reports itself accurately?
-
Not built into pfSense. There is only code to identify Netgate hardware. You could patch it to add something if you really wanted to.
Steve
-
@stephenw10 said in Specifying System ID on non-Netgate Hardware?:
You could patch it to add something if you really wanted to.
Interesting! Where is the place/file that can be patched to change that generic entry?
I wish a nice Weekend,
fireodo -
Thanks. Is this set in the BIOS somewhere? Did Silicom put their ID in there on the units they OEMed for Netgate?
-
It would be in this function:
https://github.com/pfsense/pfsense/blob/master/src/etc/inc/system.inc#L2546Steve
-
He..He
This is what my Qotom reports/root: /bin/kenv -q smbios.system.product To be filled by O.E.M. /root:
/root: /root: sysctl -n hw.model Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz /root: sysctl -n hw.ncpu 4 /root:
/root: /bin/kenv -q smbios.planar.product Q3XXG4-P /root:
I might make some fun out of
if (isset($planar_product[0]) && $planar_product[0] == 'Q3XXG4-P') { if (strpos($hw_model, "i5-5250U") !== false) { return array('name' => 'Q355G4', 'descr' => 'Qotom Q355G4'); } else { return array('name' => 'Q3XXG4', 'descr' => 'Qotom Q3XXG4'); } }
Does one have to reroot/reboot to get the above executed ?
-
No the change should be immediate. That code gets run everytime the dashboard is generated, among other things.
-
@stephenw10 said in Specifying System ID on non-Netgate Hardware?:
It would be in this function:
https://github.com/pfsense/pfsense/blob/master/src/etc/inc/system.inc#L2546Steve
Interesting! From that page:
$_gb = exec('/bin/kenv -q smbios.system.product 2>/dev/null', $product); $_gb = exec('/bin/kenv -q smbios.system.maker 2>/dev/null', $maker); $_gb = exec('/bin/kenv -q smbios.bios.version 2>/dev/null', $bios);
On my my Protectli FW4C, from Diagnostics > Command Prompt:
/bin/kenv -q smbios.system.product
returns "FW4C"
/bin/kenv -q smbios.system.maker
returns "Protectli"
and
/bin/kenv -q smbios.system.version
returns "Ver 1.0"
So it's definitely possible to determine what box this is.
I don't read code very well, but I don't see how that function falls through to "pfsense" if it doesn't match any known string pattern.
-
That's what the last line is:
https://github.com/pfsense/pfsense/blob/master/src/etc/inc/system.inc#L2719 -
Well it worked out fine
-
@thewaterbug said in Specifying System ID on non-Netgate Hardware?:
I don't read code very well, but I don't see how that function falls through to "pfsense" if it doesn't match any known string pattern.
I would try this
After the break; , above the case 'apu1':
Insert the below code
case 'FW4C': if ($maker[0] == "Protectli") { return (array('name' => 'FW4C', 'descr' => 'Protectli FW4C')); } break;
The file to edit is /etc/inc/system.inc
Make a backup first: I called it system.inc.org
/etc/inc: ls -l system.* -rw-r--r-- 1 root wheel 84020 Dec 19 15:21 system.inc -rw-r--r-- 1 root wheel 83743 Dec 19 15:19 system.inc.org /etc/inc:
If you don't know the vi editor, you might not want to do this ....
Can nano be installed on a pfSense ?
Well - It seems like there is a "Gui Editor" under diagnostic
You might be able to do it via that one .... I have not tried it ...
*** Warning ***
My guess is if you FSCK system.inc up .... The system would NOT be happy !Make sure you have made a Config backup, before playing around.
That way you can always restore from "scratch""Happy hacking"
/Bingo
-
Just so you're aware (in case you didn't realise ) it's extremely unlikely this will ever be included upstream. So you would have to add this back after each upgrade. You might want to make it as a patch to make that easier.
Steve
-
@stephenw10
If this was for meit's extremely unlikely this will ever be included upstream
I didn't even consider it a possibility, to get it "upstreamed".
Frankly i couldn't care less, if my system reported the "default"
VS - The "patched" version.
I know what models (HW) that hide behind my firewalls , don't even need to look at the gui.
I took it as a fun exercise, to learn a bit about the pfSense "inners" , and learn that php looks somewhat like "C"
But it was fun to do (thnx)
/Bingo
-
@bingo600 said in Specifying System ID on non-Netgate Hardware?:
case 'FW4C':
if ($maker[0] == "Protectli") {
return (array('name' => 'FW4C', 'descr' => 'Protectli FW4C'));
}
breakSuccess!!
Thanks!
-
@thewaterbug
Glad you could use it ... I had "fun" too.Remember the "patch/mod" will disappear when you (pfSense) upgrade the system.
-
@stephenw10 said in Specifying System ID on non-Netgate Hardware?:
That's what the last line is:
https://github.com/pfsense/pfsense/blob/master/src/etc/inc/system.inc#L2719Interesting. It might be more useful if the fall-through case returned:
smbios.system.maker . " " . smbios.system.product
or something similar that didn't rely on parsing and matching product-specific strings.
-
@bingo600 said in Specifying System ID on non-Netgate Hardware?:
I know what models (HW) that hide behind my firewalls , don't even need to look at the gui.
/BingoIn most cases I do, too, because I theme each installation differently.
But in this particular case I've been swapping in an APU, an SG-1100, an MBT-2220, and a FW4C amongst 2 different locations, and sometimes 3 different units in 1 location all within 20 minutes, as I'm doing some IPSec throughput comparisons among different hardware. Since I'm uploading the same (or derived from the same) config.xml to different hardware, they look the same, and it would be nice to have explicit confirmation of what model I'm looking at.
Yes, the CPU info, etc., does tell me that, but having "FW4C" is a much shorter way of identifying this particular box.
-
@thewaterbug said in Specifying System ID on non-Netgate Hardware?:
@stephenw10 said in Specifying System ID on non-Netgate Hardware?:
That's what the last line is:
https://github.com/pfsense/pfsense/blob/master/src/etc/inc/system.inc#L2719Interesting. It might be more useful if the fall-through case returned:
smbios.system.maker . " " . smbios.system.product
or something similar that didn't rely on parsing and matching product-specific strings.
I like it the way it is right now
As can be seen here
https://forum.netgate.com/post/1075848My "Box name" would contain : To be filled by O.E.M.
Since i got
/root: /bin/kenv -q smbios.system.product
To be filled by O.E.M.That would really "hurt" my eyes ...
-
Yeah, it returns 'pfSense' there intentionally. Anything else would be uncontrolled if it's not hardware we know about.