omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Enhance [omarchy] Repo Security: Switch SigLevel to `Required DatabaseOptional` and Update Security Docs

Open MrJack91 opened this issue 1 year ago • 13 comments

What do you need?

Disclaimer

This issue was drafted with assistance from Grok, an AI tool created by xAI, to help articulate the proposal and ensure technical accuracy. The ideas and intent are my own, with Grok aiding in structuring and refining the content.

Description

To strengthen Omarchy’s security (https://learn.omacom.io/2/the-omarchy-manual/93/security) and support the repo pipeline in #767, I propose tightening the [omarchy] repository’s signature verification in default/pacman/pacman.conf and documenting this in the security manual.

Current Setup

  • Global: SigLevel = Required DatabaseOptional (secure—requires signed packages for Arch’s [core]/[extra]/[multilib]).
  • [omarchy]: SigLevel = Optional TrustAll (allows unsigned or untrusted packages from https://pkgs.omarchy.org/$arch).
  • Security Docs: Cover encryption, firewalls, etc., but not package signing.

The current Optional TrustAll suits prototyping but risks supply-chain attacks, especially as Omarchy scales to production (#767). The security docs should reflect package verification.

Proposed Changes

  1. Update pacman.conf for [omarchy]:

    [omarchy]
    SigLevel = Required DatabaseOptional
    Server = https://pkgs.omarchy.org/$arch
    
    • Benefits: Mandates signed, trusted packages (like Arch repos); supports #767’s reviewed pipeline; blocks unsigned/tampered packages.
    • Why DatabaseOptional?: Matches Arch’s standard (package signatures mandatory, database signatures optional). Ensures compatibility if omarchy.db isn’t signed yet, while securing packages (the main risk). Full Required (database + packages) could break if the pipeline lacks database signing.
    • Rationale: Users trust Omarchy’s OS build (ISO, scripts), but Required adds protection against repo hacks, unlike TrustAll (ArchWiki: debug-only).
  2. Update Security Manual (https://learn.omacom.io/2/the-omarchy-manual/93/security): Add:

    1. Package Signature Verification: The [omarchy] repository requires GPG-signed packages from trusted keys, matching Arch’s official repos, to protect against supply-chain attacks.

Steps to Implement

  • Update SigLevel in default/pacman/pacman.conf.
  • Generate/sign a dev key (e.g., pacman-key --gen), include in bootstrap, sign packages in pipeline.
  • Test pacman -S from [omarchy] (e.g., uwsm-omarchy).
  • Add doc section.
  • Optional: Keep Optional TrustAll for local/dev via env var.

Happy to test or contribute a PR! Thoughts? Experience with repo signing?

Metadata

  • Omarchy Version: 3.1.1
  • Hardware: Mac Book Air (late 2015)
  • Labels: enhancement, security
  • Assignees: @RaphaelKimmig (from #767)
  • Related: #767

MrJack91 avatar Oct 22 '25 09:10 MrJack91

I hate to upvote this issue because the report itself is mostly AI generated and only partially on point, but there is a point under the mess here. Arch Linux (for which I am a packaging volunteer taking care of building hundreds of packages including Hyprland, which Omarchy relies on) as a distro goes to great lengths to make sure all packagers have decent build system hygiene and that everything is signed, traceable, and as often as possible reproducible. Omarchy benefits from this already, but it isn't passing on the same guarantees to its users.

The Omarchy overlay repository should absolutely have signed packages, and the Pacman config shoulud reflect this as a requirement.

  1. All people authorized to build packages need to have vetted GPG signing keys.
  2. These keys need to get added to a keyring package installed by default and trusted on Omarchy systems.
  3. All packages need to be signed by the people that built and published them.
  4. The Pacman config needs to expect all the packages in the repo to be signed by a trusted key.

Ideally the package database itself should also be signed, but that's a much harder problem to implement. I do it for my personal package repository because I'm the only valid signer, but shared key access is an anti-pattern and in this case wouldn't add to the overall distro security.

alerque avatar Oct 24 '25 06:10 alerque

I believe this issue deserves some attention from @dhh and @ryanrhughes because Omarchy repository is enabled by default in every installation and users rely on it for package updates and installations.

ipmanlk avatar Oct 24 '25 17:10 ipmanlk

While I agree in principal that we should, and will enable this and follow the practice, it's also a touch unnecessary or at least reduced in its real severity or impact in our situation.

In standard Arch package distribution, the distribution heavily relies on mirrors. If a mirror is compromised, or someone inserts a malicious mirror distributing a package, the signature from the source is a good way to tell that it wasn't original.

In our case, we don't rely on mirrors and own the distribution end-to-end from packaging to shipping, all protected via SSL. So if you download the package from https://pkgs.omarchy.org, it was built by our build-chain and uploaded to the one and only repo (then cached by Cloudflare via R2).

Pkgs.omarchy.org also only hosts AUR or custom packages as well. All core, extras, multilib, etc. are served via mirror.omarchy.org which contains the same sigs as every other mirror and follows that practice.

The real only point of penetration is to compromise the builds themselves and upload, at which point you could also override the signature verification as well so it's a bit of a non-event in that case.

ryanrhughes avatar Oct 24 '25 17:10 ryanrhughes

First of all Ryan it is a valid point that your hosting architecture makes this not quite as egregious as in when mirrors are involved. However it isn't quite as simple as saying it would be superfluous, as you imply here:

The real only point of penetration is to compromise the builds themselves and upload, at which point you could also override the signature verification as well so it's a bit of a non-event in that case.

[emphasis mine]

This is false, especially the bit I added italics to. What you are doing here is squashing multiple layers of security into one layer ... basically putting all your eggs in one basket then claiming you're going to hand on to the basket extra tight. In the original model not only were the eggs in different baskets, but breaking any one egg doesn't hurt anybody.

It's like the swiss cheese model for aviation security, you have to get holes lined up in a lot of layers for any mistakes or failures to cause a dangerous incident. In your model all the layers are gone and you just have one barrier between you and disaster.

If (as we are suggesting) all the clients are setup to automatically verify signatures and have a predefined list of signatures they trust, then a server compromise cannot just override the signature verification as you suggest. For that to happen they would first have to compromise the keyring package and get it published to people. To do that they would have to get it signed by an existing trusted key. See where the layers start coming into play here?

You say you trust your hosting infrastructure (and it's true it is more trustable than 3rd party mirrors), but if you were signing packages and clients were preconfigured to check for that, then even a compromised server (e.g. a remote attacker that gained access to post files on your server) would not be able to compromise packages because the trusted private keys used to sign packages would not be on the servers at all, they would be on developer's private machines only (ideally even using hardware based signing or offline keys so the keys couldn't be remotely retrieved) providing an extra layer of security.

alerque avatar Oct 24 '25 18:10 alerque

Attacker wouldn't have to go as far as spoofing existing packages - they would just need to publish a malicious package that gets pulled by clients with next update, if I understand how this works correctly.

This is completely incorrect, you are miss-understanding the protection being suggested here.

By setting the package manager to require the entire repository to produce packages signed by pre-trusted keys, you guard existing users against any malicious packages new or old.

Your risk profile might then be if people compromised your ISO/installer stuff out of the gate it would be possible to compromise new users with just the one layer being compromized, but for all existing users that have installed the distro prior to a server compromise they would not be able to install packages (new or updated) that were not verifiably signed by pre-vetted keys, keys that represented a different layer that the hosting architecture.

alerque avatar Oct 24 '25 18:10 alerque

@alerque Definitely see your points, and like I said in the beginning; agree that this is a good layer of insulation.

Realistically, there are 2 attack vectors, one of which doesn't really go way with package signing.

If the R2 instance for pkgs.omarchy.org were to be compromised, and a package pushed up, and added to the DB; that would be a problem. These are all protected by ssh keys and typical best practices. -- This is eliminated via signing and good to do so.

The second is the build server where the packages are built and shipped to pkgs.omarchy.org. Also protected by ssh keys and typical best practices, but if you gain access to that server; the signatures don't matter because that machine has to have the signing key for that process to work too. -- If we were building these locally, it'd be the equivalent of gaining access to my physical machine. If you've done that, it's game over and no amount of signatures will help.

The benefit signatures provide in the second scenario is that if we discovered something like that, we could invalidate a signature, ship that, and presumably protect against any further distribution. Again...good insulation to have in that respect.

ryanrhughes avatar Oct 24 '25 19:10 ryanrhughes

Realistically, there are 2 attack vectors, one of which doesn't really go way with package signing.

One does.

But it's even more serious than just closing one attack vector. In your current system you have 2 points of failure, and either of them being compromised is catastrophic to your end user's systems. What is being suggested here would take those two points of failure and require that both of them be compromised at the same time for there to be a catastrophic issue.

The second is the build server where the packages are built and shipped to pkgs.omarchy.org.

Okay time out here, I think it's worth pointing out something. The model used by Arch Linux involves offline package sigining. If you just have a build server that automatically signs packages you build and is co-located with or shares SSH keys with your package server, you might be able to change the setting to requiring signed packages but you haven't really accomplished an extra layer in the security model. You'd have the illusion of an extra layer of security without the actual security!

In Arch Linux we do have some shared build infrastructure (a big fat 96 core machine with 396 Gigs of RAM) that packagers can have things built on, although packages can also be built locally on our own machines as well (via isolated chroots of course). But the build server does not sign packages. However they get built, each packager that holds trusted private keys is responsible for sigining the packages and sending the signatures from their local systems, not from shared build infrastructure that might be compromised at the same time as a package repository.

NitroKey was even kind enough to sponsor hardware keys for all Arch Linux packagers so that we can hold our private keys offline in hardware that requires physical access to sign packages. This means even if you compromise a developer's personal machine you still don't get to produce packages that would be automatically trusted by Arch systems.

Also protected by ssh keys and typical best practices, but if you gain access to that server; the signatures don't matter because that machine has to have the signing key for that process to work too. -- If we were building these locally, it'd be the equivalent of gaining access to my physical machine. If you've done that, it's game over and no amount of signatures will help.

If developers private key material and access to publishing packages is compromised, yes you would still have a problem even with end users checking package signatures by default.

Actually it doesn't have to be game over there either, this is where reproducibility comes into play, but that's a topic for another time and definitely another level of potential protections.

The benefit signatures provide in the second scenario is that if we discovered something like that, we could invalidate a signature, ship that, and presumably protect against any further distribution. Again...good insulation to have in that respect.

Yes, and as Arch Linux does upstream of you in addition to untrusting an expired, compromised, or obsolete key (e.g. when a team member is removed), anything built by said key is rebuilt and signed by somebody else.

alerque avatar Oct 24 '25 20:10 alerque

@alerque Thank you for the additional detail. I appreciate you sharing the info and helping to ensure we're following best practices here. I have a couple of additional questions this has sparked if you don't mind.

In Arch Linux we do have some shared build infrastructure (a big fat 96 core machine with 396 Gigs of RAM) that packagers can have things built on, although packages can also be built locally on our own machines as well (via isolated chroots of course). But the build server does not sign packages. However they get built, each packager that holds trusted private keys is responsible for sigining the packages and sending the signatures from their local systems, not from shared build infrastructure that might be compromised at the same time as a package repository.

What measures are or should be in place to make this effective? As I see it; unless there's a very rigorous process the packager is putting every single built package through; if I could manage to compromise the build server and inject something malicious, I've compromised the bunch.

In my head, I still don't have to compromise the signing system; I just have to wait for the packager to sign it for me and release it.

If you just have a build server that automatically signs packages you build and is co-located with or shares SSH keys with your package server, you might be able to change the setting to requiring signed packages but you haven't really accomplished an extra layer in the security model. You'd have the illusion of an extra layer of security without the actual security!

With this in mind, how do you couch something like CachyOS's repos? CachyOS maintain and distribute quite massive repos that, while I don't know the inner workings of, can only imagine are built and distributed exactly this way. I can assume this based on the general volume of packages being built, as well as the fact that their keyring contains only 1 key.

ryanrhughes avatar Oct 26 '25 05:10 ryanrhughes

What measures are or should be in place to make this effective? As I see it; unless there's a very rigorous process the packager is putting every single built package through; if I could manage to compromise the build server and inject something malicious, I've compromised the bunch.

Okay so the concern is that a malicious build server could inject stuff into packages in some clever way, then sends the packages off to be signed by the packagers who are none the wiser. This is a valid attack vector to be concerned about of course, but it can also be mitigated. The most obvious way is by striving for reproducible builds and running a rebuilder.

Here is an example Arch package: hyprland. See the "reproducability status" that shows "good" there? That means a 3rd party build server that doesn't share credentials or access right or infrastructure with our build server has downloaded the package sources, done it's own independent build, and determined that the generated binary package is byte for byte identical with the one signed off by a developer. When an otherwise reproducible build becomes non-reproducible that throws warnings which packagers can investigate. I get an email if anything I sign off on for Arch Linux repositories comes back unreproducible.

Reproducible builds will actually mitigate a lot of attack vectors for you. Besides a compromised build server that packagers are unaware of, it would also would also limit what a malicious packager could get away with. I can build Arch packages that go out to the entire distro on my personal machine. I just did on my laptop a few minutes ago. But that was done such that my packaging changes are in a public repository, and a rebuilder is going to check that the package is verifiably what I claim it is: a pure build in a clean chroot using a known tool chain with only the specified dependencies and packaging scripts (including the PKGBUILD checksums) in a predefined condition. If I were to try to put something malicious in the PKGBUILD that isn't in the sources I publish it won't even let me push the package to repos, and if somehow my local build came up different that a subsequent rebuilder that will also throw a red flag.

In my head, I still don't have to compromise the signing system; I just have to wait for the packager to sign it for me and release it.

Are you publishing your packages sources somewhere? Anything you publish binaries for should also have packaging sources published for, then a rebuilder could be setup to verify, and the public nature of the sources will keep the system honest.

With this in mind, how do you couch something like CachyOS's repos? CachyOS maintain and distribute quite massive repos that, while I don't know the inner workings of, can only imagine are built and distributed exactly this way. I can assume this based on the general volume of packages being built, as well as the fact that their keyring contains only 1 key.

I'm not familiar with how CachyOS handles their build pipeline, but a cursory glance does suggest they might be doing a bit of security theatre there and signing things directly on a build server. Paging @ptr1337 who might be able to shed more light on that.

It's also worth noting that this is a huge pain point for Arch right now to because it make building for other architectures very complicated when developers can't be expected to directly build or even test all platforms of a package. It also means we don't have a good way to sign the package database, only the packages. That leaves a few smaller attack vectors available, but we're in the process of migrating to a hardware backed server signing solution for that too that developers could trigger with verified changesets that get signed remotely.

alerque avatar Oct 26 '25 06:10 alerque

All packages being added to the Omarchy repo will now be signed going in. However, we still have some work to do to get everyone updated with the key so we can flip the rule in pacman.conf.

Users can can do this by whichever method you feel comfortable with to get ahead of the game if they'd like, but do be sure to install the omarchy/omarchy-keyring package to make future updates easier on our end.

sudo pacman-key --recv-keys 40DFB630FF42BCFFB047046CF0134EE680CAC571 --keyserver keys.openpgp.org
sudo pacman-key --lsign-key 40DFB630FF42BCFFB047046CF0134EE680CAC571

or this will work until we update pacman.conf (preferably install this, even if you do the first method)

sudo pacman -Sy --noconfirm omarchy/omarchy-keyring

or download and verify yourself

http://pkgs.omarchy.org/x86_64/omarchy-keyring-20251026-2-any.pkg.tar.zst
SHA256: b417655fe451dfd5e0e30af0a37ffeb3106ead1d1ed60e936ceb734e1dd428ac

http://pkgs.omarchy.org/x86_64/omarchy-keyring-20251026-2-any.pkg.tar.zst.sig
SHA256: 7176db556c422989edd0d5880174e2f9f05c07dc6f0ff580506d6a6f55511a76

pacman -U --skip-verify {wherever_you_downloaded}/omarchy-keyring-20251026-2-any.pkg.tar.zst

Until you've installed the key, if you install any new packages from the [omarchy] repo, you'll see this. You can accept it, but still need to run the --lsign command and pacman -S omarchy/omarchy-keyring command to complete the cycle and avoid seeing that in the future.

Image

The eagle-eyed among us, and most certainly @alerque will be quick to notice that like CachyOS, we have one key currently to cover the build chain. We can seek to improve and expand this over time, but I believe that stepping quickly and iteratively as we see fit is better than slowly and perfect.

With the package added, we can easily improve our build repo as we expand, as well as expand the keys distributed with relative ease.

ryanrhughes avatar Oct 26 '25 20:10 ryanrhughes

Sorry for "highjacking" this issue with a side note, but I wanted to add some info that is kind of related to this. In case this is not of interest or does not belong here, just dismiss it.

Today, for the 1st time, on my running installation (over 80 days old, so only updating since then and therefore no changes implemented that might only come with a new install), I recognized that pacman wanted to install a new PGP key, which raised all my alarm bells:

:: PGP Schlüssel F0134EE680CAC571, »Unknown Packager« import? [Y/n]

I stopped everything and searched for the key owner and found...you, i.e., [email protected].

Since you already discussing the steps to enhance security, I think it would be wise to make sure that the key owner is not the "Unknown Packager" anymore, but that it has an informative name for the key owner....

Thanks!

Woosah avatar Oct 27 '25 08:10 Woosah

Why the URL are in http instead of https ? http://pkgs.omarchy.org...

Moreover why there is "Unknown Packager" it looks strange for the end users

craph avatar Nov 12 '25 08:11 craph

Image

pacman-key --gen

is an invalid command lol. The simplest hardening for this would be to make use of $XDG_CONFIG_HOME/pacman/pacman.conf and $HOME/.gnupg for having robust algos via gpg/gpg-agent/dirmngr/gpgsm/keboxd/dirmngr_ldapservers.conf

PhaedrusFlow avatar Dec 31 '25 00:12 PhaedrusFlow