Development environment?

Started by Patrick M. Hausen, March 27, 2021, 11:39:55 AM

Previous topic - Next topic
You can create an appropriate /conf/config.xml prior to bootstrap just to be safe. The factory reset will kick in if on next boot no /conf/config.xml is present, otherwise it will happily take the existing one.


Cheers,
Franco

Working, thanks. I still have not found out what I can trim from the XML file for brevity, so I only removed the UI SSL cert and kept the rest in.

When I deploy only the interface config, that's obviously too little, because I cannot login to the UI afterwards and the system boots directly into a root shell instead of a login: prompt.

Hints for a different approach always welcome.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Usually we use /usr/local/etc/config.xml as a template and run some sed commands to adjust it, e.g. https://github.com/opnsense/tools/blob/master/config/21.1/extras.conf#L29-L40


Cheers,
Franco

No there's a lever ...

I simply swap `mismatch0` and `mismatch1` in that file before I reboot into the live system.

Thanks again!
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Sure, that works too. :)


Cheers,
Franco

Doesn't  ;)

It's hardcoded on `/usr/local/etc/inc/console.inc`. Now I patch that and the interfaces come up correct.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

No, it shouldn't replace interfaces that exist if you scrub both mismatch0 and mismatch1... at least that would point to a bug if it really does, but I'm not so sure.


Cheers,
Franco

I'm referring to the initial setup and interface assignment on first boot.

https://github.com/opnsense/core/blob/master/src/etc/inc/console.inc
$ifnames = array_keys($iflist);
[...]
$wanif = count($ifnames) > 1 ? $ifnames[1] : '';
[...]
$lanif = count($ifnames) > 0 ? $ifnames[0] : '';


So LAN always ends up being em0 and WAN being em1. That's why I am pretty sure I need to patch that. Will be overwritten on the next update, but it's only needed for initial provisioning, so no big deal, IMHO.


Next question: can I create a user and a group on the command line on a running OPNsense system?
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

If you replace e.g. mismatch0 => em0 and mismatch1 => em1 doesn't that mean the interface count changes during reboot? The replace is sticky, but you are in trouble if em0 or em1 is missing.

You can also lock the primary interface and that would get rid of the reassign too.


Cheers,
Franco

> Next question: can I create a user and a group on the command line on a running OPNsense system?

Best to stick this into the config.xml as well...


Cheers,
Franco

Quote from: franco on March 30, 2021, 07:33:50 PM
If you replace e.g. mismatch0 => em0 and mismatch1 => em1 doesn't that mean the interface count changes during reboot? The replace is sticky, but you are in trouble if em0 or em1 is missing.

I just swapped mismatch0 and mismatch1 because I guessed that would somehow be replaced with em0 and em1, respectively. I can give it another try with em0 and em1 in there.

Thanks,
Patrick
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Hi Patrick,

Ah ok! Just to be clear: the final interface names need to be in there. If the VM uses different interface names or drivers that would obviously require the script to replace those and not em0/em1.


Cheers,
Franco

March 30, 2021, 08:24:46 PM #27 Last Edit: March 30, 2021, 09:49:11 PM by pmhausen
Interface configuration is ok now. Currently working on the Vagrant user, so people can use `vagrant ssh`.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)