OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • Development environment?
« previous next »
  • Print
Pages: 1 [2]

Author Topic: Development environment?  (Read 9433 times)

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17745
  • Karma: 1620
    • View Profile
Re: Development environment?
« Reply #15 on: March 30, 2021, 01:50:03 pm »
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
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Development environment?
« Reply #16 on: March 30, 2021, 03:55:26 pm »
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.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17745
  • Karma: 1620
    • View Profile
Re: Development environment?
« Reply #17 on: March 30, 2021, 04:29:59 pm »
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
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Development environment?
« Reply #18 on: March 30, 2021, 04:50:27 pm »
No there's a lever ...

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

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

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17745
  • Karma: 1620
    • View Profile
Re: Development environment?
« Reply #19 on: March 30, 2021, 04:50:58 pm »
Sure, that works too. :)


Cheers,
Franco
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Development environment?
« Reply #20 on: March 30, 2021, 06:51:35 pm »
Doesn't  ;)

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

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17745
  • Karma: 1620
    • View Profile
Re: Development environment?
« Reply #21 on: March 30, 2021, 07:10:00 pm »
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
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Development environment?
« Reply #22 on: March 30, 2021, 07:28:28 pm »
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
Code: [Select]
$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?
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17745
  • Karma: 1620
    • View Profile
Re: Development environment?
« Reply #23 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.

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


Cheers,
Franco
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17745
  • Karma: 1620
    • View Profile
Re: Development environment?
« Reply #24 on: March 30, 2021, 07:34:43 pm »
> 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
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Development environment?
« Reply #25 on: March 30, 2021, 07:43:36 pm »
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
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17745
  • Karma: 1620
    • View Profile
Re: Development environment?
« Reply #26 on: March 30, 2021, 07:51:19 pm »
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
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Development environment?
« Reply #27 on: March 30, 2021, 08:24:46 pm »
Interface configuration is ok now. Currently working on the Vagrant user, so people can use `vagrant ssh`.
« Last Edit: March 30, 2021, 09:49:11 pm by pmhausen »
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

  • Print
Pages: 1 [2]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • Development environment?
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2