Add supoprt for infix-firewall.yang, modeled on the zone-based firewalld
The terminology is a mix of firewalld, classic netfilter and inspired by
Ubiquity. E.g., zone 'policy' -> 'action', and the zone matrix overview.
- Port forwarding allows forwarding a range of ports
- Operational data comes from firewalld active rules
- Firewall logging goes to /var/log/firewall.log
- Show implicit/built-in rules and zones (HOST) in firewall matrix,
includes "locked" policy for the default-drop behavior
- The zone services field in admin-exec 'show firewall' shows ANY when
the zone default action is set to 'accept'
- Zone 'forwarding' and 'masquerade' settings live in Infix in the
policys instead, meaning users need to explicitly add a policy
to allow both intra-zone and inter-zone forwarding
- Support for emergency lockdown (kill switch)
- Pre-defined services (xml+enums) are filtered and included as a
separate YANG model, extensions added for netconf and restconf
- Includes initial support for firewalld rich rules
firewalld policy rules, including rich rules, have an obnoxious priority
field which is extremely hard to get right, so in Infix we use the far
superior YANG construct 'ordered-by user;'. This ensure all rules are
generated in that order by setting the priority field, on read-back from
firewalld (operational) the priority field is used to sort the output
of rules in the CLI.
Fixes#448
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- cli: add '-r' to log/pager/follow for "raw" control chars, including unicode
- sysklogd: backport unicode fix for em-dash character (—) in slogan
- sysklogd: drop old patches
- sysklogd: run in 8-bit safe mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The reason for this is:
1) We want to use the same fetch tool for all operational data, to
avoid having duplicated xpaths scattered across the repo.
2) We want to call this directly from the CLI, which means it need to
be escape safe. A unprivileged user shall be able to use it but not
escape into a shell or do other malicious stuff.
Signed-off-by: Richard Alpe <richard@bit42.se>
There's several reasons for this. The main reason is that it was
developed as an intermediate way of getting system information when
the operational datastore was almost empty. There's not a lot of data
available in the operational datastore and we shall rely on that data
primarily. This command isn't safe to run from a jailed CLI as i
doesn't validate input and run commands directly in the shell, making
it hard to protect against a CLI jail break.
In upcoming patches we will introduce a new show tool that relies
solely on operational data and which sanitize the user input.
Signed-off-by: Richard Alpe <richard@bit42.se>
The -S switch to less seemed at the time a good idea -- chop off too
long lines and allow horizontal scrolling -- however, the -F option, to
skip pager for content that fit the first screen is overridden by the -S
switch. This makes commands like "show containers", and similar that
normally have waaaaay too few lines for a pager to always page.
So let's drop -S to regain the original behavior. This will cause lines
to be wrapped, but with the new raw mode in the CLI this seems to work
without any weird screen artifacts.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This fixes a regression in v24.11.0, introduced in 46dd0c7, where line
drawing characters are not properly displayed in the CLI anymore.
admin@infix:/> show interfaces
INTERFACE PROTOCOL STATE DATA
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
br0 bridge
<E2><94><82> ethernet UP 02:00:00:00:00:00
<E2><94><82> ipv4 169.254.1.3/16 (random)
<E2><94><82> ipv6 fe80::ff:fe00:0/64 (link-layer)
<E2><94><9C> swp1 bridge FORWARDING
<E2><94><9C> swp2 bridge FORWARDING
<E2><94><9C> swp3 bridge FORWARDING
<E2><94><9C> swp4 bridge FORWARDING
<E2><94><9C> swp5 bridge FORWARDING
<E2><94><9C> swp6 bridge FORWARDING
<E2><94><9C> swp7 bridge FORWARDING
<E2><94><9C> swp8 bridge FORWARDING
<E2><94><9C> swp9 bridge FORWARDING
<E2><94><94> swp10 bridge FORWARDING
This is because the raw tty from klish disables IUTF8 and the fact that
it does not source any environment, e.g., /etc/profile. (We do not have
any locale settings in the enviornment either, but that's a discussion
for another day.)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit replaces the 'cfg' alias for 'sysrepocfg -f json' with a
small shell script. Currently only an 'edit' command, similar to the
CLI 'text-editor' command for modifying base64 encoded YANG nodes.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
These are basically the same flags as was passed to klish, but now we
use -R instead of -r to make sure only ANSI coloŕ escapes can affect
the behavior of less.
This change will make it posslbe to shop off too long lines and scroll
vertically on really long lines instead for them breaking output.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The intention is to provide a similar set of commands as klish
admin-exec. However, instead of trying to make the Linux tools
more accessible, we now make the Infix tooling more accessible.
E.g., instead of "show ip route" mapping to "ip route show", we
map it to:
sysrepocfg -f json -X -d operational -x "/ietf-routing:routing/ribs" | \
/usr/libexec/statd/cli-pretty "show-routing-table"
As a spin-off we alos get a much more readable infix.xml for klish:
- Relocate logic to shell script wrapper 'show'
- Introduce Cisco style "show ip route" and "show ipv6 route"
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Passing $@ to sudo requires quoting to prevent splitting arguments like
this:
admin@R2:~$ doas vtysh -c 'show ip ospf routes'
% Command incomplete: show
After this patch:
admin@R2:~$ doas vtysh -c 'show ip ospf route'
============ OSPF network routing table ============
N 192.168.50.0/24 [1] area: 0.0.0.0
directly attached to e7
============ OSPF router routing table =============
R 192.168.100.1 [1] area: 0.0.0.0, ASBR
via 192.168.50.1, e7
============ OSPF external routing table ===========
N E2 192.168.10.0/24 [1/20] tag: 0
via 192.168.50.1, e7
N E2 192.168.100.1/32 [1/20] tag: 0
via 192.168.50.1, e7
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>
These changes mirror the changes made to the CLI in an attempt to create
a better user experience for working with log files even from the shell.
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>
This reverts an earlier change where nano was made the default editor in
a misguided attemt by yours truly to accomodate beginner users.
With the recent improvements of the CLI and the fact that the NETCONF
support has matured greatly, the need for a user-friendly editor have
diminished drastically. Editing system files is now limited to devs
and the core team prefers Mg over nano and vi.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The nano editor has been shown, over and over again, to be more
user-friendly to complete UNIX/Linux beginners than even Mg.
Also, change the default pager/less to be less (again), it was
very confusing to have less be most and more just be more. We
recommend scripts to use pager and edit/editor to call system
safe defaults.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Various scripts and tools search for the ip command in different
places. Most distros install it to /bin/ip and symlink to /sbin
and /usr dito, but Buildroot only installs to /sbin/ip
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>