Commit Graph
394 Commits
Author SHA1 Message Date
Joachim WibergandTobias Waldekranz cb9d981dfc board/common: replace sshd subsystem cli with klish
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim Wiberg b7058b2d6c board/common: enable ipv4 and ipv6 global forwarding flag by default
The per-interface and per-af setting in the ietf-ip yang module allow
the user to enable a more granular forwarding between interfaces, which
is disabled by default.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 23cf9df856 Follow-up to 7e089ee: convert to kernel modules, use /etc/modprobe.d
Instead of having to rely on the kernel command line, we convert all the
kernel functionality in question into modules and rely on the auto-load
feature in the kernel and modprobe to add options at load time.

The fb_tunnels setting is a net core setting, for that we use sysctl.

This commit also syncs the kernel config between our two main archs,
disabling DRM and SOUND for the Amd64 build as a spin-off.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 4e3f3a01b3 board/common: change cli alias to start klish
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 06:31:47 +02:00
Joachim Wiberg 546a2f3afb package/mech: relocate clixon system setup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-28 20:27:18 +02:00
Joachim Wiberg aec2514eae mech: add support for ietf-syste:system/dns-resolver
This commit adds multi-nameserver support using openresolv (resolvconf)
and dnsmasq.  This means that a DHCP client (dhcpcd) or VPN client can
be providers of nameservers to the system.  Dnsmasq takes over as the
system resolver, except when the user has set up static configuration.

Static nameserver(s), as well as search and options, are always added
first by openresolv to /etc/resolv.conf.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-27 14:05:03 +02:00
Joachim Wiberg 6df91143ba board/common: no need to clean up rc.local or /etc/network/*
In managed NETCONF mode /etc is always based on the image's read-only
/etc with a read-writable overlay as a RAM disk.  We control the image
and know the default rc.local is empty and the interfaces file only
list the loopback interface.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 17:38:38 +01:00
Joachim Wiberg 0da4578362 board/common: allow lldpd to run by default in NETCONF mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 15:55:13 +01:00
Joachim Wiberg 24d2f28fb6 board/common: allow default auth:none restconf via nginx to clixon
- Only disable default services we don't need, prevents touching
   services mid-air in runlevel S.  Allow nginx now as well
 - Enable fcgi based RESTCONF interface via nginx by default
 - Enable auth:none for customer demo

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 15:55:13 +01:00
Joachim Wiberg f0e659c185 chrony: does not support SIGHUP, requires /var/lib/chrony
Chrony drops privs after startup to user chrony, when restarting it
writes its state in /var/lib/chrony, so the directory needs to have
the correct permissions for that user.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 07:26:40 +01:00
Joachim Wiberg 79f4baf519 board/common: enable syslog LOG_DEBUG messages to /var/log/debug
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 06:37:56 +01:00
Joachim Wiberg 3c4ff8cabb board/common: add 'show -n' for no footer output
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg 6fec738628 board/common: make sure to enable clixon_backend in NETCONF mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Tobias Waldekranz e7112ca0c9 qemu: Support mounting host filesystem inside guest
This is mounted at /mnt/host in the guest. By default the images
directory is mounted.
2023-03-13 13:53:12 +01:00
Joachim Wiberg 25db613398 Refactor boot mode handling
With the recent `if:<cond>` addition to Finit we can simplify a lot of
the logic for disabling and enabling features in Infix.  Standardizing
on conditions that Finit provides.

We create boot/netconf, boot/etc, and boot/profinet conditions early,
after all filesystems have been mounted (and cleaned), so they are all
set before Finit loads its configuration files in runlevel S.

The default is still to boot into a managed NETCONF mode, since the end
goal remains to integrate PROFINET as yet another service.  The other
mode, native /etc, should then be the only exception.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-08 20:02:03 +01:00
Joachim Wiberg 81212e12f1 package/profeth: persistent data in /var/lib, syslog.conf
Split tmpfiles config in two, one for snmpd and one for profeth.
Add logging and redirect profeth logs to /log/profinet.log with
default log rotation.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-08 20:02:03 +01:00
Joachim Wiberg e94b4de865 rootfs: add handy /log shortcut to /var/log
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-08 18:39:23 +01:00
Joachim Wiberg 7cf945af5b board/common: add PROFINET boot mode, compliments native /etc
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg 90a1fd99ec board/common: ensure cache directory for nginx is created at boot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg 80b23566b5 board/common: use same method to determine operating mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Tobias WaldekranzandJoachim Wiberg d8c529a2a7 common: Make U-Boot's auxiliary environment accessable from Infix
This is not the full environment used by U-Boot, just the bits needed
for U-Boot to know which slot to boot and for Infix to know how the
boot process went.

U-Boot will selectively import/export only these keys during boot,
which avoids a malicious user from altering the boot in a way that
might bypass signature validation.
2023-02-28 11:01:04 +01:00
Joachim Wiberg c3d7405b8f Add support for using /usr/bin/pdmenu (setup) as a login shell
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 22:28:42 +01:00
Joachim Wiberg 378633fa5c setup: make this the default /etc/pdmenurc in Infix
Set COLORTERM instead of using -c flag.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 22:28:42 +01:00
Joachim Wiberg 6cf4a986f5 setup: add support for performing factory reset
Now that we have dialog on target we can add a user-friendly factory
reset dialog.  The new `yorn` script handles any form of yes-or-no
question, with or without dialog, to call a command.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 22:28:42 +01:00
Joachim Wiberg 9af4155a83 board/common: always clear the tty after the setup command
Exiting pdmenu leaves artifacts on screen.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 22:28:42 +01:00
Joachim Wiberg 0bd3acd361 setup: add support for easily switching system boot mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 22:28:42 +01:00
Joachim Wiberg 12b5731655 board/common: add support for overriding managed mode
This change adds support for setting the system boot mode to native /etc
style for systems where it's difficult, or close to impossible, to set
the Finit boot condition to 'etc'.

Note: this also moves the check for factory reset before we check if we
should use_etc, rather than NETCONF.  This to allow clearing out any of
the state files (.use_etc) before proceeding to boot in the default mode

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 20:05:31 +01:00
Joachim Wiberg 605bd7262b src/factory: use new /mnt/cfg/infix/.reset path
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 20:02:34 +01:00
Joachim Wiberg c0c2ca622b board/common: add nginx.conf with /restconf fcgi reverse proxy
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-15 19:11:49 +01:00
Tobias Waldekranz e56348a916 mech: Make startup_db persistent, prepare for factory configs
Keep the transient files in the system's /mnt/tmp, and only persist
startup_db in /cfg.

This design (with a symlink) means that /cfg/startup_db _must_ exist
in order for clixon to start properly. Therefore run
/lib/infix/prep-db to take care of this.

At the moment, this just creates an empty factory config, and copies
it to startup if it doesn't exist. In the future, prep-db could select
a factory config based on some hardware identifier, or even build one
dynamically, based on available ports etc.
2023-02-10 15:51:47 +01:00
Tobias Waldekranz 5a27b30c7c mech: Startup clixon at boot 2023-02-09 10:26:10 +01:00
Tobias Waldekranz 61213c7c3c sshd: Move hostkeys to /var/lib/ssh
This means keys are persistent even when /etc is not.
2023-02-09 10:26:10 +01:00
Tobias Waldekranz 66688b4e5a board/common: mnt: Fix boot/etc detection
Previously, the absense of any finit boot conditions would be
interpreted as unmanaged mode, but managed should be the default.
2023-02-09 10:26:10 +01:00
Tobias Waldekranz d7c83cb9a7 board/common: Make it easier to access the CLI
- Create a shell alias, 'cli'
- Add an sshd subsystem, 'cli'
2023-02-09 10:26:10 +01:00
Tobias Waldekranz 3036b08945 board/common: Split out iface renaming from swup
The factory config part of swup will now only run when in unmanaged
mode.
2023-02-09 09:43:15 +01:00
Tobias Waldekranz 437961a644 board/common: Keep static /etc/iproute2/group
This way we don't have to patch it at every boot.
2023-02-09 09:43:15 +01:00
Tobias Waldekranz fa4a83e38d board/common: Keep our own dhcpcd.conf
This avoids the issue where the config file keeps growing as more
"background" lines are appended to it with each build.
2023-02-09 09:43:15 +01:00
Joachim Wiberg 83b3a1b1cc board/common: follow-up to 91b40a1, fix bridge access ports
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 14:53:03 +01:00
Joachim Wiberg 6de17bb06a board/common: follow-up to 4ca58836b, let less be less
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 14:53:03 +01:00
Joachim Wiberg e5032e1835 board/common: minor shellcheck fixes to mnt script
- Double quoting to prevent word splitting
 - local keyword is undefined in POSIX sh
 - `-m 0755` only applies to deepest directory (ignore)
 - Useless cat
 - Redirect to null, lilke the other mount_rw statements

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 14:52:19 +01:00
Tobias Waldekranz 252feef1c4 mech: Initial add
The mechanic, Infix's integration layer to Clixon
2023-02-08 14:05:47 +01:00
Tobias Waldekranz ca1467736f common: Refactor persistent storage setup
In the new model, we have three sources of storage:

- /mnt/var: Mountpoint for a disk with the label "var"
- /mnt/cfg: Mountpoint for a disk with the label "cfg"
- /mnt/tmp: Mountpoint for a ramdisk

These sources are used for the following overlays:

- **/cfg, /home, /root**: /mnt/cfg if available, else /mnt/tmp

- **/etc**: /mnt/cfg if available and the boot/etc finit condition is
            set, else /mnt/tmp

- **/var**: /mnt/var if available, else /mnt/tmp

- **/var/lib**: /mnt/var if available, else /mnt/cfg if available,
                else /mnt/tmp

See board/common/rootfs/lib/infix/mnt for more information.
2023-02-07 15:42:35 +01:00
Joachim Wiberg ad22478866 board/common: allow full color output in setup tool
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:46:05 +01:00
Joachim Wiberg 326f2024d7 board/common: use plain view of log files in setup tool
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:46:02 +01:00
Joachim Wiberg 31d036c8c7 board/common: very basic 'setup' tool, also works as login shell
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00
Joachim Wiberg 8525f26137 board/common: fix show formatting in '-p' (plain output) mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00
Joachim Wiberg 0d9a218d95 board/common: add '-p' (plain output) to help command
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00
Joachim Wiberg 8b263f2766 board/common: add template /etc/mactab, syntax reminder only
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00
Joachim Wiberg 92ce79bc7a board/common: add simple 'hostnm' script to change system hostname
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00
Joachim Wiberg b313096745 board/common: add '-p' option to help script for plain/noansi output
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00