Commit graph

1810 commits

Author SHA1 Message Date
Christian Kellner
662fe0feb9 test/host: checks for invalid fd handling
Check that we properly handle `dispatch` returning invalid fds and
that all fds are properly closed.
2021-09-24 12:14:04 +01:00
Christian Kellner
28dcd0ee9a host: check reply_fds before sending them
If there are fds to send back to the client, do a check that none
of them are invalid, so that we do not raise an exception in send
later. This allows us to send a proper RemoteError instead of no
reply at all.
2021-09-24 12:14:04 +01:00
Christian Kellner
6a39067772 host: raise a protocol error for empty messages
When decoding a message, first check that it is not empty and
raise a `ProtocolError` otherwise. This prevent a more obscure
error like "NoneType has no get method".
2021-09-24 12:14:04 +01:00
Christian Kellner
879c56a3b5 sources: pass items via temporary file
Since source were converted to host services it now uses a unix
socket instead of stdin to pass the arguments, which includes
the list of items to download. The latter can become quite big,
in fact too big to fit into a single package (NB: SOCK_SEQPACKET
is used for the underlying transport).
Therefore write the actual items to a temporary file and pass
the fd of it along the message.
2021-09-24 08:27:19 +01:00
Christian Kellner
fe3bb30f4c test/host: add check for call with fds
Create a new test that checks method calls that pass file
descriptors in both directions.
2021-09-24 08:27:19 +01:00
Christian Kellner
3da1db0865 host: properly clean up passed fds
On the service server side, i.e. the actual host service binary,
when we receive a message that contains file descriptors, clean
then up eagerly, instead relying on the garbage collector.
More importantly, the fds that we get from as a reply, if any,
need to be closed since in the current model the ownership is
transferred to the caller of `dispatch`.
2021-09-24 08:27:19 +01:00
Christian Kellner
21ad9fa399 stages/qemu: fix 'compat' option
The option got renamed to `compat` (and moved into the `qemu`
object) when the stage was extracted from the `qemu` assembler;
but the code, taken from the assembler, still used the old
`qcow2_compat` name for the option. Fix this.
2021-09-23 11:00:47 +02:00
Martin Sehnoutka
7be475151d 37
Release osbuild 37

[skip ci]

Signed-off-by: Martin Sehnoutka <msehnout@redhat.com>
2021-09-22 15:03:21 +02:00
Christian Kellner
c902a7a754 sources: port to host services
Port sources to also use the host services infrastructure that is
used by inputs, devices and mounts. Sources are a bit different
from the other services that they don't run for the duration of
the stage but are run before anything is built. By using the same
infrastructure we re-use the process management and inter process
communcation. Additionally, this will forward all messages from
sources to the existing monitoring framework.
Adapt all existing sources and tests.
2021-09-22 00:00:20 +02:00
Alexander Larsson
072b75d78e org.osbuild.curl: Don't load secrets if not needed
This moves the check for already downloaded files earlier so
that if all files are already downloaded we don't need to
load the secrets.

This is faster, but also it allows a pre-seeded object store
to run the manifest on a system (like a VM) that isn't subscribed.
2021-09-22 00:00:20 +02:00
Christian Kellner
20c3290460 pipeline: split out downloading from building
Separate the downloading form the actual building, so that in the
future one could only download artifacts needed to build images.
2021-09-22 00:00:20 +02:00
Pierre-Yves Chibon
2d4bc41cfc Fix the assert as .sort() returns None
Since `.sort()` returns None, we were checking that None == None
which is not what we aimed to do.

Quick reproducer:
```
>>> assert [1,2,3].sort() == [2,3,4].sort()
>>> assert sorted([1,2,3]) == sorted([2,3,4])
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    assert sorted([1,2,3]) == sorted([2,3,4])
AssertionError
```

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2021-09-21 16:09:47 +02:00
Sanne Raymaekers
36a7475e26 schutzbot: Update terraform sha
Unbreaks fedora-33 updates-modular dnf error when installing the
gitlab-runner.
2021-09-21 16:00:08 +02:00
Simon Steinbeiss
d89c956008 packit: Propose PRs to all Fedoras 2021-09-20 10:51:46 +02:00
Christian Kellner
99dd623383 stages: pam_limits.conf → pam.limits.conf
Mostly my personal preference, but we do not have any stage
with an underscore in the name, so let not start now.
2021-09-14 15:31:12 +02:00
Tomas Hozza
46ff53d5f4 Add a new stage for configuring pam_limits module
Add a new stage `org.osbuild.pam_limits.conf`, which created
configuration files for `pam_limits` module in /etc/security/limits.d.

Add unit test for the new stage.

Fix #788

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-09 15:00:30 +02:00
Christian Kellner
7ec305a343 ostree.config: add bootloader config option
Ability to set the bootloader backend that OSTree should use. NB:
normally this should be set to `none` since in modern distros and
bootloaders the BLS is used and the BLS snippets are generated on
`none` but none of the of the specific bootloader tools are run,
like `grub2-mkconfig` for grub.

Update the fedora image manifest to use that config setting.
2021-09-09 12:29:54 +02:00
Tomas Hozza
187681f17d Add a new stage for setting kernel parameters via sysctl.d
Add a new stage `org.osbuild.sysctld` for setting kernel parameters at
boot by creating a configuration file in /usr/lib/sysctl.d. At least
one parameter must be specified for the stage.

Add unit test for the new stage.

Fix #790

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-09 11:16:11 +02:00
Diaa Sami
5d7316757b 36
Release osbuild 36

Signed-off-by: Diaa Sami <disami@redhat.com>
2021-09-08 19:01:52 +02:00
Tomas Hozza
cf8f851f9c Add a new stage org.osbuild.tmpfilesd for configuring tmpfiles.d
Add a new stage `org.osbuild.tmpfilesd` for creating tmpfiles.d
configuration files in /usr/lib/tmpfiles.d. Provided list of
configuration directives is written as separate lines into
the configuration file. At least one configuration directive
must be specified.

Fix #786

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-08 14:08:40 +02:00
Tomas Hozza
8d85036689 Add a new stage for configuring SELinux state on the system
Add a new `org.osbuild.selinux.config` stage to configure the
SELinux state on the system.

The stage configures the SELinux state on the system in /etc/selinux/config.
The policy enforcement state and active policy type can be configured.

Fix #785

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-08 11:22:55 +02:00
Tomas Hozza
ac02244369 Add a new org.osbuild.dnf.config stage for configuring DNF
Add a new `org.osbuild.dnf.config` stage for changing persistent DNF
configuration. Currently only DNF variables can be defined.

Fix #791

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-07 14:10:09 +02:00
Tomas Hozza
1cab686f7a Add new org.osbuild.tuned stage for setting active TuneD profile
Add a new stage for setting active TuneD profile. The stage checks the
value of chosen TuneD profile(s) with the list of available TuneD
profiles installed in the filesystem root. If any of the chosen profiles
does not exist, the stage raises an exception.

Add unit tests for the new stage.

Fix #792

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-07 10:43:54 +02:00
Sanne Raymaekers
5b5ec8e6b4 util/rhsm: Check if repositories is None before iterating
When `get_fallback_rhsm_secrets` was used, `Subscriptions.repositories`
was None, and `get_secrets` never returned the fallback secrets.

So check if `repositories` is None before
iterating over it, otherwise return the fallback secrets.
2021-09-03 20:52:17 +02:00
Achilleas Koutsou
f5a048e7b4 stages/kickstart: set passwords with --iscrypted
The password is assumed to be encrypted so the `--iscrypted` option is
required.
2021-09-03 15:13:00 +02:00
Tom Gundersen
b081cf7f64 35
Release osbuild 35

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-08-29 20:09:59 +02:00
Christian Kellner
3c565347a3 stages/kickstart: quote ssh-key
Surround the ssh key by quotes since it might contain spaces.
2021-08-29 20:09:30 +02:00
Tom Gundersen
b430bd8682 34
Release osbuild 34

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-08-29 18:28:55 +02:00
Christian Kellner
4a5508e086 stages/bootiso.mono: support for aarch64 tempates
Use the aarch64 templates if the efi architecture was set to AA64.
NB: since we only support efi booting for aarch64 this should be
good enough for aarch64 selection.
2021-08-29 16:33:13 +02:00
Christian Kellner
597f5f9ea7 stages/kickstart: add schema for remote option
The code of the `org.osbuild.kickstart` stage already supported
adding the `--remote` option for `ostreesetup` via the `remote`
option but it was not included in the schema.
2021-08-29 16:33:06 +02:00
Christian Kellner
82cc2aeb4e test/data: use cloud-init in ostree image
Although zezere is the official tool, cloud init is easier to use
for local testing so switch to that.
2021-08-28 16:34:37 +02:00
Christian Kellner
c788a74fb5 stages/ostree.deploy: add remote option
Add an optional `remote` to the deployment of the ostree so that
the it is tied to the specified remote. This is needed later for
updating the commit from that remote.
2021-08-28 16:34:37 +02:00
Christian Kellner
7ea9796d9b stages/ostree.pull: add remote parameter
Add an optional `remote` parameter that can be used to specify the
the remote to track for the pulled commits.
2021-08-28 16:34:37 +02:00
Simon Steinbeiss
4459a37a66 33
Release osbuild 33

Signed-off-by: Simon Steinbeiss <simon.steinbeiss@elfenbeinturm.at>
2021-08-25 22:24:46 +02:00
Christian Kellner
877f2ba3c3 stages/grub2: greenboot support
Greenboot is the idea of automatically rolling back bad updates,
i.e. updates that do not boot successfully. The implementation
is split between the boot loader and a user space component.
The latter sets two variables `boot_counter`, which indicates
the maximum number of boot attempts and `boot_success` which
tells the boot laoder if a previous boot was successful. The
bootloader on the other hand will decrement the counter variable
and reset the success indicator one.
An implementation of the user space component for rpm-ostree is
called `greenboot`.
2021-08-25 20:53:12 +02:00
Diaa Sami
7a676667d6 Don't save name or timestamp for compressed file 2021-08-24 20:47:00 +02:00
Diaa Sami
b93dedf353 stages: add org.osbuild.gzip to compress files
Add a new stage that will take a file from the input and compress
it via gzip.
2021-08-24 20:47:00 +02:00
Tom Gundersen
a40cf616f5 32
Release osbuild 32

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-08-24 14:48:14 +02:00
Christian Kellner
ca3941feb6 inputs/ostree.checkout: don't overwrite refs
The `refs` variable is used as parameter to indicate which commits
to checkout, but it also was used as result variable to store the
ids of the commits that actually got checked out; naturally, it
was initialized to the empty array. This of course meant nothing
was ever actually checked out. Doh.
2021-08-24 01:21:03 +02:00
Christian Kellner
da8f45ef48 stages/grub2: add new uefi.unified option
Fedora 34 and thus RHEL 9 have adopted the unified grub config
scheme[1], where the main config is always placed in the same
location across all platforms, i.e. `boot/grub2`, and a stub
config that redirects to the main config is placed into the ESP.
osbuild has always done that in the case of hybrid boot, but not
for pure EFI systems. The new `uefi.unified` config option can
be used to select that new unified scheme even for the case of
pure EFI systems (aarch64 or non-hybrid boot).

Add a simple test for the grub stage.

[1] https://fedoraproject.org/wiki/Changes/UnifyGrubConfig
2021-08-23 13:55:32 +02:00
Christian Kellner
f3f3904368 stages/lvm2.metadata: fix typo in regex
It is zero to nine, not zero and nine.

Reported-b: Achilleas Koutsou <achilleas@koutsou.net>
2021-08-21 09:10:42 +02:00
Christian Kellner
e8c2190363 runners: add Fedora 36 runner
New `org.osbuild.fedora36` which is re-using the f30 runner.
Needed since Fedora 36 was branched already.
2021-08-20 23:02:36 +02:00
Christian Kellner
2a53814058 packit: create downstream prs on release
Create the downstream, i.e. fedora dist-git, pr on releases.
2021-08-19 18:33:46 +02:00
Christian Kellner
572d963f0d 31
Release osbuild 31

Signed-off-by: Christian Kellner <christian@kellner.me>
2021-08-19 13:38:58 +02:00
Ondřej Budai
b24f9858c3 schutzbot: update images for RHEL 9
Previously:
We used images built from pre-mass-rebuild composes but installed packages
from post-mass-rebuild composes. This caused weird stuff like sshd crashing
when installing non-related packages via dnf.

Now:
Both the image and repositories are post-mass-rebuild ones. This should solve
these weird issues.
2021-08-19 01:42:40 +02:00
Martin Sehnoutka
8b0ea15817 stages: add org.osbuild.ostree.passwd
This stage takes /usr/lib/passwd and /usr/etc/passwd from an OSTree
checkout, merges them into one file, and store it as /etc/passwd in the
buildroot.

It does the same for /etc/group.

The reason for doing this is that there is an issue with unstable UIDs
and GIDs when creating OSTree commits from scratch. When there is a
package that creates a system user or a system group, it can change the
UID and GID of users and groups that are created later.

This is not a problem in traditional deployments because already created
users and groups never change their UIDs and GIDs, but with OSTree we
recreate the files from scratch and then replace the previous one so it
can actually change.

By copying the files to the build root before doing any other
operations, we can make sure that the UIDs and GIDs of already existing
users and groups won't change.

Co-author: Christian Kellner <christian@kellner.me>
2021-08-17 13:53:00 +02:00
Christian Kellner
3695e22369 inputs: add org.osbuild.ostree.checkout
New input type that takes a ostree repo and checks out any number
of commits inside that repo to a temporary directory. Each commit
will be checked out to a separate sub-directory. The name of the
dir is the commit id of the corresponding commit.
This input can thus be used to access files and directories of
commits in stages.
2021-08-17 13:53:00 +02:00
Christian Kellner
a93c874c47 devcontainer: include packit, boto3 & more tools
Include the packit tool to be able to do updates from the container.
Additionally, include python-boto3 so that `make test-src` now does
not complain about missing `boto3` imports.
Also include ipython3 for quick python code snippet testing and
lsof to debug processes that keep files open.

NB: for packit to work you have to have the right tokens in your
local packit configration file (see the upstream doc). Additionally,
`packit propose-downstream`, to create PRs for a new downstream
release, needs kerberos auth to work correctly.
2021-08-17 10:42:03 +02:00
Christian Kellner
dbfc04cbb0 test/data: use generic build for fedora-boot
Instead of using the version specific, pre-depsolved f34 build manifest,
use the new version agnostic build manifest (fedora-build.mpp). NB: this
is included directly as mpp so that its variables get defined by the
including manifest. This should make it even easier to update manifests
to new fedora releases.
2021-08-17 10:42:03 +02:00
Christian Kellner
bab3639731 test/data: add version agnostic build manifest
Include a build manifest that is itself not have tied to a specified
version and thus is meant to be included with the following vars
pre-defined as .mpp file:
  - arch          architecture (x86_64)
  - releasever    release version (f34)
  - snapshot      rpmrepo snapshot (20210326)
2021-08-17 10:42:03 +02:00