Changing settings via script
-
I'm setting up a script that makes some changes to PFSense. Basically, I want to change the IPs of the interfaces so that they have a static configuration and I also want to change the password of the admin user.
Is there any way to do this via shell script?
Can someone help me?
-
You can do a lot of things using a php shell script.
You want to reset the same IPs every time? Across multiple installs?
Check the included php shell sessions in /etc/phpshellsessions for examples.
Steve
-
HI
The idea is that when the machine is started, it will run the shell script to configure the network and the admin password. It will be just one PFSense machine and it is for a lab that I am setting up.
The student will access the environment and when the lab is started, the PFSense should already be running with the fixed IP and the password already changed.
-
The idea is that when the machine is started, it will run the shell script to configure the network and the admin password. It will be just one PFSense machine and it is for a lab that I am setting up.
The student will access the environment and when the lab is started, the PFSense should already be running with the fixed IP and the password already changed.
-
Is it a VM? You could just restore it to a known state.
If it's a real device you could pull in a config at boot using the ECL:
https://docs.netgate.com/pfsense/en/latest/backup/restore-during-install.html#restore-using-the-external-configuration-locator-ecl -
It's a cloud lab that I don't have access to.
I just create the machine configuration scripts to be executed at startup, test them on my virtual machines and then send them to the person responsible for the cloud environment.
All machines are loaded via script (shell script or powershell).
-
php shell script probably easiest then.
https://docs.netgate.com/pfsense/en/latest/development/php-shell.html