Commit Graph

520 Commits

Author SHA1 Message Date
Piotr F. Mieszkowski abaf8820d7 lacre.admin: Add -r / --reload option to import command
With -r option, import command will first remove all identities and then load
them again from pubring.kbx.
2023-12-05 21:49:23 +01:00
Piotr F. Mieszkowski 94d0a62766 Identity removal: execute prepared DELETE 2023-12-05 21:33:19 +01:00
Piotr F. Mieszkowski cc1bacbe3d Move some imports to lacre.notify 2023-12-05 21:13:02 +01:00
pfm 4c603839b5 Merge pull request 'lacre.repositories: Fix IdentityRepository existence predicate' (#133) from 132-fix-repo-upsert into main
Reviewed-on: #133
2023-12-04 21:59:00 +00:00
Piotr F. Mieszkowski 0d852bc279 lacre.repositories: Fix IdentityRepository existence predicate 2023-12-04 22:57:43 +01:00
pfm b7713207ab Merge pull request 'Fix unencrypted delivery and key removal' (#130) from 129-key-removal into main
Reviewed-on: #130
2023-12-02 20:59:13 +00:00
Piotr F. Mieszkowski ac5dddfa98 Remove configuration options no longer used 2023-12-02 21:48:17 +01:00
Piotr F. Mieszkowski 052551072e Change table prefix from 'gpgmw' to 'lacre' 2023-12-02 20:02:59 +01:00
Piotr F. Mieszkowski 0975ce3a69 lacre.admin: Handle database exceptions 2023-11-26 19:52:58 +01:00
Piotr F. Mieszkowski b44bd7b150 lacre.admin: Implement identity import, fix identity list
- Let the user specify a directory, using the one from configuration by
  default.

- If user requested identity list without a specific email, list all.  Drop
  support for '-a' option.
2023-11-26 18:30:25 +01:00
Piotr F. Mieszkowski 0fe5e6b3dc Make GnuPG.public_keys docstring more complete 2023-11-26 18:29:43 +01:00
Piotr F. Mieszkowski aa8c353a05 Replace NBSP in doc/admin.md with a regular space 2023-11-26 18:29:09 +01:00
Piotr F. Mieszkowski 97c4f9f14a lacre.repositories: Fix naming after refactoring 2023-11-25 16:09:23 +01:00
Piotr F. Mieszkowski 626fce5f2c lacre.admin: Implement 'identities' sub-command 2023-11-25 16:08:54 +01:00
Piotr F. Mieszkowski 95c5802c38 Add test/lacre.db to gitignore 2023-11-25 15:09:00 +01:00
Piotr F. Mieszkowski 9b5c43b769 Fix crontest config, polish Makefile 2023-11-25 15:05:27 +01:00
Piotr F. Mieszkowski 7fe52ae8b5 Don't pass table definition to KeyConfirmationQueue 2023-11-25 15:02:48 +01:00
Piotr F. Mieszkowski 1ad0d2df0e Implement lacre.admin CLI tool 2023-11-25 14:07:10 +01:00
Piotr F. Mieszkowski 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
Piotr F. Mieszkowski 4950e0b9c3 Keep secondary keyring for test purposes 2023-11-25 01:13:43 +01:00
Piotr F. Mieszkowski acd33fec1e Fix inheritance issues
- Use accessor methods.
- Avoid data duplication.
2023-11-25 01:11:44 +01:00
Piotr F. Mieszkowski 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
Piotr F. Mieszkowski 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
Piotr F. Mieszkowski 5efef3c9cb Fix table name, unify metadata handling 2023-11-20 22:27:35 +01:00
Piotr F. Mieszkowski 89affde0d5 Add tests for GnuPG parsing routines 2023-11-20 22:11:37 +01:00
Piotr F. Mieszkowski bfa2643dc7 Implement identity repository
Also: rename key_id to fingerprint.
2023-11-20 22:11:25 +01:00
Piotr F. Mieszkowski 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
Piotr F. Mieszkowski 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
Piotr F. Mieszkowski c6b2dbf618 Add docs, improve logging 2023-11-17 22:55:37 +01:00
Piotr F. Mieszkowski 7ac928af76 Handle gpg-mailgate.py missing params better 2023-11-17 22:51:09 +01:00
Piotr F. Mieszkowski a3eb892df9 Remove duplicate logger initialisation 2023-11-15 20:25:42 +01:00
Piotr F. Mieszkowski 2edd842f90 Use lacre.dbschema definition of identities table 2023-11-12 20:20:38 +01:00
Piotr F. Mieszkowski 6ca5db2db3 Issue an INFO log entry after configuring logging
Also: reformat with spaces instead of tabs.
2023-11-12 19:57:12 +01:00
Piotr F. Mieszkowski 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
Piotr F. Mieszkowski bf677585be Don't require watchdog anymore 2023-11-01 21:26:42 +01:00
Piotr F. Mieszkowski 5e108c189a Replace file-based identity store with a dedicated db table 2023-10-29 19:39:08 +01:00
Piotr F. Mieszkowski 02edb4cc96 Validate keyring type config parameter on daemon startup 2023-10-27 23:53:17 +02:00
Piotr F. Mieszkowski 3dd6913599 Initialise db connection lazily, use isolated asyncio test case 2023-10-23 22:44:53 +02:00
Piotr F. Mieszkowski e5339d264c Improve asyncio usage 2023-10-23 22:35:27 +02:00
Piotr F. Mieszkowski 43f43a4137 Fix DatabaseKeyring tests 2023-10-23 20:26:23 +02:00
Piotr F. Mieszkowski 41442e5b59 Add basic support for RDBMS-based keyring 2023-09-30 22:38:33 +02:00
Piotr F. Mieszkowski 274bfbaf3b Always use 'python' binary during tests 2023-09-30 22:33:49 +02:00
Piotr F. Mieszkowski c570bcd383 Update Alice's key expiry date 2023-09-25 19:44:37 +02:00
Piotr F. Mieszkowski 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
Piotr F. Mieszkowski 6c114b6dcd Ensure correct logging initialisation in webgate-cron 2023-09-21 20:21:01 +02:00
Piotr F. Mieszkowski 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
Piotr F. Mieszkowski cfbb413e7e Explicitly mention requirements.txt file 2023-07-08 02:03:20 +02:00
Piotr F. Mieszkowski adcafb30c3 Reorder and simplify first secions of README 2023-07-08 02:02:47 +02:00
Piotr F. Mieszkowski f0d4447f4a Move requirements to INSTALL, improve language 2023-06-25 22:41:13 +02:00