This commit is contained in:
Jorijn van der Graaf 2026-11-01 18:35:23 +01:00
commit 1ea50c50bc
62 changed files with 9982 additions and 608 deletions

28
packaging/arch/PKGBUILD Normal file
View file

@ -0,0 +1,28 @@
# SPDX-License-Identifier: LGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
#
# The system half of nostro for Arch Linux: nostrod's user, its D-Bus and polkit policies, its systemd unit and the
# nostro command. nostrod and the CLI come from the net.catcrafts.Nostro Flatpak, installed system-wide
# (nostro-system.install says how). pacman's hooks create the user and reload systemd and D-Bus.
# Build in this directory: makepkg -si
pkgname=nostro-system
pkgver=0.1.0
pkgrel=1
pkgdesc="System files for nostro, a banking client for Linux whose daemon runs from a Flatpak"
arch=(any)
license=(LGPL-3.0-only)
depends=(dbus flatpak polkit systemd)
install=nostro-system.install
package() {
local system="$startdir/../system"
install -Dm644 "$system/nostro.sysusers" "$pkgdir/usr/lib/sysusers.d/nostro.conf"
install -Dm644 "$system/net.catcrafts.Nostro1.conf" "$pkgdir/usr/share/dbus-1/system.d/net.catcrafts.Nostro1.conf"
install -Dm644 "$system/net.catcrafts.Nostro1.service" "$pkgdir/usr/share/dbus-1/system-services/net.catcrafts.Nostro1.service"
install -Dm644 "$system/net.catcrafts.Nostro1.Checkout.service" "$pkgdir/usr/share/dbus-1/system-services/net.catcrafts.Nostro1.Checkout.service"
install -Dm644 "$system/net.catcrafts.Nostro1.policy" "$pkgdir/usr/share/polkit-1/actions/net.catcrafts.Nostro1.policy"
install -Dm644 "$system/nostrod.service" "$pkgdir/usr/lib/systemd/system/nostrod.service"
install -Dm755 "$system/nostro" "$pkgdir/usr/bin/nostro"
install -Dm644 "$startdir/../dbus/net.catcrafts.Nostro1.xml" "$pkgdir/usr/share/dbus-1/interfaces/net.catcrafts.Nostro1.xml"
install -Dm644 "$startdir/../dbus/net.catcrafts.Nostro1.Checkout.xml" "$pkgdir/usr/share/dbus-1/interfaces/net.catcrafts.Nostro1.Checkout.xml"
}

View file

@ -0,0 +1,21 @@
# SPDX-License-Identifier: LGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
post_install() {
echo "nostrod and the nostro CLI come from a Flatpak; install it system-wide:"
echo " flatpak install --system net.catcrafts.Nostro.flatpakref"
echo "(packaging/flatpak/ in nostro's source), or from a local build: flatpak install --system <repo> net.catcrafts.Nostro"
}
post_upgrade() {
# A nostrod still running keeps the old files until it ends.
systemctl try-restart nostrod.service
}
pre_remove() {
systemctl stop nostrod.service
}
post_remove() {
echo "The bank connections stay in /var/lib/nostro; remove that directory to forget them, and revoke the API keys in the bank's app."
}

View file

@ -0,0 +1,54 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!-- SPDX-License-Identifier: LGPL-3.0-only -->
<!-- SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® -->
<!-- nostro's checkout: how an app has the user's nostro pay an order. The bus name net.catcrafts.Nostro1.Checkout on
the system bus, at /net/catcrafts/Nostro1; a Flatpak app asks for it with the finish-arg
system-talk-name=net.catcrafts.Nostro1.Checkout. C++ programs can use the module Nostro.Checkout (nostro built with
product=checkout) instead. A test in nostro keeps this file the interface nostrod serves.
Pay(payeeIban, payeeName, amount, currency, reference, options) returns (paymentId, results)
payeeIban who is paid: an IBAN, the only payee checkout pays
payeeName their name, as the bank and the prompt show it
amount in the currency's smallest unit (1250 is 12.50), more than zero
currency an ISO code: "EUR"
reference the order's own number, not empty: the payment's description, and what tells orders apart
options none yet; keys nostrod does not know are ignored
paymentId the paying bank's id of the payment
results repeated (b): the order was paid by an earlier call, and nothing was paid now. Later versions may
add keys: ignore the ones you do not know.
nostrod pays the order from the account the user chose for checkouts (nostro checkout account), once the user has
confirmed it at a password prompt that shows the amount, the payee, the reference and that account. The app never
names nor sees the account. Allow interactive authorization on the call, make it asynchronously, and give it a
timeout of minutes: the user may take a while.
An order is paid once. Pay with the same payeeIban and reference again, after a timeout or a crash, answers with
the first payment (repeated is true) without asking the user, or waits for the first call while the user is still
at the prompt; the same reference with another amount is refused. A payment id is not a receipt: confirm the money
arrived with your own bank.
Errors:
net.catcrafts.Nostro1.Error.Cancelled the user did not confirm: nothing was paid
net.catcrafts.Nostro1.Error.NoCheckoutAccount the user has no account chosen to pay checkouts from: nothing was paid
net.catcrafts.Nostro1.Error.InvalidArgument the order was refused before anything was paid
net.catcrafts.Nostro1.Error.Bank the bank refused; its message says when it may have paid all the same
net.catcrafts.Nostro1.Error.Failed anything else, such as an earlier call for this order whose outcome was
lost: it may have been paid
org.freedesktop.DBus.Error.AccessDenied the system's policy refused
org.freedesktop.DBus.Error.InteractiveAuthorizationRequired the call did not allow a password prompt
org.freedesktop.DBus.Error.ServiceUnknown nostro is not installed -->
<node>
<interface name="net.catcrafts.Nostro1.Checkout">
<method name="Pay">
<arg type="s" name="payeeIban" direction="in"/>
<arg type="s" name="payeeName" direction="in"/>
<arg type="x" name="amount" direction="in"/>
<arg type="s" name="currency" direction="in"/>
<arg type="s" name="reference" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="t" name="paymentId" direction="out"/>
<arg type="a{sv}" name="results" direction="out"/>
</method>
</interface>
</node>

View file

@ -0,0 +1,196 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!-- SPDX-License-Identifier: LGPL-3.0-only -->
<!-- SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® -->
<!-- nostrod's interface: net.catcrafts.Nostro1 on the system bus, at /net/catcrafts/Nostro1. Generate a proxy from
this file (gdbus-codegen, qdbusxml2cpp, zbus-xmlgen); C++ programs can use Nostro::Client instead. A test in nostro
keeps this file the interface nostrod serves.
Every call is answered for the calling user only, and authorised with polkit first
(packaging/system/net.catcrafts.Nostro1.policy): allow interactive authorization on your calls, so the user can be
asked for their password, and give them a timeout of minutes. Every reply ends with `notes`, the warnings the
library gave during the call, to show the user.
Conventions:
account an account's name or IBAN
to, from an IBAN, an e-mail address, or a phone number starting with +
amount in the currency's smallest unit (1250 is 12.50), positive; balances and transactions are negative
when money goes out
currency an ISO code: "EUR"
times x: microseconds since 1970-01-01 00:00 UTC
optionals an array of zero or one element (ax)
Types:
connectors (Connectors) a(ssssb): name, bank ("bunq"), environment ("production" or "sandbox"),
auth ("api key" or "oauth"), whether a call to the bank works now
connectors (Accounts) a(ssa(ssssx)): connector name, bank, accounts: name, BIC, IBAN, currency, balance
query (Transactions) a{sv}, each key optional: search s, amount x, from x, to x, limit t (100)
transactions a(sssssxxss): name, BIC, IBAN, description, currency, amount, time, the bank's
id, the bank's kind ("MASTERCARD/PAYMENT")
schedule (xaxsusax): start, end, unit (ONCE, HOURLY, DAILY, WEEKLY, MONTHLY, YEARLY),
every n units, status (ACTIVE, FINISHED, CANCELLED), next run
request (sent) (ts(ss)sxaxsxs): id, status, counterparty (name, IBAN), currency, amount asked,
amount paid, description, created, bunq.me link
requests (incoming) a(tss(ss)sxsx): id, status, type (INTERNAL, DIRECT_DEBIT, ...), counterparty,
currency, amount, description, created
scheduled a(t(ss)sxs(xaxsusax)): id, counterparty, currency, amount, description, schedule
drafts a(tssa((ss)sxs)s): id, status, created by, entries (counterparty, currency,
amount, description), bunq's time of its last change
cards / updated (tsssssssss): id, kind, product type, status, order status, name on card,
second line, last four digits, expiry, IBAN it pays from
account / chosen (ssssx): the account apps' checkouts pay from (net.catcrafts.Nostro1.Checkout),
as in Accounts; DefaultCheckoutAccount has none until one is chosen, or once
it is gone. An account reached through OAuth cannot pay a shop, and is refused.
Errors, besides org.freedesktop.DBus.Error.AccessDenied (refused, or polkit did not answer) and
org.freedesktop.DBus.Error.InteractiveAuthorizationRequired:
net.catcrafts.Nostro1.Error.InvalidArgument refused before anything was sent
net.catcrafts.Nostro1.Error.Cancelled the user did not authenticate: nothing was done
net.catcrafts.Nostro1.Error.Bank the bank's own refusal
net.catcrafts.Nostro1.Error.OAuthCannotPay an OAuth connection may only pay the user's own accounts
net.catcrafts.Nostro1.Error.NoCheckoutAccount (checkout) no account is chosen to pay checkouts from
net.catcrafts.Nostro1.Error.Failed anything else; a payment that failed this way may have been made -->
<node>
<interface name="net.catcrafts.Nostro1">
<method name="Connectors">
<arg type="a(ssssb)" name="connectors" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="AddBunq">
<arg type="s" name="apiKey" direction="in"/>
<arg type="s" name="allowedIps" direction="in"/>
<arg type="s" name="environment" direction="in"/>
<arg type="s" name="name" direction="out"/>
<arg type="s" name="addedEnvironment" direction="out"/>
<arg type="u" name="accounts" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="AddBunqOAuth">
<arg type="s" name="environment" direction="in"/>
<arg type="s" name="clientId" direction="in"/>
<arg type="s" name="clientSecret" direction="in"/>
<arg type="s" name="redirectUri" direction="in"/>
<arg type="s" name="code" direction="in"/>
<arg type="s" name="name" direction="out"/>
<arg type="s" name="addedEnvironment" direction="out"/>
<arg type="u" name="accounts" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="RemoveConnector">
<arg type="s" name="connector" direction="in"/>
<arg type="s" name="name" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Accounts">
<arg type="a(ssa(ssssx))" name="connectors" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Transactions">
<arg type="s" name="account" direction="in"/>
<arg type="a{sv}" name="query" direction="in"/>
<arg type="a(sssssxxss)" name="transactions" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Send">
<arg type="s" name="account" direction="in"/>
<arg type="s" name="to" direction="in"/>
<arg type="s" name="name" direction="in"/>
<arg type="x" name="amount" direction="in"/>
<arg type="s" name="description" direction="in"/>
<arg type="t" name="id" direction="out"/>
<arg type="s" name="currency" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Schedule">
<arg type="s" name="account" direction="in"/>
<arg type="s" name="to" direction="in"/>
<arg type="s" name="name" direction="in"/>
<arg type="x" name="amount" direction="in"/>
<arg type="s" name="description" direction="in"/>
<arg type="(xaxsusax)" name="schedule" direction="in"/>
<arg type="t" name="id" direction="out"/>
<arg type="s" name="currency" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Request">
<arg type="s" name="account" direction="in"/>
<arg type="s" name="from" direction="in"/>
<arg type="s" name="name" direction="in"/>
<arg type="x" name="amount" direction="in"/>
<arg type="s" name="description" direction="in"/>
<arg type="(ts(ss)sxaxsxs)" name="request" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Requests">
<arg type="s" name="account" direction="in"/>
<arg type="a(ts(ss)sxaxsxs)" name="requests" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="RevokeRequest">
<arg type="s" name="account" direction="in"/>
<arg type="t" name="id" direction="in"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="IncomingRequests">
<arg type="s" name="account" direction="in"/>
<arg type="a(tss(ss)sxsx)" name="requests" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="RespondToRequest">
<arg type="s" name="account" direction="in"/>
<arg type="t" name="id" direction="in"/>
<arg type="b" name="accept" direction="in"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="ScheduledPayments">
<arg type="s" name="account" direction="in"/>
<arg type="a(t(ss)sxs(xaxsusax))" name="scheduled" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="CancelScheduledPayment">
<arg type="s" name="account" direction="in"/>
<arg type="t" name="id" direction="in"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Draft">
<arg type="s" name="account" direction="in"/>
<arg type="s" name="to" direction="in"/>
<arg type="s" name="name" direction="in"/>
<arg type="x" name="amount" direction="in"/>
<arg type="s" name="description" direction="in"/>
<arg type="t" name="id" direction="out"/>
<arg type="s" name="currency" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="DraftPayments">
<arg type="s" name="account" direction="in"/>
<arg type="a(tssa((ss)sxs)s)" name="drafts" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="RespondToDraftPayment">
<arg type="s" name="account" direction="in"/>
<arg type="t" name="id" direction="in"/>
<arg type="b" name="accept" direction="in"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="Cards">
<arg type="a(ssa(tsssssssss))" name="connectors" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="SetCardStatus">
<arg type="t" name="card" direction="in"/>
<arg type="s" name="status" direction="in"/>
<arg type="(tsssssssss)" name="updated" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="DefaultCheckoutAccount">
<arg type="a(ssssx)" name="account" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
<method name="SetDefaultCheckoutAccount">
<arg type="s" name="account" direction="in"/>
<arg type="(ssssx)" name="chosen" direction="out"/>
<arg type="as" name="notes" direction="out"/>
</method>
</interface>
</node>

View file

@ -0,0 +1,13 @@
[Flatpak Ref]
Title=Nostro
Name=net.catcrafts.Nostro
Branch=stable
Url=https://flatpak.catcrafts.net/repo/
SuggestRemoteName=catcrafts
Homepage=https://catcrafts.net
Comment=Banking client for Linux
Description=nostro and nostrod, its daemon; install it system-wide with the system files from packaging/system
Icon=
RuntimeRepo=https://dl.flathub.org/repo/flathub.flatpakrepo
IsRuntime=false
GPGKey=GPG_KEY_BASE64_PLACEHOLDER

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-License-Identifier: CC0-1.0 -->
<component type="console-application">
<id>net.catcrafts.Nostro</id>
<name>Nostro</name>
<summary>Banking client for Linux</summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-3.0-only</project_license>
<developer id="net.catcrafts">
<name>Catcrafts</name>
</developer>
<description>
<p>
Nostro talks to your bank's API directly: accounts, transactions, payments, requests, schedules, draft payments
and cards, for bunq so far. Its daemon, nostrod, runs as a system user of its own and keeps every local user's
bank connections where no program of theirs can read them; the nostro command asks it over the system bus, and
your password is asked for before anything moves money.
</p>
<p>
Apps can have Nostro pay an order at checkout, from an account you chose, once you have confirmed the payment.
</p>
</description>
<provides>
<binary>nostro</binary>
</provides>
<content_rating type="oars-1.1"/>
</component>

View file

@ -0,0 +1,63 @@
# SPDX-License-Identifier: LGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
#
# nostro as a Flatpak: the CLI, which is the command, and nostrod, which systemd runs from it as the system user nostro
# (packaging/system/nostrod.service). Install it system-wide, with the system files packaging/system/install.sh or
# packaging/arch/PKGBUILD put in place; a Flatpak cannot install those itself.
#
# Built with crafter-build's own Flatpak as the base app, for its clang 23 and libc++, then stripped back to the two
# binaries and the three C++ runtime libraries they link. libssl, libcrypto and libsystemd come from the Platform.
app-id: net.catcrafts.Nostro
runtime: org.freedesktop.Platform
runtime-version: '26.08'
sdk: org.freedesktop.Sdk
base: net.catcrafts.CrafterBuild
base-version: stable
branch: stable
command: nostro
finish-args:
# nostrod talks to the bank, and to the bus, logind and polkit on the system bus; the CLI talks to nostrod there.
# Nothing else: no files, no session bus. nostrod keeps its state in the service's home, which is its own.
- --share=network
- --socket=system-bus
modules:
- name: nostro
buildsystem: simple
build-options:
# crafter-build fetches Crafter.Network, Crafter.Thread, Crafter.DB and Crafter.LintRules from git, unpinned (see
# AGENTS.md).
build-args:
- --share=network
# A baseline CPU: crafter-build builds for the building machine's own (-march=native) unless told otherwise.
env:
NOSTRO_MARCH: x86-64-v2
arch:
aarch64:
env:
NOSTRO_MARCH: armv8-a
build-commands:
- HOME="$PWD/.home" crafter-build --banks=bunq --march=$NOSTRO_MARCH --mtune=generic
- HOME="$PWD/.home" crafter-build --banks=bunq --product=daemon --march=$NOSTRO_MARCH --mtune=generic
- install -Dm755 "$(ls -t bin/nostro-*/nostro | head -n1)" /app/bin/nostro
- install -Dm755 "$(ls -t bin/nostrod-*/nostrod | head -n1)" /app/bin/nostrod
- install -Dm644 packaging/flatpak/net.catcrafts.Nostro.metainfo.xml -t /app/share/metainfo/
sources:
- type: dir
path: ../..
skip:
- .git
- .home
- bin
- build
cleanup-commands:
# The base app's toolchain is in /app too: keep what nostro needs at run time, its metainfo, and the licenses of what
# it ships: its own, which flatpak-builder recorded, and LLVM's, for libc++, libc++abi and libunwind.
- mkdir -p /var/tmp/keep/bin /var/tmp/keep/lib /var/tmp/keep/share/metainfo /var/tmp/keep/share/licenses
- cp -a /app/bin/nostro /app/bin/nostrod /var/tmp/keep/bin/
- cp -a /app/lib/libc++.so.1* /app/lib/libc++abi.so.1* /app/lib/libunwind.so.1* /var/tmp/keep/lib/
- cp -a /app/share/metainfo/net.catcrafts.Nostro.metainfo.xml /var/tmp/keep/share/metainfo/
- cp -a /app/share/licenses/net.catcrafts.Nostro /var/tmp/keep/share/licenses/
- install -Dm644 /app/share/licenses/net.catcrafts.CrafterBuild/llvm/LICENSE.TXT /var/tmp/keep/share/licenses/net.catcrafts.Nostro/llvm/LICENSE.TXT
- find /app -mindepth 1 -maxdepth 1 -exec rm -rf {} +
- cp -a /var/tmp/keep/. /app/
- rm -rf /var/tmp/keep

42
packaging/system/install.sh Executable file
View file

@ -0,0 +1,42 @@
#!/bin/sh
# SPDX-License-Identifier: LGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
#
# Installs nostro for every user of this machine: the system files nostrod needs (its user, its D-Bus and polkit
# policies, its systemd unit, the nostro command) and the net.catcrafts.Nostro Flatpak, system-wide. Run as root.
#
# install.sh the Flatpak from the system remote "catcrafts" (packaging/flatpak/net.catcrafts.Nostro.flatpakref
# sets it up: flatpak install --system net.catcrafts.Nostro.flatpakref)
# install.sh --repo DIR the Flatpak from a local repository, as flatpak-builder --repo=DIR makes one, for testing
#
# Running it again updates. packaging/arch/PKGBUILD installs the same files from a package; uninstall.sh removes them.
set -eu
here=$(cd "$(dirname "$0")" && pwd)
repo=
if [ "${1:-}" = --repo ]; then
repo=$(cd "${2:?--repo needs a directory}" && pwd)
fi
install -Dm644 "$here/nostro.sysusers" /usr/lib/sysusers.d/nostro.conf
systemd-sysusers /usr/lib/sysusers.d/nostro.conf
install -Dm644 "$here/net.catcrafts.Nostro1.conf" /usr/share/dbus-1/system.d/net.catcrafts.Nostro1.conf
install -Dm644 "$here/net.catcrafts.Nostro1.service" /usr/share/dbus-1/system-services/net.catcrafts.Nostro1.service
install -Dm644 "$here/net.catcrafts.Nostro1.Checkout.service" /usr/share/dbus-1/system-services/net.catcrafts.Nostro1.Checkout.service
install -Dm644 "$here/net.catcrafts.Nostro1.policy" /usr/share/polkit-1/actions/net.catcrafts.Nostro1.policy
install -Dm644 "$here/nostrod.service" /etc/systemd/system/nostrod.service
install -Dm755 "$here/nostro" /usr/local/bin/nostro
if [ -n "$repo" ]; then
# A local repository is unsigned: for a build of your own, never for one from elsewhere.
flatpak remote-add --system --if-not-exists --no-gpg-verify nostro-local "file://$repo"
flatpak install --system -y --noninteractive --or-update nostro-local net.catcrafts.Nostro//stable
else
flatpak install --system -y --noninteractive --or-update catcrafts net.catcrafts.Nostro//stable
fi
systemctl daemon-reload
busctl call org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus ReloadConfig
# A nostrod already running keeps the old files until it ends; stop it, and the next call starts the new one.
systemctl try-restart nostrod.service
echo "nostro is installed: nostrod starts with the first call, such as 'nostro connectors add bunq'"

View file

@ -0,0 +1,8 @@
# SPDX-License-Identifier: LGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
# An app's first checkout starts nostrod, through systemd. Install: /usr/share/dbus-1/system-services/
[D-BUS Service]
Name=net.catcrafts.Nostro1.Checkout
Exec=/bin/false
User=nostro
SystemdService=nostrod.service

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<!-- SPDX-License-Identifier: LGPL-3.0-only -->
<!-- SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® -->
<!-- nostrod owns its two names as the user nostro, and anyone may call them: nostrod answers each caller for their own
bank connections alone, and asks polkit first (net.catcrafts.Nostro1.policy).
Install: /usr/share/dbus-1/system.d/net.catcrafts.Nostro1.conf -->
<busconfig>
<policy user="nostro">
<allow own="net.catcrafts.Nostro1"/>
<allow own="net.catcrafts.Nostro1.Checkout"/>
</policy>
<policy context="default">
<allow send_destination="net.catcrafts.Nostro1"/>
<allow send_destination="net.catcrafts.Nostro1.Checkout"/>
</policy>
</busconfig>

View file

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?> <!--*-nxml-*-->
<!-- SPDX-License-Identifier: LGPL-3.0-only -->
<!-- SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® -->
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<!-- What nostrod (net.catcrafts.Nostro1) asks polkit before it does anything for a caller.
Every action is owned by unix-user:nostro, the user nostrod runs as: polkit lets only root or an action's owner
check a call made by another user, or pass the details the dialog shows. $(summary) is what nostrod read for the
call itself, such as the amount, the payee and the account of a payment; the details amount_minor, currency,
counterparty, account_iban, environment and, at checkout, reference are there for rules (an amount above which an
administrator must approve, say).
No action keeps an authorization: polkit ties a kept one to the calling process, so the CLI would ask every time
anyway. Viewing and the changes that move no money are free in an active session; whatever moves money (an app's
checkout included), unfreezes or blocks a card, or changes the bank connections or the account checkouts pay from
asks for the user's password every time.
Install: /usr/share/polkit-1/actions/net.catcrafts.Nostro1.policy. Tune with rules in /etc/polkit-1/rules.d/. -->
<policyconfig>
<vendor>Catcrafts</vendor>
<action id="net.catcrafts.Nostro1.View">
<description>See your bank accounts, transactions, requests and cards</description>
<message>Authentication is required to $(summary)</message>
<defaults>
<allow_any>auth_self</allow_any>
<allow_inactive>auth_self</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.owner">unix-user:nostro</annotate>
</action>
<action id="net.catcrafts.Nostro1.Change">
<description>Ask for money, make draft payments, cancel what is pending, or freeze a card</description>
<message>Authentication is required to $(summary)</message>
<defaults>
<allow_any>auth_self</allow_any>
<allow_inactive>auth_self</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.owner">unix-user:nostro</annotate>
</action>
<action id="net.catcrafts.Nostro1.Pay">
<description>Make a payment, schedule one, or accept a request or a draft payment</description>
<message>Authentication is required to $(summary)</message>
<defaults>
<allow_any>auth_self</allow_any>
<allow_inactive>auth_self</allow_inactive>
<allow_active>auth_self</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.owner">unix-user:nostro</annotate>
</action>
<action id="net.catcrafts.Nostro1.UnfreezeCard">
<description>Let a frozen card pay again</description>
<message>Authentication is required to $(summary)</message>
<defaults>
<allow_any>auth_self</allow_any>
<allow_inactive>auth_self</allow_inactive>
<allow_active>auth_self</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.owner">unix-user:nostro</annotate>
</action>
<action id="net.catcrafts.Nostro1.BlockCard">
<description>Report a card lost or stolen, which blocks it for good</description>
<message>Authentication is required to $(summary)</message>
<defaults>
<allow_any>auth_self</allow_any>
<allow_inactive>auth_self</allow_inactive>
<allow_active>auth_self</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.owner">unix-user:nostro</annotate>
</action>
<action id="net.catcrafts.Nostro1.Connectors">
<description>Add or remove a bank connection, or choose the account apps may ask you to pay from</description>
<message>Authentication is required to $(summary)</message>
<defaults>
<allow_any>auth_self</allow_any>
<allow_inactive>auth_self</allow_inactive>
<allow_active>auth_self</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.owner">unix-user:nostro</annotate>
</action>
<action id="net.catcrafts.Nostro1.Checkout">
<description>Pay an order an app asks you to pay</description>
<message>Authentication is required to $(summary)</message>
<defaults>
<allow_any>auth_self</allow_any>
<allow_inactive>auth_self</allow_inactive>
<allow_active>auth_self</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.owner">unix-user:nostro</annotate>
</action>
</policyconfig>

View file

@ -0,0 +1,8 @@
# SPDX-License-Identifier: LGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
# The first call to nostrod starts it, through systemd. Install: /usr/share/dbus-1/system-services/
[D-BUS Service]
Name=net.catcrafts.Nostro1
Exec=/bin/false
User=nostro
SystemdService=nostrod.service

19
packaging/system/nostro Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
# SPDX-License-Identifier: LGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
#
# The nostro command: the CLI from the net.catcrafts.Nostro Flatpak, run as you. It asks nostrod over the system bus,
# and your session's polkit agent asks for your password before anything moves money. Install: /usr/bin/nostro (a
# package) or /usr/local/bin/nostro (install.sh).
# Before nostrod, nostro kept the bank's secrets in the user's own home, where every program they run can read them.
# (With XDG_CONFIG_HOME set, it looked in $XDG_CONFIG_HOME/.config/nostro.)
for old in "${XDG_CONFIG_HOME:-$HOME/.config}/nostro/connectors.json" "${XDG_CONFIG_HOME:-$HOME}/.config/nostro/connectors.json"; do
if [ -e "$old" ]; then
echo "nostro: $old is an older nostro's, and holds your bank's API key where any program you run can read it." \
"Revoke that key in the bunq app, add a new one with 'nostro connectors add bunq', and delete the file." >&2
break
fi
done
exec /usr/bin/flatpak run --system net.catcrafts.Nostro//stable "$@"

View file

@ -0,0 +1,5 @@
# SPDX-License-Identifier: LGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
# The user nostrod runs as. A static user rather than systemd's DynamicUser=, which D-Bus policies and polkit's
# action owners could not name. Its home is nostrod's state directory. Install: /usr/lib/sysusers.d/nostro.conf
u nostro - "nostro banking daemon" /var/lib/nostro

View file

@ -0,0 +1,47 @@
# SPDX-License-Identifier: LGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
#
# nostrod: every local user's bank connections, one worker process per user, behind net.catcrafts.Nostro1 and
# net.catcrafts.Nostro1.Checkout on the system bus. The first call starts it (D-Bus activation), and it ends by itself
# once idle, so an updated Flatpak takes over at the next call. It runs from the net.catcrafts.Nostro Flatpak as the
# system user nostro, whose home, the state directory, holds the connections: no other user can read it.
#
# The hardening is what bubblewrap, which flatpak runs the daemon in, works under. Not here, because it breaks it:
# RestrictSUIDSGID= (systemd answers openat2() with ENOSYS for it, and bubblewrap 0.13 has no fallback; NoNewPrivileges=
# voids setuid bits anyway), RestrictNamespaces=, and ProtectKernelTunables=, ProtectKernelLogs=, ProtectProc= and
# ProcSubset=, which overmount the /proc bubblewrap mounts its own over.
#
# Install: /etc/systemd/system/nostrod.service (install.sh) or /usr/lib/systemd/system/nostrod.service (a package).
[Unit]
Description=nostro banking daemon
[Service]
Type=dbus
BusName=net.catcrafts.Nostro1
User=nostro
Group=nostro
ExecStart=/usr/bin/flatpak run --system --no-session-bus --die-with-parent --command=nostrod net.catcrafts.Nostro//stable
StateDirectory=nostro
StateDirectoryMode=0700
# flatpak run needs a runtime directory, which a system user does not have.
RuntimeDirectory=nostro
RuntimeDirectoryMode=0700
Environment=XDG_RUNTIME_DIR=/run/nostro
UMask=0077
# A core dump would hold every key the daemon had in memory; nostrod's workers also make themselves undumpable.
LimitCORE=0
NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=strict
ProtectHome=yes
ProtectClock=yes
ProtectControlGroups=yes
CapabilityBoundingSet=
MemoryDenyWriteExecute=yes
LockPersonality=yes
RestrictRealtime=yes
# AF_NETLINK: bubblewrap brings up loopback in the network namespace of the sandbox flatpak runs ldconfig in.
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
# @mount, unshare and setns: bubblewrap builds the sandbox with them.
SystemCallFilter=@system-service @mount unshare setns

29
packaging/system/uninstall.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
# SPDX-License-Identifier: LGPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
#
# Removes what install.sh installed. Run as root. Every user's bank connections stay in /var/lib/nostro, for a later
# install to find, unless --purge is given: then they go too, with the user nostro. Revoke the API keys in the bank's app
# as well, since the bank still accepts them.
set -u
systemctl stop nostrod.service 2>/dev/null
flatpak uninstall --system -y --noninteractive net.catcrafts.Nostro 2>/dev/null
flatpak remote-delete --system nostro-local 2>/dev/null
rm -f /usr/share/dbus-1/system.d/net.catcrafts.Nostro1.conf \
/usr/share/dbus-1/system-services/net.catcrafts.Nostro1.service \
/usr/share/dbus-1/system-services/net.catcrafts.Nostro1.Checkout.service \
/usr/share/polkit-1/actions/net.catcrafts.Nostro1.policy \
/etc/systemd/system/nostrod.service \
/usr/local/bin/nostro
systemctl daemon-reload
busctl call org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus ReloadConfig
if [ "${1:-}" = --purge ]; then
rm -rf /var/lib/nostro
rm -f /usr/lib/sysusers.d/nostro.conf
userdel nostro 2>/dev/null
echo "nostro is removed, with every user's bank connections"
else
echo "nostro is removed; the bank connections stay in /var/lib/nostro (uninstall.sh --purge removes them)"
fi