Commit graph

244 commits

Author SHA1 Message Date
Gerd v. Egidy 58169f4ed2 support configuring entries for the /etc/hosts file in the YAML config
Example config:

sysconfig:
    hosts:
        "192.168.1.1": "example.net.lan"
        "192.168.1.10": "foo.net.lan foo"
2022-12-11 21:16:30 +01:00
Gerd v. Egidy 354b550524 support configuring the content of the bash_history in the YAML config
Allows to preconfigure common commands so that they can be accessed by just pressing
the up arrow key or searched with ctrl+r.

Move the "setkmap" command (which was previously hardcoded into .bash_history) into
100-defaults.yaml, allowing it to be overridden.

Example config:

sysconfig:
    bash_history:
        100: "setkmap"
        200: "reverse_ssh support.example.com 1234"

The Mapping / dict key is used for lexicographic reverse-ordering of the entries. Reverse-ordering
means the lowest key will show up first when pressing the up arrow key.
2022-12-11 19:26:14 +01:00
Gerd v. Egidy ddcd287322 remove systemd-gpt-auto-generator to prevent it automounting partitions
Given some circumstances like matching IDs and partition setup, systemd-gpt-auto-generator
will auto-mount specially marked partitions. This would interfere with SystemRescue and also
go against the no-automount policy of SystemRescue.

So remove systemd-gpt-auto-generator during build.
2022-12-11 17:48:53 +01:00
Gerd v. Egidy f57e608a69 automatically start x11 if "dovnc" option is given (#310)
VNC does not make much sense if X11 isn't running.

Automatically starting X11 on dovnc was done before SystemRescue 9.00, but
this logic seems to have been lost in the option handling code refactoring.
2022-12-10 22:13:01 +01:00
Gerd v. Egidy 54bd03d4fd use new pacman-faketime wrapper in yay-prepare 2022-12-10 21:05:17 +01:00
Gerd v. Egidy f2134ca4ab add "pacman-faketime" wrapper to work around expiring package signing keys (#313)
Also disable gpg trust caching & regeneration to not "burn" the trust database by
running pacman without the faketime wrapper once.
2022-12-10 21:02:45 +01:00
Gerd v. Egidy 75591c9551 Merge branch 'lua-copytoram' into 'main'
don't parse yaml files twice when using copytoram

See merge request systemrescue/systemrescue-sources!243
2022-10-19 18:26:46 +00:00
Gerd v. Egidy 3e74018b67 disable advertising on the firefox new-tab / welcome page 2022-10-19 20:23:33 +02:00
Gerd v. Egidy 711a9f6ea5 don't parse yaml files twice when using copytoram
since recently /run/archiso/copytoram is bind-mounted to /run/archiso/bootmnt.
This means sysrescue-configuration.lua should just load yaml files from
/run/archiso/bootmnt and not both, otherwise they would be loaded twice.
2022-10-19 20:20:13 +02:00
Gerd v. Egidy 5a32924e55 Split initialization of SystemRescue into parts done before and in parallel to networking (#304)
Configuring the nofirewall option by the sysrescue-initialize script must be done before the ip6?tables service.
Configuring the firewall should be finished before beginning to initialize the network.

But the rest of sysrescue-initialize should still be done in parallel to networking
being set up for a fast boot sequence. Also some services in sysrescue-initialize require
networking being online, for example load_srm with a remote url.

The proper way to accommodate all these needs is to split sysrescue:
sysrescue-initialize-prenet: must be finished before the network-pre.target
sysrescue-initialize-whilenet: started after sysrescue-initialize-prenet, can run in parallel
                               to networking being set up.
2022-10-16 12:33:25 +02:00
Gerd v. Egidy 61576de220 fix error handling when setting sysctl via yaml config 2022-10-15 17:30:08 +02:00
Gerd v. Egidy 98a9623a91 yay-prepare: don't reinstall packages from the sysrescuerepo
They aren't available by default. Also it is quite unlikely that a package
from AUR would actually need includes or libraries from one of them.
2022-10-11 22:36:44 +02:00
Gerd v. Egidy eac0842969 Merge branch 'yay' into 'main'
add yay AUR-helper (#139)

See merge request systemrescue/systemrescue-sources!235
2022-10-11 19:32:24 +00:00
Gerd v. Egidy f4f582edb4 Implement new autorun configuration ( #287)
- Implement a new style configuring autorun scripts ("autorun.exec"), more suited to a YAML config file than the old style (#287)
- The old style autorun scripts are still fully supported, they are loaded into keys from "1000-autorun" to "1026-autorunF"
- change the default for ar_nowait to true
- add "shell" option for new autorun exec scripts: let bash interpret the command instead of directly forking it from python
- allow to wait for keypress with a countdown timer, all keys are accepted now (instead of just enter as in the past)
- fix is_elf_binary
- improve output and logging (#253)
- use curl instead of wget for downloading scripts from URLs
- bind-mount /run/archios/bootmnt in case of copytoram to create a stable path for the new-style scripts
- deprecate storing autorun scripts in the root of the boot disk (#252)
- don't check /var/autorun/cdrom for autorun scripts anymore, it was not documented and there are more than enough better alternatives
2022-10-11 19:29:13 +00:00
Gerd v. Egidy 06f9d9d397 Add sysctl option to the "sysconfig" scope of YAML config file
Allows to customize sysctl entries of the kernel from the yaml config.
2022-10-02 19:04:41 +02:00
Gerd v. Egidy 704d7a9e5c add yay AUR-helper (#139)
- call yay through a wrapper to take care of root/sudo handling
- add yay-prepare to reinstall everything that was stripped for size (like /usr/include)
- yay-prepare creates a yay user and sudo rights
- the wrapper is installed in /usr/bin/yay, we want it to clash with yay-packages that aren't adapted to SystemRescue
2022-10-02 15:34:00 +02:00
Gerd v. Egidy 1df64290fa use binutils ar and strings commands
The binutils package is installed in SystemRescue for some time, so actually use it.

The busybox ar is inferior to the binutils one, causing problems when building
some packages with yay.
2022-10-02 15:26:10 +02:00
Gerd v. Egidy dcc27afc06 add mkpasswd: hash a password for use in /etc/shadow or htpasswd
mkpasswd is finally available packaged on Arch, so add it to allow
manually replacing a password in /etc/shadow, for when chroots or
pam don't work as wanted. Also supports advanced hash algos like
yescrypt that can't be set via the pam stack yet.

Because the source for mkpasswd is part of the whois package, it
is currently packaged as part of whois. But it might get it's own
package in the future, so add a check for /usr/bin/mkpasswd during
build time.
2022-09-15 20:58:33 +02:00
Gerd v. Egidy c52dcbeeb0 mountall: show target mountpoint in output 2022-09-06 20:24:46 +02:00
Gerd v. Egidy d8de1c8199 mountall: use udevadm settle to wait for newly opened cryptodisks to appear in /dev/mapper 2022-09-06 20:19:53 +02:00
Gerd v. Egidy b0bd95a977 Add rclone option to the "sysconfig" scope of YAML config file
rclone needs a rclone.conf file before it can be used, it contains
the urls, login data and similar.

Use the sysconfig.rclone.config hierarchy instead of just sysconfig.rclone
to allow adding features later. These could be support for encrypted
rclone config files (these would then go into sysconfig.rclone.crypted_config)
or things like automounting.
2022-08-24 13:18:08 +02:00
Gerd v. Egidy 61cc03ea83 Merge branch 'lua-https-fix' into 'main'
don't do certificate verification for https downloads in the lua script

See merge request systemrescue/systemrescue-sources!227
2022-08-07 11:35:07 +00:00
Gerd v. Egidy e9549eba34 don't do certificate verification for https downloads in the lua script
it is usually run during initramfs: we don't have a CA database there, so
all https downloads would fail otherwise.

Not doing cert verification at this step is clearly documented, so no
unexpected security risk for the user.
2022-08-07 12:56:41 +02:00
Gerd v. Egidy 81db3b13db improve error message in case the lua script can't download a file
Now prints the actual error message from the http library instead of a
generic "Could not connect" message.
2022-08-07 12:53:16 +02:00
Francois Dupoux 1e8ad8d465 Merge branch 'size-reduction' into 'main'
Remove files to reduce image size

See merge request systemrescue/systemrescue-sources!221
2022-08-06 14:08:25 +00:00
Gerd v. Egidy 533a4cab7e add cow_label and cow_directory options to the global scope of the yaml config file
Allows to set to set the persistent backing store options via the yaml config too and
not only through boot commandline options.
2022-08-05 22:05:02 +02:00
Gerd v. Egidy c0cddfc630 add --readonly option to mountall 2022-08-01 22:40:48 +02:00
Gerd v. Egidy e3b7b2079e use already existing mountpoints in mountall when they are empty and nothing mounted 2022-08-01 22:12:52 +02:00
Gerd v. Egidy 66e5801538 remove qt 5 and 6 translations to reduce image size
Qt 5 and 6 package translation files for common widgets that programs
can opt to use. These translation files take up about 2 MB of the final
iso image.

When the translations are removed, qt is designed to show messages
in the default language, English.

SystemRescue currently contains 2 programs using qt5 and qt6. I
tested both with the default en_US.UTF-8 and custom de_DE.UTF-8 locales:

featherpad: contains it's own complete translation. It's UI uses the
configured locale and it works regardless if the qt-translations are
installed or not.

yubikey-personalization-gui: doesn't use the translations at all and
is always shown in English. Removing the qt translations doesn't change
anything.

So programs coming with SystemRescue by default aren't affected. Also
other qt programs the user could install won't be affected. Only if the
user also changes the default locale, parts of some programs might be
now shown in English, like many other parts of SystemRescue that don't
come with translations.
2022-07-31 13:02:45 +02:00
Gerd v. Egidy 7a5acd23ed remove KeepassXC documentation to reduce image size
The KeepassXC documentation takes up 5 MB of final iso image size.
This is quite excessive.

Removing the documentation doesn't impair program usage. The documentation
can easily be accessed online from the KeepassXC website, it is directly
linked in the help menu.
2022-07-31 12:57:04 +02:00
Gerd v. Egidy 359083a0cc configure firefox as default browser in xfce 2022-07-31 12:31:24 +02:00
Gerd v. Egidy 4109b1ea38 add "nomdlvm" boot commandline option to not activate md raid or lvm devices
Activating md raid or lvm means that the kernel changes the metadata like
timestamps and mount counts of the devices and writes them to disk.
Also reconstructing degraded md raid devices is automatically activated.
There are cases when writing to disks is absolutely not wanted. For example
when restoring data from broken disks or when doing forensics.

The nomdlvm boot commandline option prevents any activation and thus
not wanted writes. If the user wants to use md or lvm with the option
set, all md or lvm devices have to be manually found and activated.

nomdlvm is only implemented as boot commandline option and does not use
the YAML config file. The reason is that the udev rules are evaluated
before sysrescue-configuration.lua is run, so the YAML config is not
ready yet. Moving nomdlvm after sysrescue-configuration.lua would be
an invasive operation and modify the activation order of all md and lvm
devices for all cases, increasing the probability of regressions.
Also udev rules offer a direct access to boot commandline options, making
implementation straightforward and robust.
2022-07-27 22:27:11 +02:00
Gerd v. Egidy 9a0e4acd16 deliver SystemRescue with an already initialized pacman key database
Initializing the pacman key database during boot can take considerable time
and there is no locking during this time against concurrent file access.
This can lead to problems when installing packages soon after reboot.
This also speeds up the boot process.

Additional disk space requirement is about 1 MByte.

Fixes #290
2022-07-24 23:11:11 +02:00
Gerd v. Egidy 09fcf3a452 improve check if already mounted for btrfs filesystems in mountall 2022-07-24 19:56:47 +02:00
Gerd v. Egidy f38c7ba8ca detect and open LUKS encrypted devices in mountall 2022-07-24 19:46:56 +02:00
Gerd v. Egidy 2d8bb769c1 use /sys/class/block instead of /sys/block in mountall to get all partitions 2022-07-24 19:13:47 +02:00
Gerd v. Egidy c0a1af428a don't try to mount swap space in mountall 2022-07-24 19:07:04 +02:00
Gerd v. Egidy 3e41c00fc4 allow to configure bookmarks for Firefox in the "sysconfig" scope of the yaml config file 2022-06-08 22:35:55 +02:00
Gerd v. Egidy 40aeaea9be apply sysconfig.ca-trust to Firefox too
Firefox doesn't use the system CA database but has it's own. Use the
policies.json file to let Firefox trust the entries from the
sysconfig.ca-trust of the YAML config too.
2022-06-08 21:33:54 +02:00
Gerd v. Egidy 95f9d88922 add a default config file to prevent remmina from showing an annoying popup on start 2022-06-08 20:54:22 +02:00
Gerd v. Egidy 815ae32dde fix parsing command line option when there is no default yaml file at all 2022-06-06 12:36:16 +02:00
Gerd v. Egidy 49ea71d62b add yaml config option to add ssh authorized_keys (sysconfig.authorized_keys) 2022-06-04 23:05:22 +02:00
Gerd v. Egidy 919914d48b add yaml config option to set timezone (sysconfig.timezone) 2022-06-04 19:09:44 +02:00
Gerd v. Egidy 64eabbbbaa wait until we are online before doing a http/https load-srm
There is no dependency on NetworkManager being actually online when
sysrescue-initialize.py calls load-srm to honor the late_load_srm config
option. So without this patch this can fail when the network takes a
few seconds until the link is actually up.

Fixes #288
2022-06-04 17:10:43 +02:00
Gerd v. Egidy ca74778681 show output of sysrescue-initialize.py on the boot console
show it immediately, not when the buffer is full. This also yields proper
timestamps in the journal in case some part of it takes longer to complete.
2022-06-04 17:08:53 +02:00
Gerd v. Egidy 36dc530a50 Properly cast floats to booleans in sysrescue-autorun and sysrescue-initialize.py
When the lua script parses the YAML config, it converts a `1` to `1.0` because in
lua all numbers are floats. So it writes out `1.0`, which is then loaded by the
python scripts later. Make the type conversion for booleans aware of this.

This allows to write something like `ar_disable: 1` in the YAML and have it
acted upon as expected.
2022-05-22 21:14:01 +02:00
Gerd v. Egidy cecd6946ff sysrescue-autorun: improve type casting for booleans
The recently implemented type casting code doesn't work intuitively for
booleans: for example it treats a string "0" as False and doesn't show
an error message for it. So the user might be unaware of this.

So add a dedicated conversion function for booleans.

Also add checks for conversions from dicts and lists, forbid to cast them
to strings because that is most probably not what the user wants.
2022-05-22 15:49:10 +02:00
Gerd v. Egidy afb77e30c5 sysrescue-initialize.py: Ensure the values given in the config file have the correct types
With the new config file merging the user could accidently overwrite the
config values with wrong types, for example a boolean with a dict or list.
This could lead to the script aborting with an exception.

Use explicit type casting and default values to ensure correct operation
in this case. This is the same as recently implemented for autorun.

Implement a dedicated conversion function for booleans to for example
treat a string "0" as False, python by default would interpret it as True.
2022-05-22 15:43:10 +02:00
pfeilmann ca084e664f caste the config with the same type as the defaultval 2022-05-22 10:23:59 +00:00
Gerd v. Egidy ae8a15c2b2 Merge branch 'autoterminal' into 'main'
implement autoterminal: automatically started scripts that take over a virtual terminal for user interaction

See merge request systemrescue/systemrescue-sources!196
2022-05-21 20:21:03 +00:00