Commit Graph
46 Commits
Author SHA1 Message Date
Malte Meiboom 8de999411d Polish the code
- Reject user ids containing ANSI control characters when creating a new
  signing key.
- Prevent adding certificates twice when querying online sources if they
  contain multiple encryption keys.
- Dedup introducers if there are multiple authenticating paths.
- When listing locals, skip the signing key.
- Check if a mail can be encrypted at all due to available certificates.
  If not tell the MTA that the processing is done.
- Make `Introducer` comparable (`PartialEq`, `Eq` and `Hash`).
- minor polishing
2026-07-24 13:41:07 +02:00
Malte Meiboom c37f2ef956 Optimize mail reinjection
- Mark reinjected mails so that Husk can shortcut the processing.
- Fix Cargo.toml to correctly include the patched version of
  sequoia-cert-store and sequoia-keystore.
2026-07-21 12:12:42 +02:00
Malte Meiboom d54cc480b4 Add footer
- Add a footer to each mail resulting from a split into an encrypted and
  an unencrypted version. The footer contains the recipients of the mail
  which are excluded in the corresponding stream.
- Move the construction of the `HuskContext` to the `mail`
  milter-command, as `helo` is used by scrapers to detect mailservers.
- Use `CertD::trust_root()` to get the trust root - it creates one if no
  root can be found.
- Add `chrono` dependency.
2026-07-14 11:28:34 +02:00
Malte Meiboom ca58d73050 Add mail splitting
- If a mail has more then one recipient and not for all recipients an
  authenticated certificate can be obtained, the mail processing is
  split into 2 streams - one that encrypts and an other which sends the
  mail in plaintext.
- For both streams the header and the list of recipients is adjusted
  accordingly.
- As the milter interface only allows one stream, the second stream is
  reinjected into the MTA (via SMTP). The MTA is hardcoded to be
  localhost:25.
2026-07-09 12:49:47 +02:00
Malte Meiboom 94c94d1fce Upgrade dependencies
- Upgrade Sequoia PGP to 2.4.0
- Remove deprecated `sequoia_wot::CertSynopsis::userids()` and replace
  with `self_signed_userids()`.
- Add `lettre` as dependency for its SMTP functionality.
2026-07-03 21:52:26 +02:00
Malte Meiboom ee6b467139 Add daemon CLI commands
- Introduce option `--background` for `daemon start` to send the new
  process into the background.
- Implement a `ProcessDescr` which identifies a Husk process. This pays
  attention to the possibility of a rollover of the process ids.
- Implement `daemon status`.
- Implement `daemon stop` which sends `SIG_INT` to a running Husk
  process.
2026-06-30 12:17:07 +02:00
Malte Meiboom dabd3b26f9 Use error types, cleanup
- Create and use `CommandError` in signkey commands instead of
  `eprintln!()`.
- Minor cleanup in `crypto.rs`.
2026-06-24 11:19:07 +02:00
Malte Meiboom 7688e6c5a2 Add signkey create
- Add a CLI command for creating a new signing key.
2026-06-19 12:27:43 +02:00
Malte Meiboom e47b1b837c Sign encrypted mails.
- Husk now not only encrypts outgoing emails (if possible) but also adds
  a signature.
- Rework the internal handling of the signing key.
- Integrate the signing into the workflow of the daemon.
- Add a configuration option for a subject replacement.
2026-06-18 13:24:24 +02:00
Malte Meiboom 06c0583f5e Add CLI interface for the signing key
- 'signkey set' sets a new signing key (disables an old one if
  existing).
- 'signkey show' prints the fingerprint.
- 'signkey dump' prints the certificate of the signing key.
2026-06-13 14:37:37 +02:00
Malte Meiboom 7547776efe Assert that an added introducer has certification capabilities 2026-06-12 12:45:14 +02:00
Malte Meiboom 1f89d40cd3 Start with signing outgoing mails
- Add a scheme on how to discover Husk signing keys. Siging keys mut be
  certified by the `local trust root` with a signature having a notation
  with a name equal to `signing_keys@husk-projet.org`.
- Fetch the key from the keystore.
- Expand `authenticate()` so that notation can be added to the
  signature.
- Add a test to create a signing key and fetch it from the keystore.
2026-06-10 15:00:33 +02:00
Malte Meiboom d24aaf83e4 Add MIME support
- Wrap encrypted mails into a mime structure
- Add 'protected headers'
2026-06-08 10:58:25 +02:00
Malte Meiboom a4e3bc6b8c Fix introducer list subcommand
- Add a list of introduced domains to the output.
- Fix `regex_domain_unescape()` to return an error if the regular
  expression differs from a regex for a domain.
2026-06-02 21:36:15 +02:00
Malte Meiboom 516d745f00 Code polish
- Fix some typos.
- Added more comments (and documentation) to the code.
2026-05-27 10:53:02 +02:00
Malte Meiboom 3e60bfbde4 Flush logs after each message
- Remove or optimize this.
2026-05-21 12:45:30 +02:00
Malte Meiboom 3b95409a40 add more debugging 2026-05-20 15:07:41 +02:00
Malte Meiboom aed368e90d Remove some debugging messages 2026-05-20 13:49:40 +02:00
Malte Meiboom e6c6bf87d9 Add locals add and remove subcommands
- `locals add` adds a local (unintroduced) certificate for encryption.
- `locals remove` removes/deacivates a local certificate.
- Overall cleanup
2026-05-19 16:07:48 +02:00
Malte Meiboom 14dca91d92 Move logging config to main configuration file.
- Move the content of what was stored in log4rs.yml into the main config
  file, so that there is just one file to parse to get the complete
  configuration.
- Create the global switch `--home` to pass/overload the value for
  SEQUOIA_HOME in the configuration file.
2026-05-18 11:11:22 +02:00
Malte Meiboom 6611a43a24 Add subcommand to list local certificates
- Add `husk locals list` to list all certificates which would be used by
  husk, but are not introduced by another certificate. These
  certificates are added 'locally'.
- Refcator the code so that `local` -> `locals`.
2026-05-15 12:59:24 +02:00
Malte Meiboom 713ff86a9e Remove debugging code 2026-05-13 14:02:47 +02:00
Malte Meiboom 4ddc3db6c0 Add creating an introducer from a files
- Introducers can now be created by specifying a file. The certificate
  gets imported and declared as an introducer for the passed domains.
- Add some checks, so that the imported certificate can actually be used
  as an introducer (certificate is alive, not revoked, has certification
  capabilities)
2026-05-13 11:49:40 +02:00
Malte Meiboom 0df4c723d9 Fix bug in get_local_certifcates
- Use the trust amount of the whole path instead of just the last link.
2026-05-12 11:18:42 +02:00
Malte Meiboom 21b45d1702 Some cleanups
- Remove unused errors.
- Add doc comments.
2026-05-06 16:30:42 +02:00
Malte Meiboom c0fe0e91ea Make then '-config' parameter global
- `--config` needed to be the first argument, before any subcommands.
  Make `--config` global, so that it can appear at (almost) any place.
2026-05-06 15:49:36 +02:00
Malte Meiboom e98f5f7576 Implement 'introducer remove'
- Implement the subcommand `remove` for `introducer`.
- Remove the introducer by adding a certification with trust level 1 and
  trust depth 0.
- Move `crypt.rs` into `common/` and add a generic authenticaton
  function to be used by `introducer add` and `... remove`.
2026-05-06 15:38:33 +02:00
Malte Meiboom 9a6de637ea Fix tests in crypto.rs 2026-05-06 12:39:55 +02:00
Malte Meiboom f2260bc335 Move crypto.rs into common
- Refactor code and move crypto.rs into the common subdirectory.
- Fixed comments
2026-05-06 12:34:21 +02:00
Malte Meiboom bf53af50ec Add introducer add command
- Create a command to add an introducer (with domains).
- Add a module for escaping regular expressions used in certifications
- Add some helper functions.
2026-05-04 22:55:02 +02:00
Malte Meiboom 5f50624478 Add escape/unescape helpers for regexes
- Add helpers for escape/unescape control characters used in regular
  expressions.
2026-04-30 12:57:23 +02:00
Malte Meiboom 4e28e636a1 Make clippy happy
- Applied many of the `clippy` suggestions.
2026-04-27 13:42:47 +02:00
Malte Meiboom 799f6eb588 Complete skeleton dispatcher
- Complete the dispatcher for the 'introducer' and 'local' command. This
  is currently only a skeleton.
- The 'introducer list' command is added.
2026-04-27 13:17:03 +02:00
Malte Meiboom c33feb1ee7 First dispatcher
- Create (sub)command structure.
- First experimental dispatcher to start the daemon.
2026-02-22 12:51:05 +01:00
Malte Meiboom 30b1d29274 Start milestone 3
- Add functionality to query online sources (Keyservers, etc) for
  certificates.
- Use introducers to determine which UserIDs should be fetched from
  online soources. Check certifications before importing certifiactes
  into the local cert store.
- start docker image for local end-to-end testing.
2026-01-23 12:57:26 +01:00
Malte Meiboom b7e01a446c Refactoring loading of config file
- let `HuskConfig::load` return a `Result` instead of an `Option`.
- added comments
2026-01-05 12:32:30 +01:00
Malte Meiboom eeda63f5ab Add encryption
- actually encrypt the body of a mail
2025-12-17 11:11:28 +01:00
Malte Meiboom 64312da01d Add tests for is_encrypted()
- add some tests to ensure that is_encrypted() works correctly.
2025-12-16 12:29:14 +01:00
Malte Meiboom 9b41457b8e Check for encryption
- collect body of incoming mail.
- check if incoming mail is already encrypted - dont touch it if it is.
- check if recipients of that mail can encrypt.
2025-12-16 12:04:26 +01:00
Malte Meiboom e56eb8eb9a Add introducers
- add the `Introducer` types
- get introducers from the certificate store (and log them)
2025-12-15 12:27:20 +01:00
Malte Meiboom dd71b89485 Add certificates
- Refactor `Recipient` out of `MailContext`.
- Add lookup of authenticated certificates for recipients.
2025-12-11 16:03:34 +01:00
Malte Meiboom 23c698f445 Start collecting recipients
- Collect recipients for processed email.
- Add proper email parsing
2025-12-11 11:53:55 +01:00
Malte Meiboom cc2dfbfcf1 add missing StoreUpdate 2025-12-10 10:56:09 +01:00
Malte Meiboom 56647806b7 Steps towards encryption
- Added certstore and retrieval of the local trust root.
- Major work on keeping the context between calls to the milter.
- Added a context for an email in processing
- Added Husk specific errors
2025-12-09 12:11:07 +01:00
Malte Meiboom a729a5b626 Add anyhow and configurable TcpListener
- add anyhow to Cargo.toml
- make the connection parameter (for the TcpListener) configurable
2025-11-12 12:10:03 +01:00
malte d843c08425 Initial commit
- rough filestructure
- first simplistic daemon
2025-11-06 11:38:20 +01:00