93 Commits
Author SHA1 Message Date
Mattias Walström 7030f85484 confd: schedule: start crond only when a schedule is active
crond shipped auto-enabled in finit (symlinked into enabled/), so it ran
on every boot.  With no cron jobs /var/spool/cron/crontabs does not exist
and 'crond -f' exits non-zero, which finit then crash-loops until it gives
up ("Service crond keeps crashing, not restarting").

Ship crond available-only and let confd manage it: the schedule plugin
already rebuilds the crontab on every change, so enable + touch crond when
at least one consumer is active and disable it otherwise.  No jobs, no
crond, no crash loop.

Signed-off-by: Mattias Walström <lazzer@gmail.com>
2026-06-26 13:33:44 +02:00
Ejub Sabic 67ea7a74c1 feat: infix-schedule based on ietf-schedule implementation
Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
2026-06-18 10:22:35 +02:00
Joachim Wiberg 4d398bbf57 test: skip webui test when not available in build
Add conditional YANG feature 'web-ui' to infix-services.yang, set when
the webui is built.  This feature is what the test now looks for to
determine if it should be skipped or not.

Also, clean up remnant of old test, which was entirely replaced by
Mattias' login/csrf test.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-06-17 10:30:43 +02:00
Joachim Wiberg adee27f923 Minor, consolidate naming and adjust avahi + mdns-alias conditions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:11 +01:00
Joachim Wiberg 9472e08262 confd: clean up, simplify use common log framework
- Use same log frameworks as reset of confd
 - Use existing primitives from libite + libsrx
 - Drop remaining pthreads
 - Coding style fixes

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:10 +01:00
Joachim Wiberg 9e7cdf492f confd: replace sysrepo threads with libev event loop
Use SR_SUBSCR_NO_THREAD for all subscriptions and integrate sysrepo
event pipes into a libev event loop.  This eliminates approximately 30
per-subscription threads, reducing overhead on embedded ARM hardware.

A temporary poll-based "event pump" thread handles callback dispatch
during bootstrap (where sr_replace_config blocks waiting for callbacks),
then exits.  After bootstrap, the single-threaded libev loop takes over
for steady-state event processing.

Note, the confd-test-mode plugin still requires use of threads so we do
not create deadlocks when calling sr_replace_config().

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:09 +01:00
Joachim Wiberg 97c26d36bf confd: migrate https cert from /cfg/ssl to ietf-keystore
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:07 +01:00
Joachim Wiberg 4ca53f8ec2 confd: consolidate gen-config to start earlier
Allow confd to start even earlier at boot and call 'gen-config' as a
background task, pending on it to complete before we load the sysrepo
factory datastore.

Also, add Finit style progress to console so users can see the phases
of the bootstrap process.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:04 +01:00
Joachim Wiberg 3deb021bce board/common: postpone start of dbus to after confd bootstrap
Infix technically does not need to start dbus and dnsmasq before confd
has loaded the system startup-config.  So we move it in time to save
some CPU cycles for confd & C:o.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:03 +01:00
Joachim Wiberg 77a7915e1f confd: replace sysrepo-plugind + bootstrap + load with single daemon
On single-core Cortex-A7, the YANG bootstrap and config loading is the
dominant boot bottleneck.  The current sequence spawns three serial
phases (bootstrap, sysrepo-plugind, load), each performing independent
sr_connect()/sr_disconnect() cycles, and every sysrepoctl/sysrepocfg
invocation is a fork+exec that rebuilds SHM from scratch.

Replace all three with a single confd binary that does one sr_connect()
and performs all datastore operations in-process:

 - Wipe stale /dev/shm/sr_* for a clean slate
 - sr_install_factory_config() from the generated JSON
 - Smart migration: compare config version via libjansson, only
   fork+exec the migrate script when versions actually differ
 - Load startup-config (or test-config) via lyd_parse_data() +
   sr_replace_config(), mirroring what sysrepocfg -I does internally
 - On failure: revert to factory-default, load failure-config, set
   login banners (Fail Secure mode)
 - On first boot: copy factory-default to running, export to file
 - dlopen plugins and enter event loop

The bootstrap shell script is split: config generation (gen-hostname,
gen-interfaces, etc.) stays in the new gen-config script, while all
sysrepo operations move into the C daemon.  The finit boot sequence
collapses from 5 stanzas to 2 (gen-config -> confd).

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-03-20 16:18:03 +01:00
Mattias Walström 3d86d5f6e2 yang: add feature flags for wifi and gps in infix-hardware 2026-03-05 08:21:33 +01:00
Mattias Walström 0c60649c62 confd: Let rousette install its own yang models in rootfs
Previously rousette did not install the yang models so we kept a copy
of them in confd. Now it is implemented in rousette, let them install
their models.
2025-12-16 14:28:24 +01:00
Joachim Wiberg 7f555fd2bd confd: relocate /dhcp-client to /interfaces/interface/ipv4/dhcp
Please note, this change drops not only the global enabled flag, but also the
per-interface enabled flag, converting it to a presence container.  The name
of the container is also shortened from dhcp-client -> dhcp.  A pattern that
expected to be reused also for the DHCPv6 client.

Fixes #1109

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-11-06 16:36:56 +01:00
Joachim Wiberg 0f6c7608ec package/confd: simplify, relocate netconf service
Follow the good example set by the restconf service.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-09-28 07:26:44 +02:00
Mattias Walström b53c1612f0 confd: Add basic Wi-Fi client support
Support implemented:
* WPA2/3 support
* scanning (in background, results in operational)
* Unencrypted networks

No certificate support, only PSK

*only* client so far, no AP
2025-06-19 15:23:28 +02:00
Mattias Walström 0a74ba341f confd: Refactor when yang models are installed
And add support for BR2_PER_PACKAGE_DIR
2025-05-12 08:39:54 +02:00
Richard Alpe ac89f94580 sysrepo: allow non-wheel users access to sysrepo data
Non-privileged users in the sys-cli group can now access sysrepo data.

The data is now solely protected by the NCAM rules and not Unix file
permissions. Any stray user that's not part of the (default) sys-cli
group still can't access syrepo, like users added from the shell.

Fixes #932

Signed-off-by: Richard Alpe <richard@bit42.se>
2025-04-28 15:41:09 +02:00
Mattias Walström 092964a10b confd: Install *all* YANG modules from confd
Sysrepo, netopeer etc are still responsible to install the modules in
target directory, this will make that we will discover quickly if something
is updated.

Also this enables rm -rf output/target/etc/sysrepo/data/* && make confd-rebuild
This will reinstall all modules again.
2025-04-11 08:21:51 +02:00
Joachim Wiberg 3886b284d3 confd: fix invalid priority argument to logger
There is no such loglevel 'critical', only 'crit' is defined.

For some reason this issue has not been spotted until the upgrade to
Buildroot 2025.02, which includes sysklogd v2.7.0, and Finit v4.11.

Introduced in 3e48af6, when the concept of failure-config was added.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-31 13:14:34 +02:00
Joachim Wiberg 3e07c9a960 Fix missing /etc/resolv.conf when starting with failure-config
Turns out the root cause for the odd log message in #896 was that the
system did not properly call `resolvconf -u` when starting in failure
mode.

This patch simplifies the code by moving all `resolvconf -u` calls to
the same Finit task.  Ensuring it is first launched when confd has
successfully consumed any configuration at boot, and then every time
a static DNS server is added.  (The udhcpc client script already call
`resolvconf -u` when dynamic DNS servers are learned.)

Fixes #896

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-02-28 16:10:27 +01:00
Joachim Wiberg 73e1c158f5 confd: minor, rearrange for readability
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-02-24 21:56:46 +01:00
Joachim WibergandTobias Waldekranz 6a417f2f23 package/confd: drop unnecessary conditional
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-02-12 23:21:08 +01:00
Joachim WibergandTobias Waldekranz 01d07b4942 utils: rename sysrepo-load-modules.sh -> srload
Simplify name, follow new srop tool naming convention.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-02-12 23:21:08 +01:00
Mattias Walström 0cb2987de4 Introduce infix-crypto-types
To only show supported types, simpler when autogenerate web/cli.
2025-02-08 13:40:35 +01:00
Joachim Wiberg f86f184783 confd: rename dhcp-client option name -> id
For consistency with the new dhcp-server model, which has an option
value 'name', options are now referred to as id's or identifiers.

This means bumping the confd syntax version 1.3 -> 1.4 and adding a
migration script for existing dhcp-client configuration files.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-01-31 13:55:35 +01:00
Mattias Walström 79bec6877c Bump confd to 1.3
This since there is breaking changes.
2024-12-19 14:42:17 +01:00
Joachim Wiberg 4e2458e18a board/common: introduce conditions for bootstrap services
Some services launched at bootstrap must be possible to override per
product.  One such service is iitod, which manages the LEDs in Infix.

This change makes allows a product specific init script to clear the
led condtion, preventing Finit from lauching iitod.  Also, rename the
ixinit-done condition to match the nomenclature used already.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-11-08 14:30:04 +01:00
Joachim Wiberg 98ff33113a confd: bump version for phys-address .cfg migration
See issue #680

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-10-11 16:41:21 +02:00
Mattias WalströmandJoachim Wiberg 0f9d429d9b confd: bump and add a migrate script for infix-routing 2024-09-21 08:47:02 +02:00
Tobias Waldekranz f77f5852c1 confd: Use system timeout value when loading startup/failure
Now that we have a unified timeout value that all front-ends should
honor, make sure to do so when loading startup-config and
failure-config during boot.

This fixes an issue where the system would fallback to failure-config
even though a legitimate startup-config was available, but took more
than 10s to apply.
2024-09-05 23:41:19 +02:00
Tobias Waldekranz eb3f8ce711 confd: Break out front-end timeout to common environment file
While sysrepo's architecture places the responsibility of choosing a
timeout on each front-end, we want to control it centrally since the
majority of the time is spend actually applying the config to the
system - which is front-end agnostic.

Therefore, create a single definition of the timeout, which can be
included by all front-ends.
2024-09-05 23:41:19 +02:00
Joachim Wiberg dac2182069 confd: initial audit trail support
This commit introduces a new SECURITY() log macro that logs to facility
'audit' (sometimes called 'security') with severity set to 'alert'.  It
is then used to instrument the single most important things to log; all
changes to users and their privileges.

We also add logging to sysrepo, which knows the username for changes to
running-config, copies to startup-config, and RPCs.

Fixes #521

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-08-26 20:54:49 +02:00
Ahmed KaricandMattias Walström 4a325af4e4 confd: generate test-config.cfg
Currently, it's not possible to run infix tests from an external
project (based on infix) due to an incompatibility between the
configuration used in the tests (the default configuration
within the image generated by the external project) and the infix
base configuration expected by the test cases. Therefore, a simple
configuration specifically for testing purposes needs to be generated
within an image. This test-config should always be generated
but only loaded when the device is in test mode.

Part of issue #568
2024-08-23 11:15:12 +02:00
Joachim Wiberg 5a3897b1aa package/confd: drop empty help text
This silences an annoying warning at defconfig/oldconfig about MD5CRYPT.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-28 12:54:27 +02:00
Joachim Wiberg dcdc2ba24d confd: follow-up to 7d9257f
First, actually remove setup.sh.  No reason to have the old version
lingering in the repo confusing devs.  Also simplify script heading
dropping previous netopeer2 text and distilling the comment before
sourcing the .inc file.

Silence the install/update, dropping -v -- no need to be overly verbose
now that we now the new yang loader works at build time.

Crucially -- fix a bug in UPDATE_MODULE(), missing closing '

Simplify naming and location of .inc files.  No need for the long
filenames, or the new directory, the directory name gives plenty of
context.

Add reminder of duplicate infix-interfaces.yang in .inc files -- this
duplication is unfortunate and we should try to fix this better.  We
will forget to update one or the other any day ...

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 3e7340cb52 confd: add support for $0$cleartext password
Finalize support for IETF System YANG incl. all IANA crypt-hash types.

This patch builds on the earlier work adding yescrypt and $factory$ key
word.  The YANG description for the crypt-hash type override has been
significantly udpated to discourage use of $0$cleartext passwords.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Joachim Wiberg 99117fc90f conf: add support for handling breaking model changes
Add metadata 'version' field to ietf-system to be able to detect .cfg
file version.  Fixes #308

Add early boot script to automatically migrate configuration files of
older version to new syntax.  Fixes #178

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-25 17:22:36 +02:00
Ahmed KaricandMattias Walström 2b1543ba11 confd: Minor Update on YANG Modules Setup Refactor
- Fix indentations:
    - Corrected indentations in confd.mk to adhere to Buildroot coding
     standards

  - Relocate YANG Modules List Files:
    - Moved the YANG modules list files (.inc) from package/confd to
     src/confd

  - Add Missing YANG Module:
    - Included infix-interfaces@2024-01-15.yang in
      yang_modules_confd.inc
    - This module was missing in the non-containerized build and is now
      correctly added
2024-06-19 15:41:33 +02:00
Ahmed KaricandMattias Walström 7d9257f5f6 confd: refactor yang modules setup script for better modularity and maintainability
- Moved setup.sh and yang_modules files from infix/src/confd/scripts/ to infix/utils/ to streamline the repository structure
- Updated confd.mk to correctly reference the new location of the setup script
- Introduced yang_modules_<type>.inc file to list all YANG modules for improved clarity and maintainability
- Modified the new setup script to dynamically source module lists from yang_modules_<type>.inc
2024-06-18 18:54:18 +02:00
Tobias Waldekranz a5d98e9351 board/common: Collect all system init in a dedicated runparts dir
This makes it easier to add more scripts without having to update the
finit config file, and it clarifies which of the scripts in
/libexec/infix only execute at boot.
2024-06-07 10:10:38 +02:00
Mattias Walström 4f3ae3b9a4 Add new package: Rousette - a RESTConf server 2024-06-04 13:38:03 +02:00
Joachim WibergandTobias Waldekranz 90b35affe2 Drop augeas from system completely
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-06-03 23:05:04 +02:00
Mattias WalströmandTobias Waldekranz b1a6606728 confd: Add sysrepo and netopeer as a dependency.
And remove not needed environment variable
2024-05-24 11:58:47 +02:00
Joachim WibergandTobias Waldekranz 453afeb2d7 confd: simplify sysrepo datastore makedev permissions 2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz a4b1d37763 confd: Update SHM path
Do not use netopeer-created shm-path
2024-05-24 11:58:47 +02:00
Mattias WalströmandTobias Waldekranz 3354effc53 Build in required modules on buildtime
This to hopefully speed up boot, do as little as possible
during boot.

* New modules needs to be added to src/confd/scripts/setup.sh
* Permission needs to be changed post-build for YANG files,
  see CONFD_PERMISSIONS in confd.mk
2024-05-24 11:58:47 +02:00
Joachim WibergandTobias Waldekranz adf37394f4 confd: follow-up to 2412fff3, simplify chown of startup-config
Instead of having a chown process started by Finit in runlevel S, we can
just chown in the confd load script instead.

Issue #415

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim WibergandTobias Waldekranz bc020436e7 confd: increased severity for log messages caught on stdout/stderr
Error messages from system() calls, like adduser, should be logged with
severity LOG_ERR to not arrive out of sequence with ERROR() messages.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-13 11:42:27 +02:00
Joachim Wiberg b557d69b8a package/confd: follow-up to 2412fff, chown only in runlevel S
Run chown only at bootstrap, after confd has started and we've loaded
startup-config.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-05-01 11:08:50 +02:00
Joachim WibergandTobias Waldekranz 2412fff39c confd: ensure correct ownership of startup-config after factory reset
Fixes #415

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2024-04-29 14:31:40 +02:00