Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9e9168d
package/klish-plugin-sysrepo: fix 'show leaf-node' in configure
troglobit Jun 13, 2024
2e5e9d6
klish-plugin-infix: ensure filesystem is synced after 'copy' command
troglobit Jun 13, 2024
b73f2b5
container: fix timeout handling in restart
troglobit Jun 13, 2024
8d57304
container: enable logging of output from start/stop action
troglobit Jun 13, 2024
b0464f9
container: clean up after unpacking oci archive
troglobit Jun 16, 2024
0549c64
confd: add support for $factory$ password hash
troglobit Jun 5, 2024
2103ed1
confd: allow web services in failure mode
troglobit Jun 16, 2024
b2e6b5d
confd: add supoprt for yescrypt
troglobit Jun 5, 2024
d6f33d2
confd: allow non-admin users to use the CLI, NACM rules apply
troglobit Jun 13, 2024
128e3b0
confd: add support for hostname format specifiers
troglobit Jun 14, 2024
9c4ce1a
confd: change failure mode hostname to capitals
troglobit Jun 18, 2024
c7607e9
confd: silence setup.sh and fix update bug
troglobit Jun 14, 2024
4fde74c
confd: operational support for ietf-system hostname and passwords
troglobit Jun 14, 2024
807a41a
confd: merge infix-shell-types.yang with infix-system.yang
troglobit Jun 15, 2024
058b3fb
conf: add support for handling breaking model changes
troglobit Jun 16, 2024
40668b0
test: minor, fix pep-8 warnings from pylint
troglobit Jun 16, 2024
40131db
test: new method get_password() in Env
troglobit Jun 18, 2024
0ba3aa9
test: verify admin user default password in running and operational
troglobit Jun 16, 2024
97dbfc6
test: verify hostname format %h-%m in running and operational
troglobit Jun 16, 2024
3cf6e3f
doc: update ChangeLog for upcoming v24.06 release
troglobit Jun 16, 2024
134381e
libsrx: new helper function srx_isset()
troglobit Jun 18, 2024
60cf85e
confd: minor, fix linter warning (value unused)
troglobit Jun 18, 2024
44b9384
confd: refactor netconf hostkey generation
troglobit Jun 18, 2024
a4ab0c7
package/finit: backport batch mode for runparts
troglobit Jun 19, 2024
40f738d
confd: add support for vendor/product specific factory-config
troglobit Jun 19, 2024
d3f376b
confd: add support for $0$cleartext password
troglobit Jun 19, 2024
0039cdb
confd: follow-up to 7d9257f
troglobit Jun 20, 2024
3c8cf61
.github: update coverity job to include libxrypt, drop augeas
troglobit Jun 22, 2024
6543572
confd: adjust libxcrypt dependency slightly
troglobit Jun 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: |
sudo apt-get -y update
sudo apt-get -y install pkg-config libjansson-dev libev-dev \
libaugeas-dev libglib2.0-dev libpcre2-dev \
libcrypt-dev libglib2.0-dev libpcre2-dev \
libuev-dev libite-dev

- name: Build dependencies
Expand Down
2 changes: 1 addition & 1 deletion board/common/rootfs/etc/finit.d/10-infix.conf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
task name:ixinit log:tag:ixinit [S] <pid/syslogd> /libexec/finit/runparts -p /libexec/infix/init.d -- Probing system
task name:ixinit log:tag:ixinit [S] <pid/syslogd> /libexec/finit/runparts -bp /libexec/infix/init.d -- Probing system
2 changes: 1 addition & 1 deletion board/common/rootfs/etc/finit.d/available/container@.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
service :%i pid:!/run/k8s-logger-%i.pid <usr/container:%i> \
[2345] k8s-logger -cni %i -f local1 /run/containers/%i.fifo -- Logger for container %i
sysv :%i pid:!/run/container:%i.pid <pid/k8s-logger:%i> kill:10 \
sysv :%i pid:!/run/container:%i.pid <pid/k8s-logger:%i> log kill:10 \
[2345] container -n %i -- container %i
22 changes: 22 additions & 0 deletions board/common/rootfs/libexec/infix/init.d/05-product
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
# Find and install any product specific files in /etc before bootstrap
ident=$(basename "$0")

PREFIXD=/usr/share/product
PRODUCT=$(jq -r '."product-name" | ascii_downcase' /run/system.json)

note()
{
logger -k -p user.notice -t "$ident" "$1"
}

DIR="$PREFIXD/$PRODUCT"
if [ -z "$PRODUCT" ] || [ ! -d "$DIR" ]; then
note "No vendor/product specific directory found, using built-in defaults."
exit 0
fi

note "Using vendor/product specific defaults."
for dir in "$DIR"/*; do
[ -d "$dir" ] && cp -a "$dir" /
done
102 changes: 102 additions & 0 deletions board/common/rootfs/libexec/infix/init.d/30-cfg-migrate
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/bin/sh
# Run .cfg migration jq scripts to backup and transform older .cfg files
ident=$(basename "$0")

MIGRATIONS_DIR="/usr/share/confd/migrate"
CONFIG_FILE="/cfg/startup-config.cfg"
BACKUP_DIR="/cfg/backup"

note()
{
logger -k -p user.notice -t "$ident" "$1"
}

err()
{
logger -k -p user.err -t "$ident" "$1"
}

file_version()
{
jq -r '
if .["infix-meta:meta"] | has("version") then
.["infix-meta:meta"]["version"]
else
"0.0"
end
' "$1"
}

atoi()
{
echo "$1" | awk -F. '{print $1 * 1000 + $2}'
}

if [ ! -f "$CONFIG_FILE" ]; then
# Nothing to migrate
note "No $(basename "$CONFIG_FILE" .cfg) yet, likely factory reset."
exit 0
fi

cfg_version=$(file_version "$CONFIG_FILE")
current_version=$(atoi "$cfg_version")

# Find the latest version by examining the highest numbered directory
sys_version=$(find "$MIGRATIONS_DIR" -mindepth 1 -maxdepth 1 -type d | sort -V | tail -n1 | xargs -n1 basename)
latest_version=$(atoi "$sys_version")

# Check for downgrade
if [ "$current_version" -gt "$latest_version" ]; then
err "Configuration file $CONFIG_FILE version ($cfg_version) is newer than the latest supported version ($sys_version). Exiting."
exit 1
fi

# If the current version is already the latest, exit the script
if [ "$current_version" -eq "$latest_version" ]; then
note "Configuration is already at the latest version ($sys_version). No migration needed."
exit 0
fi

note "Configuration file $CONFIG_FILE is of version $cfg_version, migrating ..."

# Create the backup directory if it doesn't exist
mkdir -p "$BACKUP_DIR"

# Create a backup of the current configuration file
nm=$(basename "$CONFIG_FILE" .cfg)
BACKUP_FILE="$BACKUP_DIR/${nm}-${cfg_version}.cfg"
if cp "$CONFIG_FILE" "$BACKUP_FILE"; then
note "Backup created: $BACKUP_FILE"
else
err "Failed creating backup: $BACKUP_FILE"
exit 1
fi

# Apply the scripts for each version directory in sequence
for version_dir in $(find "$MIGRATIONS_DIR" -mindepth 1 -maxdepth 1 -type d | sort -V); do
dir=$(basename "$version_dir")
version=$(atoi "$dir")

# Step by step upgrade file to latest version
if [ "$current_version" -lt "$version" ]; then
note "Applying migrations for version $dir ..."

# Apply all scripts in the version directory in order
for script in $(find "$version_dir" -type f -name '*.sh' | sort -V); do
note "Calling $script for $CONFIG_FILE ..."
sh "$script" "$CONFIG_FILE"
done

# File now at $version ...
current_version="$version"
fi
done

# Update the JSON file to the latest version
if jq --arg version "$sys_version" '.["infix-meta:meta"]["infix-meta:version"] = $version' "$CONFIG_FILE" \
> "${CONFIG_FILE}.tmp" && mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"; then
note "Configuration updated to version $sys_version."
else
err "Failed updating configuration to version $sys_version!"
exit 1
fi
14 changes: 14 additions & 0 deletions board/common/rootfs/libexec/infix/mkkeys
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
# Generate NETCONF SSH host key pair
set -e

BIT=2048
KEY=$1
PUB=$2

mkdir -p "$(dirname "$KEY")" "$(dirname "$PUB")"

openssl genpkey -quiet -algorithm RSA -pkeyopt rsa_keygen_bits:$BIT -outform PEM > "$KEY"
openssl rsa -RSAPublicKey_out < "$KEY" > "$PUB"

exit 0
7 changes: 6 additions & 1 deletion board/common/rootfs/usr/sbin/container
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ unpack_archive()

[ -n "$quiet" ] || log "Extracting OCI archive $file ..."
tar xf "$file" || (log "Error: failed unpacking $file in $(pwd)"; exit 1)
remove=true
fi

dir=$(dirname "$index")
Expand All @@ -72,6 +73,10 @@ unpack_archive()
name=$dir
fi

if [ "$remove" = "true" ]; then
rm -rf "$file"
fi

echo "$name"
}

Expand Down Expand Up @@ -575,7 +580,7 @@ case $cmd in
stop "$name"
timeout=20
while running "$name"; do
_=$((timeoute -= 1))
_=$((timeout -= 1))
if [ $timeout -le 0 ]; then
log "Timeout waiting for container $1 to stop before restarting it."
exit 1
Expand Down
Empty file.
2 changes: 2 additions & 0 deletions configs/aarch64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ BR2_PACKAGE_PYTHON_GUNICORN=y
BR2_PACKAGE_LIBSSH_OPENSSL=y
BR2_PACKAGE_LIBSSH2=y
BR2_PACKAGE_LIBSSH2_OPENSSL=y
BR2_PACKAGE_LIBXCRYPT=y
BR2_PACKAGE_LIBOPENSSL_BIN=y
BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_NETOPEER2_CLI=y
Expand Down Expand Up @@ -95,6 +96,7 @@ BR2_PACKAGE_SOCAT=y
BR2_PACKAGE_TCPDUMP=y
BR2_PACKAGE_TRACEROUTE=y
BR2_PACKAGE_ULOGD=y
BR2_PACKAGE_WHOIS=y
BR2_PACKAGE_BASH_COMPLETION=y
BR2_PACKAGE_SUDO=y
BR2_PACKAGE_TTYD=y
Expand Down
2 changes: 2 additions & 0 deletions configs/r2s_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ BR2_PACKAGE_PYTHON_GUNICORN=y
BR2_PACKAGE_LIBSSH_OPENSSL=y
BR2_PACKAGE_LIBSSH2=y
BR2_PACKAGE_LIBSSH2_OPENSSL=y
BR2_PACKAGE_LIBXCRYPT=y
BR2_PACKAGE_LIBOPENSSL_BIN=y
BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_NETOPEER2_CLI=y
Expand Down Expand Up @@ -105,6 +106,7 @@ BR2_PACKAGE_SOCAT=y
BR2_PACKAGE_TCPDUMP=y
BR2_PACKAGE_TRACEROUTE=y
BR2_PACKAGE_ULOGD=y
BR2_PACKAGE_WHOIS=y
BR2_PACKAGE_BASH_COMPLETION=y
BR2_PACKAGE_SUDO=y
BR2_PACKAGE_TTYD=y
Expand Down
2 changes: 2 additions & 0 deletions configs/x86_64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ BR2_PACKAGE_PYTHON_GUNICORN=y
BR2_PACKAGE_LIBSSH_OPENSSL=y
BR2_PACKAGE_LIBSSH2=y
BR2_PACKAGE_LIBSSH2_OPENSSL=y
BR2_PACKAGE_LIBXCRYPT=y
BR2_PACKAGE_LIBOPENSSL_BIN=y
BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_NETOPEER2_CLI=y
Expand Down Expand Up @@ -90,6 +91,7 @@ BR2_PACKAGE_SOCAT=y
BR2_PACKAGE_TCPDUMP=y
BR2_PACKAGE_TRACEROUTE=y
BR2_PACKAGE_ULOGD=y
BR2_PACKAGE_WHOIS=y
BR2_PACKAGE_BASH_COMPLETION=y
BR2_PACKAGE_SUDO=y
BR2_PACKAGE_TTYD=y
Expand Down
33 changes: 30 additions & 3 deletions doc/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ All notable changes to the project are documented in this file.

[v24.06.0][UNRELEASED]
----------------------
> **Note:** After upgrade a factory reset is needed

> **Note:** this release contains **breaking changes** in YANG models
> that are incompatible with existing configuration files. So, after
> upgrade, but before reboot, a factory reset is required!

### Changes
- Upgrade Buildroot to 2024.02.3 (LTS)
- Upgrade Linux kernel to 6.6.34 (LTS)
- Default web landing page refactored into a Buildroot package to make
it possible to overload from customer repos.
- Enable DCB support in aarch64 kernel (for EtherType prio override)
Expand All @@ -35,10 +40,30 @@ All notable changes to the project are documented in this file.
on egress.
- `mv88e6xxx` ports can now use Linux's priority information to select
the appropriate egress queue, via the `mqprio` queuing discipline.
- Upgrade Buildroot to 2024.02.3 and Linux kernel to 6.6.34
- Add logging of output from container start/stop action
- Clean up stale directories after OCI container archive import
- Add support for `show leaf-node` in CLI configure context
- Allow non-admin users to use the CLI. NACM rules still apply
- Ensure filesystem is sync'ed properly after a CLI `copy` command
- Issue #178: add early boot script to migrate configuration files of
older version to new syntax. Initial, rudimentary support, for the
change in shell types
- Issue #308: add `version` field to ietf-system.yang to be able to
detect the configuration file version.
- Issue #435: add support for `$factory$` password hash. This allows
backing up configuration files with device specific passwords. Upon
restore to another device this ensures the replacement's password is
used instead of the originals'
- Issue #435: add support for hostname format specifiers. The default
hostname configuration is now `%h-%m` to encode, `infix-c0-ff-ee`
- Issue #447: add support for [yescrypt][], `$y$` hashes
- Issue #478: add operational support for ietf-system.yang, reading
actual hostname and passwords after issue #435
- Merge infix-shell-types.yang with infix-system.yang

[yescrypt]: https://en.wikipedia.org/wiki/Yescrypt)

### Fixes
- Add missing LICENSE hash for factory reset tool
- Fix #424: regression, root user can log in without password
- Fix build regressions in `cn9130_crb_boot_defconfig` caused by upgrade
to Buildroot v2024.02 and recent multi-key support in RAUC and U-Boot
Expand All @@ -56,6 +81,8 @@ All notable changes to the project are documented in this file.
privileges (added to UNIX `wheel` group)
- Fix #473: bridge interface with IPv6 SLAAC never get global prefix
- Fix locking issue with standard counter groups on `mv88e6xxx`
- Add missing LICENSE hash for factory reset tool
- Fix timeout handling in container restart command
- Fix MDB/ATU synchronization issue from IGMPv3/MLDv2 reports on
`mv88e6xxx` systems
- Fix #476: Custom command for containers not working
Expand Down
36 changes: 36 additions & 0 deletions package/confd/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,39 @@ config BR2_PACKAGE_CONFD
either the on-system CLI or using NETCONF.

https://github.com/kernelkit/infix

if BR2_PACKAGE_CONFD

choice
prompt "Default password crypt"
default BR2_PACKAGE_CONFD_YESCRYPT
help
When users set $0$cleartext-password as their password confd
salts and encrypts the "cleartext-password" with this selected
hash algorithm.

Infix defaults to yescrypt.

config BR2_PACKAGE_CONFD_MD5CRYPT
bool "md5crypt"
help

config BR2_PACKAGE_CONFD_SHA256CRYPT
bool "sha256crypt"

config BR2_PACKAGE_CONFD_SHA512CRYPT
bool "sha512crypt"

config BR2_PACKAGE_CONFD_YESCRYPT
bool "yescrypt"

endchoice

config BR2_PACKAGE_CONFD_DEFAULT_CRYPT
string
default "md5crypt" if BR2_PACKAGE_CONFD_MD5CRYPT
default "sha256crypt" if BR2_PACKAGE_CONFD_SHA256CRYPT
default "sha512crypt" if BR2_PACKAGE_CONFD_SHA512CRYPT
default "yescrypt" if BR2_PACKAGE_CONFD_YESCRYPT

endif
6 changes: 3 additions & 3 deletions package/confd/confd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CONFD_LICENSE_FILES = LICENSE
CONFD_REDISTRIBUTE = NO
CONFD_DEPENDENCIES = host-sysrepo sysrepo netopeer2 jansson libite sysrepo libsrx libglib2
CONFD_AUTORECONF = YES

CONFD_CONF_OPTS += --disable-silent-rules --with-crypt=$(BR2_PACKAGE_CONFD_DEFAULT_CRYPT)
CONFD_SYSREPO_SHM_PREFIX = sr_buildroot$(subst /,_,$(CONFIG_DIR))_confd

define CONFD_CONF_ENV
Expand Down Expand Up @@ -41,13 +41,13 @@ COMMON_SYSREPO_ENV = \

define CONFD_INSTALL_YANG_MODULES
$(COMMON_SYSREPO_ENV) \
$(BR2_EXTERNAL_INFIX_PATH)/utils/sysrepo-load-modules.sh $(@D)/yang-setup/yang-modules-confd.inc
$(BR2_EXTERNAL_INFIX_PATH)/utils/sysrepo-load-modules.sh $(@D)/yang/confd.inc
endef

ifeq ($(BR2_PACKAGE_PODMAN),y)
define CONFD_INSTALL_YANG_MODULES_CONTAINERS
$(COMMON_SYSREPO_ENV) \
$(BR2_EXTERNAL_INFIX_PATH)/utils/sysrepo-load-modules.sh $(@D)/yang-setup/yang-modules-containers.inc
$(BR2_EXTERNAL_INFIX_PATH)/utils/sysrepo-load-modules.sh $(@D)/yang/containers.inc
endef
endif

Expand Down
Loading