Commit graph

554 commits

Author SHA1 Message Date
7fe52ae8b5 Don't pass table definition to KeyConfirmationQueue 2023-11-25 15:02:48 +01:00
1ad0d2df0e Implement lacre.admin CLI tool 2023-11-25 14:07:10 +01:00
becb39f139 Clean up database access
- Don't pass table definitions to repository constructors.

- Keep an internal reference to Engine in lacre.repository.

- Implement KeyConfirmationQueue.count_keys.
2023-11-25 14:04:32 +01:00
4950e0b9c3 Keep secondary keyring for test purposes 2023-11-25 01:13:43 +01:00
acd33fec1e Fix inheritance issues
- Use accessor methods.
- Avoid data duplication.
2023-11-25 01:11:44 +01:00
72217e38ea GnuPG module: make key-listing more thorough
- Flush key-collecting structures each time a new public key entry is found.
  This will avoid adding sub-keys and overwriting main keys with them.

- Use parseaddr from email.utils to parse emails (and drop realname part).

- Record logs produced during unit tests.

- Fix a small bug in test code.

Also: add basic information about available test identities to testing
documentation.
2023-11-25 01:08:15 +01:00
7c2d32bf3c Make IdentityRepository a KeyRing
- Keep only one class to provide access to identities stored in the database.

- Remove old code and its tests.

- Align KeyRing and IdentityRepository APIs.

- Implement a (very) simple unit test for IdentityRepository.
2023-11-24 22:59:21 +01:00
5efef3c9cb Fix table name, unify metadata handling 2023-11-20 22:27:35 +01:00
89affde0d5 Add tests for GnuPG parsing routines 2023-11-20 22:11:37 +01:00
bfa2643dc7 Implement identity repository
Also: rename key_id to fingerprint.
2023-11-20 22:11:25 +01:00
56da7e0cb4 Refactor calculating execution time
- Implement a context manager logging execution time.
- Use that context manager in daemon's handle_DATA method.
2023-11-20 22:03:59 +01:00
4fbae908d6 Don't require less-than and greater-than around the email
Keys don't have to be surrounded with less-than and greater-than characters,
so this code could mishandle valid keys.
2023-11-19 22:45:08 +01:00
c6b2dbf618 Add docs, improve logging 2023-11-17 22:55:37 +01:00
7ac928af76 Handle gpg-mailgate.py missing params better 2023-11-17 22:51:09 +01:00
a3eb892df9 Remove duplicate logger initialisation 2023-11-15 20:25:42 +01:00
2edd842f90 Use lacre.dbschema definition of identities table 2023-11-12 20:20:38 +01:00
6ca5db2db3 Issue an INFO log entry after configuring logging
Also: reformat with spaces instead of tabs.
2023-11-12 19:57:12 +01:00
9bbc86bc53 Extract parts of cron script to modules
Introduce new Python modules:

- lacre.notify -- to send notifications from the cron script;

- lacre.dbschema -- to keep database schema definition as code (SQLAlchemy);

- lacre.repositories -- to define key and identity repositories with high
  level APIs that we can then use elsewhere.

Also:

- rework GnuPG.add_key to return fingerprint so we can use it in the cron
  script;

- rename cron-job's logger name, replacing dash with an underscore as logging
  module doesn't like dashes.
2023-11-12 19:56:45 +01:00
bf677585be Don't require watchdog anymore 2023-11-01 21:26:42 +01:00
5e108c189a Replace file-based identity store with a dedicated db table 2023-10-29 19:39:08 +01:00
02edb4cc96 Validate keyring type config parameter on daemon startup 2023-10-27 23:53:17 +02:00
3dd6913599 Initialise db connection lazily, use isolated asyncio test case 2023-10-23 22:44:53 +02:00
e5339d264c Improve asyncio usage 2023-10-23 22:35:27 +02:00
43f43a4137 Fix DatabaseKeyring tests 2023-10-23 20:26:23 +02:00
41442e5b59 Add basic support for RDBMS-based keyring 2023-09-30 22:38:33 +02:00
274bfbaf3b Always use 'python' binary during tests 2023-09-30 22:33:49 +02:00
c570bcd383 Update Alice's key expiry date 2023-09-25 19:44:37 +02:00
624a335a41 GnuPG: clean up and collect more diagnostic info
- Use regular expressions instead of finding particular characters in gnupg
  output to decide whether confirmation line was found.

- Use tempfile.mkdtemp to create secure temporary directories.

- Record information about the key considered by GnuPG. When missing in
  exception, it means no key was found.
2023-09-21 20:21:01 +02:00
6c114b6dcd Ensure correct logging initialisation in webgate-cron 2023-09-21 20:21:01 +02:00
fccabc083c Fix unencrypted delivery arguments
When falling back to unencrypted mail delivery, do not pass sender information
to SendFrom.call method.
2023-09-21 20:21:01 +02:00
pfm
401f67844a Merge pull request 'Refresh docs' (#128) from 126-refresh-docs into main
Reviewed-on: #128
2023-07-08 13:40:42 +00:00
cfbb413e7e Explicitly mention requirements.txt file 2023-07-08 02:03:20 +02:00
adcafb30c3 Reorder and simplify first secions of README 2023-07-08 02:02:47 +02:00
f0d4447f4a Move requirements to INSTALL, improve language 2023-06-25 22:41:13 +02:00
addb119b3e Update INSTALL.md
- Explain requirements files are used now.
- Mention recommended Python version.
- Refresh instructions after splitting Lacre into components.
2023-06-25 22:31:34 +02:00
bcd0284eac Update README
- Simplify where possible.
- Remove outdated parts.
- Explain that only Python 3.9 is tested and supported.
- Link to Lacre Webgate repository.
2023-06-18 21:31:47 +02:00
pfm
c8f6743768 Merge pull request 'Handle missing Content-Type properly' (#125) from 124-missing-ct into main
Reviewed-on: #125
2023-05-19 18:38:17 +00:00
a30b5e7577 Handle missing Content-Type properly
- ContentManager sets default Content-Type even if it was missing in the
  original message.

- Make sure that when Content-Type is missing, copying parameters doesn't
  raise an error.

- Add a unit-test to check that.
2023-05-19 20:30:00 +02:00
pfm
07fb8d6ae8 Merge pull request 'Fix encoding issues' (#123) from post-test-fixes into main
Reviewed-on: #123
2023-05-11 20:22:23 +00:00
5a5b6c27a4 Fix tests after rebase 2023-05-08 22:32:19 +02:00
3297bbfcca Clean up and document Advanced Mail Filter E2E test
- Remove unused code.
- Add docstrings.
2023-05-08 22:17:02 +02:00
b3c0235486 Make case-discovery code cleaner and more flexible 2023-05-08 22:17:02 +02:00
0cdbf5ba7d Add emoji test 2023-05-08 22:17:02 +02:00
c08d66ac80 Migrate daemon E2E tests to unittest framework 2023-05-08 22:17:02 +02:00
518b823b5c Fix simple filter: pass policy to as_bytes()
Also: adjust expected test output because it's now Base64-encoded.
2023-05-08 22:17:02 +02:00
459779bea6 Add more test cases 2023-05-08 22:17:02 +02:00
61cf50effe Fix MIME content sub-type handling for non-plain text messages 2023-05-08 22:17:02 +02:00
bc92d7a31c [e2e_test] Identify test cases by iteracting config sections 2023-05-08 22:17:02 +02:00
da0ffb4a51 Add a test message with Emoji 2023-05-08 22:17:02 +02:00
34e8b6a4eb Move the last key-related function to keyring module 2023-05-08 22:17:02 +02:00