Commit Graph
3974 Commits
Author SHA1 Message Date
Joachim WibergandTobias Waldekranz 6c8d5472d5 src/confd: finalize initial DHCPv4 with optional client-id support
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-26 15:10:26 +02:00
Joachim WibergandTobias Waldekranz f2cb63df72 src/confd: initial support for DHCPv4 yang model
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-26 15:10:26 +02:00
Joachim WibergandTobias Waldekranz 0e48a847b9 buildroot: bump libyang, sysrepo, and netopeer2 to latest versions
Changes to netopeer2-server required refactoring our foreground patch.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-26 15:10:26 +02:00
Joachim WibergandTobias Waldekranz b319a2df9d src/confd: refactor commit done hook into a pre and post hook
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-26 15:10:26 +02:00
Joachim WibergandTobias Waldekranz ebc87eb0a0 src/confd: refactor handling of callbacks for SR_DS_CANDIDATE
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-26 15:10:26 +02:00
Tobias WaldekranzandJoachim Wiberg 3424985b2b netconf: Allow IPv6 connections by default in factory-config
By default, netopeer2 will accept connections from
INADDR_ANY (0.0.0.0), which limits it to IPv4. Open it up to include
IPv6 as well.
2023-05-25 16:34:50 +02:00
Tobias WaldekranzandJoachim Wiberg cd52a42388 netconf: Inject NACM config for admin user in factory-config
On May 10, 2023, @troglobit wrote:
> Initial proposal for factory-config, based on example from RFC8341.

This gives the admin user the ability to configure the device over
NETCONF.
2023-05-25 16:34:50 +02:00
Tobias Waldekranz 3dbc59120f confd: srx: Duplicate entire tree in srx_get_diff
Use the _siblings variant to ensure that the full diff tree is
duplicated. Otherwise, the caller would only see the first branch of
changes.
2023-05-25 11:45:10 +02:00
Richard AlpeandJoachim Wiberg 6adb508f37 confd: add new factory user admin:admin
This patch adds a new user "admin" with the password "admin". The
password is hashed with sha512 ($6) as a hint to new users attempting
to change the password (avoid the weakest algorithms).

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-05-25 08:24:31 +02:00
Richard AlpeandJoachim Wiberg f56ca0d0ca confd: fix json merging when generating factory config
jq -s 'add' didn't merge data, i.e.:

hostname.json:
"ietf-system:system": {
  "hostname": { }
}

auth.json:
"ietf-system:system": {
  "authentication": { }
}

Didn't become:
"ietf-system:system": {
  "authentication": { }
  "hostname": { }
}

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-05-25 08:24:31 +02:00
Joachim Wiberg d4333e1a8d src/confd: fix ietf-interfaces copy-paste bug in netdat_init()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-23 11:20:09 +02:00
Joachim WibergandTobias Waldekranz 96fb836635 Add disclaimer about Frr and podman in Hybrid Mode section
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-23 08:52:16 +02:00
Joachim WibergandTobias Waldekranz 4c15897c6a Fix #29: drop FRR from default builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-23 08:52:16 +02:00
Joachim WibergandTobias Waldekranz 9844f0e148 configs: enable CA certificates package for all defconfigs
Provided a little time, all an embedded system really needs is trust.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-23 08:52:16 +02:00
Joachim WibergandTobias Waldekranz 0a99f1a5f6 board/common: drop factory/reset user
Initial analysis of system default users gives that there is no real
need for a default 'factory' user to trigger a factory reset.  On an
actual physical device we will have a reset button or a menu option in
the bootloader to trigger factory reset, and in both physical and
virtual (GNS3) devices a logged in admin user can call the factory
command.

A virtual device that cannot be logged in to will have to be removed and
have its persistent backing store deleted, but that is the only real
downside to removing this user.  The idea is to set a kernel command
line flag from the bootloader, and that could also be done from, e.g.,
GNS3.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-23 08:51:37 +02:00
Joachim WibergandTobias Waldekranz 08ad4e9bc6 Fix #24: disable bridge firewalling by default in Infix
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-23 08:48:47 +02:00
Joachim WibergandTobias Waldekranz d8b24e16de doc: new document, Containers in Infix (with podman & CNI)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 8addf469bf package/podman: add tool to create CNI profiles
Currently only supports creating host-device profiles, e.g. from veth
pairs or physical interfaces.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 679d64d496 Update Hybrid Mode with podman example to start Docker containers
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 56677fb1d6 package/podman: helper script to create supervised Finit service
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz b3761d84dc board: update kernel defconfigs for running containers (podman)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 852f1ed4c4 board/common: bind mount /var and /var/lib
The /var, and particularly /var/lib, directories are used for persistent
storage for various system daemons.  While adding support for containers
it became clear we had to change how we make these directories writable.
Both LXC and Podman use OverlayFS for the writable layer, and you cannot
set up an overlay on top of another overlay.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz bd696cba9a qemu: add support for optional /var disk (256M)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 468b49e916 buildroot: bump to v2023.02.1 w/ kkit patches
- package/libyang: Bump version to 2.1.55
 - package/netopeer2: Bump version to 2.1.59
 - package/sysrepo: Bump version to 2.2.60
 - package/cni-plugins: partial backport to enable missing plugins

The libite v2.5.3 backport has been dropped from the kkit patches
since it's been merged in upstream Buildroot LTS branch.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 65d170985c package/podman: new package
Podman (POD manager) is an open source tool for developing, managing,
and running containers on your Linux systems.

Based on work by Christian Stewart and Nathaniel Husted.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 1624c88708 package/conmon: new package
Conmon is an OCI container runtime monitor.  It sits between container
runtimes, e.g., crun and runc, and userland managers, e.g., podman.

Based on work by Christian Stewart and Nathaniel Husted.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Richard AlpeandJoachim Wiberg 08a3f51e8f test: add functional example of how to test CLI auth
This test is based on the 9pm framework, which supports execution
of test-cases written in any language. This test is written in
tcl/expect with help from the 9pm expect library. It's what I used to
test during development of the Infix basic authentication support.

The aim of this patch is to serve as an example of how the
interactiveness of the 9pm-expect library can be used.

9pm framework code is here:
https://github.com/rical/9pm

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-05-16 13:34:28 +02:00
Joachim Wiberg 8aed30552f package/finit: bump for Finit v4.4 (GA)
Full release notes: https://github.com/troglobit/finit/releases/tag/4.4

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-15 19:17:23 +02:00
Joachim Wiberg 8ab2f5f9da src/confd: system users, like admin, have no shell by default
Rudimentary support for setting login shell for new users.  Currently
hard-coded from what's selected in the Buildroot config, if Bash is
available or not.

Follow-up to f5866ee

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-15 18:45:37 +02:00
Joachim Wiberg 50963a7883 src/confd: fix regression in ietf-system:motd and ietf-system:clock
The writesf() API was hard coded to always open files in "r+" mode,
which fails if the file doesn't exist.

Add a mode option to writesf() and writedf().

Also, drop the default motd, we don't have one in NETCONF mode.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-15 16:05:08 +02:00
Joachim Wiberg 23dc3fcb4f qemu: change console to hvc0, ensure TTY is saved and restored
This change drops -nographic in favor of the more flexible virtconsole,
fixing the problem with loss of terminal history and reset.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-15 16:05:08 +02:00
Joachim Wiberg 480d870587 src/confd: harmonize ietf-system, rename infix-system.yang augment
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-15 16:05:08 +02:00
Joachim Wiberg f5866ee3d4 Add support for admin/admin to manage Infix as group 'wheel'
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-15 12:53:32 +02:00
Tobias WaldekranzandJoachim Wiberg 304e65e298 confd: ietf-interfaces: Handle attribute deletions properly
When deleting a value, the old value is in nd.val, so use the absence
of a new value to catch deletions.
2023-05-15 12:17:10 +02:00
Tobias WaldekranzandJoachim Wiberg 9d5a1d893c confd: lyx: Return the modified-from-default value from the diff
I.e. return the answer to the question "has this attributes changed
from the last config generation?" Which is always what we want to know
anyway.
2023-05-15 12:17:10 +02:00
Tobias WaldekranzandJoachim Wiberg 7491c280ac confd: Reload finit after the exit phase, if services are disabled
Bringing down the current generation is a step of its own, so it makes
sense to let finit clear out all old services before setting up the
new ones.

For example, with avahi-autoipd, without this step, we would run the
following sequence when disabling it on an interface:

initctl disable zeroconf@iface
ip link set dev iface down
ip link set dev iface up
initctl reload

But we really want to stop the zeroconf service before the down/up
cycle on the interface, since that is likely to disrupt the
daemon. With this additional step, the sequence becomes:

initctl disable zeroconf@iface
initctl reload
ip link set dev iface down
ip link set dev iface up
initctl reload

Which means that finit won't try to restart zeroconf if it dies during
the down/up cycle, since the service is already gone at that point.
2023-05-15 12:17:10 +02:00
Tobias WaldekranzandJoachim Wiberg 5b261cff2d dagger: Add pre and post hooks for actions
The special directories @pre and @post will always have their scripts
ran before and after, respectively, the rest of the DAG.
2023-05-15 12:17:10 +02:00
Joachim Wiberg b2191d0c20 package/finit: bump for 4.4-rc2 + kill process group fix
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-14 09:37:49 +02:00
Joachim WibergandTobias Waldekranz 3b3cadd72d src/confd: simplify after review comments from wkz
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-12 15:58:20 +02:00
Joachim WibergandTobias Waldekranz c98a99df58 src/confd: use global hook also for core_startup_save()
Saving running to startup follows the same pattern as config update of
candidate to running, so we must employ the same hook mechanism here.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-12 15:58:20 +02:00
Joachim WibergandTobias Waldekranz 688e196347 src/confd: consistent whitespace
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-12 15:58:20 +02:00
Joachim WibergandTobias Waldekranz 36f38d6198 src/confd: global event hook support
Refactor register_change() wrapper, for sr_module_change_subscribe(),
with an additional twist of setting up a commit DONE event catcher.

This creates a global event hook that ensures we call 'initctl reload'
after all module callbacks have completed, regardless of the xpath and
without having to have "shadow" subscriptions to all new modules being
added to confd.

Based on on ideas from https://github.com/sysrepo/sysrepo/issues/2188

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-12 15:58:20 +02:00
Tobias WaldekranzandJoachim Wiberg 580bcf5115 confd: Support controlling IP forwarding on interfaces 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg a1183780d1 sysctl: Disable forwarding by default on netconf builds
This matches the defaults in ietf-ip.
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 0d09c4e16a confd: Use regular errnos internally when generation iface config
This:
1. Makes the code more familiar and easy to read
2. Let's us output more precise error messages
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg a07910f51f confd: Simplify code with the lyx diff helpers 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg fa311c699b sysctl: Keep static IPv6 addresses on downed interfaces 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 32f6f22b47 common: Use IPv4/6 default configuration on all interfaces
The comment in the script has the story.
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg c2042bb036 confd: ietf-interfaces: Add IPv4/6 autoconf support 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 82d11112a6 avahi-autoipd: Default to always assigning a LL address
Without --force-bind, the address is removed if another routable
address is added to the interface.

While this is likely something that should be configurable in the
future, we choose this mode as the default so that IPs used for
NETCONF connections are not dropped because other addresses are added.
2023-05-12 14:24:41 +02:00