@guitarpicker:
The custom import was a one-time action, and does the same thing as if the users were entered via the GUI. After this import, all new users are being added via the GUI. I am not running any custom scripts
Sorry i wasn't clear. I meant: what about a custom script that save user somwhere, download it at boot and then readd it (maybe in import-like mode)?
Firewall would be reacheble even without users and then wil readd it again. But u should be able to:
1. prevent pfsense to save itself the users
2. store them (local persistent HD or remote)
3. import them at startup (maybe the simpler things to do)
@guitarpicker:
The deletion happens at every boot is just how pfSense (and upstream m0n0wall) work - not by any sort of customization that I have done. You can see for yourself in the source code for the local_sync_accounts function (https://github.com/pfsense/pfsense/blob/f1551428c4fe708232fc80239ec207640b058a28/src/etc/inc/auth.inc#L378) which gets called at boot up. The general flow as seen in the comments is:
Delete local users
Delete local groups
Sync (import) all local users
Sync all local groups
This simple and rather foolproof method of synchronizing the user accounts with the configuration file could be optimized for performance, but the code would be immensely more complex to do so. I think the lion's share of the delay is due to calling the local_user_set function (https://github.com/pfsense/pfsense/blob/f1551428c4fe708232fc80239ec207640b058a28/src/etc/inc/auth.inc#L450) for each user on each boot, which has a laundry list of things to do when setting up a new user.
It sounds like this isn't a high-demand feature. I would much rather have an option to use FreeRADIUS without storing the plain text passwords than to spend a lot of time optimizing the local account sync process. I don't think this is likely to happen either, since the whole reason they store the passwords is so that you can change the encryption type in FreeRADIUS without losing all the accounts.
Fortunately, pfSense has been rock solid and I haven't needed to reboot much. I schedule it to reboot at night when I need to, so that the delay doesn't affect our users.
Looking at code it call system binary file to read and write users correctly(and set them the password):
$user_op = "useradd -m -k /etc/skel -o";
$cmd = "/usr/sbin/pw {$user_op} -q -u {$user_uid} -n {$user_name}".
" -g {$user_group} -s {$user_shell} -d {$user_home}".
" -c ".escapeshellarg($comment)." -H 0 2>&1";
Write users differently implicate a function that write "X" users directly to user file being careful to not corrupt this file.. it seems risky :D