In 0edc2d5 and afbe5ca, just prior to v24.06.0-rc1, support for deleting
containers in the background was added. However, this also broke support
for upgrading containers.
In afbe5ca the start script for containers was renamed from NAME.sh to
S01-NAME.sh, but the container wrapper script's upgrade command was not
updated. Neither was the cleanup and post-hook callbacks in confd! So
when a container had been added to the system, the cleanup callback just
simply deleted the script, preventing it from being recreated at ugprade
This patch fixes the container identification code and also refactors
the execd code to ensure that kill scripts (for deleting in background)
and start scripts are run in the proper order *and* ensuring that execd
also does not accidentally remove the container start script.
Some cosmetic changes to the output at upgrade have also been added.
Fixes#623
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
With a basic bridge setup, which has multicast snooping disabled by
default, `show interfaces` cause the following bogus log messages:
Sep 13 07:08:35 yanger: Command '['mctl', 'show', 'igmp', 'json']' returned non-zero exit status 1
Sep 13 07:08:35 yanger: Command '['mctl', 'show', 'igmp', 'json']' returned non-zero exit status 1
Sep 13 07:08:35 yanger: Command '['mctl', '-p', 'show', 'igmp', 'json']' returned non-zero exit status 1
Add a quiet flag to the run methods and set quiet=True for all mctl
commands to silence these log messages.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Before we add proper operational support for DNS and NTP, we can at
least improve on the built-in CLI commands.
Issue #510
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Only administrators are allowed to work with containers, allow them to
perform tab completion of all admin-exec commands as well.
Fixes#613
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
When multicast snooping is disabled on a bridge, mctl will exit with a
non-zero return code. Default to {} for these cases so that the bridge
and its ports are properly returned by yanger.
Fixes#618
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
To prevent the kernel from setting a random mac address on new bridges,
before we have added any bridge ports, we create bridges using the:
1. Custom mac address from the configuration (phys-address)
2. System base mac from /run/system.json
3. None, if there is no base mac address in system.json, e.g. r2s
Fixes#357
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Prior to this commit, querier multicast changes such as query-interval
where not applied to an existing multicast interface. The new initctl
touch makes finit send a sighup to mcd which causes it to re-load its
configuration files.
Signed-off-by: Richard Alpe <richard@bit42.se>
With the recent changes in Infix v24.08 to tighten up permissions, a
regression in the 'show ospf' family of commands was introduced.
This patch adds a 'doas' prefix to all vtysh commands. The 'doas' tool
wraps sudo in a way such than unauthorized users do not get a sudo error
thrown as result.
A better fix might be to either include all admin group users also in
the UNIX group 'frrvty', or even better, change the default group of
vtysh to 'wheel'. Affected files are /etc/frr/vtysh.conf and all
/run/frr/*.vty sockets, the latter are created at runtime by zebra,
ospfd, etc. This require modifying the buildroot/package/frr/frr.mk
file, which unfortunately have the group hard coded.
admin@R2:~$ ls -l /etc/frr/vtysh.conf
-rw-r----- 1 frr frrvty 32 Sep 3 05:27 /etc/frr/vtysh.conf
admin@R2:~$ ls -l /run/frr/*.vty
srwxrwx--- 1 frr frrvty 0 Sep 5 04:37 /run/frr/ospfd.vty
srwxrwx--- 1 frr frrvty 0 Sep 5 04:37 /run/frr/zebra.vty
Fixes#601
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The srx_get_str() function may return NULL, which goes unchecked in
both fxlate() and sxlate(), as well as the calls to free().
Found by Coverity Scan
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This intoduce a new sysrepo plugin to handle a new YANG
model 'infix-test'. Today only contains the actions.
This is required to run tests on infix using infamy.
This is a part of #561
Signed-off-by: Mattias Walström <lazzer@gmail.com>
The LOG_SECURITY facility was set wrong (1 << 13) instead of (13 << 3), see
https://github.com/kernelkit/sysklogd/blob/0fc6656/src/syslog.h#L120 for
details. This caused all audit log messages to be logged in LOG_USER.
Also, rename LOG_SECURITY -> LOG_AUDIT and log macro SECURITY() -> AUDIT()
to match RFC5424 terminology.
Similar fix to sysrepo, LOG_AUDIT facility instead of daemon + WARNING.
Additionally, drop the leading [severity] prefix to sysrepo logs. Only
needed when logging to stdout.
Follow-up to issue #521
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
LOG_DAEMON is a facility not an option. Replace with NDELAY option and
set facility properly in call to openlog() instead.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The backported patches to sysklogd now support the RFC facilities
natively, so we can focus on local facilities (and 'all').
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Add a must expression to limit invalid configurations.
Not belonging to VLAN when added to a multicast-filter in
that VLAN. Make sure multicast snooping is enabled when
using multicast filters.
This fixes#587
Signed-off-by: Mattias Walström <lazzer@gmail.com>
The srx_get_changes() API, introduced in 18b5922, does not provide the
user with a delete yang:operation when the entire YANG tree is deleted.
Refactor syslog actions to use the srx_get_diff() API instead.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Ensure Frr logs to the local2 syslog facility to allow sorting all
Frr (staticd, ospfd) logs into a dedicated /var/log/routing log file.
We activate OSPF debugging, but keep log level at 'informational' for
the time being. The YANG model needs some sort of "knob" to toggle
debug messages when troubleshooting OSPF.
Fixes#541
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
As of KernelKit Klish @ 710a631 the script plugin has been refactored to
run all commands as the logged in user instead of as root. The default
admin user is member of the wheel group, which allows access to sysrepo
and sudo access to containers thanks to NOPASSWD rights.
The doas script is a dummy wrapper to silence 'sudo -n' output for users
without any privileges.
As of this commit, unprivileged users can no longer copy, show, or in
any other way manipulate the system configuraiton.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This is a refactor to ensure sysrepo functionality guarded by NACM works
as intended in Infix.
Relocate infix_rpc() to klish-plugin-sysrepo, ensuring unauthenticated
users are denied access.
Drop infix_commit() in favor of slightly modified srp_commit(), this to
ensure sysrepo audit trail logs are visible at all times.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
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>
- For consistency and clarity, rename format -> log-format
- Add must expression to ban 'bsd' format from file logging
Note: technically, sysklogd silently reverts back to rfc3164 for file
logging, but it's better to be clear with the user with what is
possible to configure and is going to be used.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
As a bare minimum, all augments and deviations made to standard models
should have a description denoting *why* they exist.
In the case of ietf-syslog the base model is still a draft and carries
some odd defaults we want to disable, or replace with better ones. The
augments are global log rotation and and log format.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This refactor changes the callback subscription for log-file and remote
log actions to ensure they are called for *all* changes. Even changes
to deeply nested sub-trees like file-rotation when no other changes are
made. The previous attempt failed to address that.
The refactored callbacks replace sr_get_changes() with srx_get_changes()
for better control over what they iterate over. The callbacks always
regenerate the syslogd *.conf file snippets for each log action, so
there is no need for the overly granular sr_get_changes(), ever.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Reduces the overhead/repetition for module callbacks by combining the
forces of srx_get_diff() and lydx_get_descendant() into one API. The
resulting function supports both XPath and simplified paths to get the
subtree of changes applicable to the callback.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This augments ietf-syslog.yang with global file rotation settings which
are used when per-file rotation is not configured. The defaults chosen
match previously decided defaults for Infix: 1M:10, i.e., rotate every
file at 1 MiB and keep up to 10 gzipped aged-out archives.
The standard model includes a default value of 1 for the number of files
kept, which is removed (deviated). There is also a unit specified for
max-file-size, 'megabytes', replaced with 'kilobytes' in this change.
On smaller embedded systems, smaller sizes may be required.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
These changes are designed to make the experience working with log files
easier. Both listing available log files and viewing them.
- replace C dir@infix with a shell script for easier extensions,
e.g., we want to show both available .cfg and log files
- add support for gunzipping .gz log files before viewing them
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>