Commit Graph

30 Commits

Author SHA1 Message Date
Neal H. Walfield dfbb4ec553 Create symbolic links atomically.
- When creating a symbolic link and the link already exists, do it
    atomically.  This prevents two problems. 1) If we fail between
    deleting the old link and creating the new link, then we have
    nothing.  2) If a reader accesses the link between unlinking the
    old version and creating the new version, it sees nothing.
2019-02-22 20:49:23 +01:00
Neal H. Walfield eb71b8a655 Add tests for conflicting email addresses.
- Make sure things work as expected when there are multiple keys
    with the same email address.

  - Make sure things work as expected when a key has multiple user ids
    with the same email address.
2019-02-22 20:43:42 +01:00
Leon Tan c55b61bd31 Store data ascii armored on file, second try 2019-02-22 16:23:49 +01:00
Justus Winter 36c06e036a
Shorten fingerprint to fpr in the Filesystem db.
- This keeps relative links below 60 bytes, allowing ext4 to store
    the link in the inode itself.
2019-02-22 16:17:20 +01:00
Justus Winter 9e4926fcc9
Use relative links.
- In order to store the links in the inodes, we need to make sure
    that they are short.  The first step is to use relative links.
2019-02-22 16:17:20 +01:00
Neal H. Walfield 0f4953cda0 Revert "Store data ascii armored on file"
This reverts commit e7901c493b.
2019-02-22 14:42:59 +01:00
Leon Tan e7901c493b Store data ascii armored on file 2019-02-22 13:34:42 +01:00
Kai Michaelis 921ca1bf9e fix fs::unlink_* 2019-02-22 13:12:59 +01:00
Neal H. Walfield 4f36a344ce Rename Database::compare_and_swap to update.
- Database::compare_and_swap is not actually a CAS.  Rename to
    update, which is what it actually does, and update callers.
2019-02-22 13:03:38 +01:00
Neal H. Walfield e240a0bac6 Change Database::compare_and_swap to atomically replace the target
- Currently, the file system code writes the data to a temp file,
    removes the target file, and then renames the temp file to the
    target file.

  - This has two problems.  1.) If the rename fails, then the old
    version is also gone.  2.) A reader (e.g., NGINX) will return a
    404 after the old file has been removed, but before the file has
    been renamed.

  - Since tmp.persist() atomically replaces the target file, there is
    no need to remove the file.
2019-02-22 13:03:38 +01:00
Justus Winter c8666f2ab6
Avoid TOCTOU issue when creating subdirectories. 2019-02-22 11:57:25 +01:00
Justus Winter 588ff9e913
Improve error handling in the Database trait.
- Fixes #40.
2019-02-22 01:13:20 +01:00
Justus Winter 3de0164fd9
Use git-style subdirectories for data files.
- To address scalability concerns, we put data files into
    subdirectories by splitting e.g. the fingerprint into a two
    character prefix and the rest, using the prefix as subdirectory
    name, and the rest as filename.

  - We hide this fact from the user using rewrite rules in nginx.

  - Fixes #38.
2019-02-22 00:37:45 +01:00
Justus Winter b3fa38f069
Introduce an abstraction for the paths. 2019-02-22 00:37:45 +01:00
Kai Michaelis e0a081470b test correct UID linking if new keys are uploaded.
Closes #26
2019-02-08 15:46:05 +01:00
Kai Michaelis 563aaa8736 carry over verified UIDs on key update 2019-02-08 12:46:31 +01:00
Kai Michaelis 53719c2166 use rustfmt to format source 2019-02-08 12:46:31 +01:00
Kai Michaelis c503e52204 don't allow fetch by revoked UIDs
closes #15
2019-01-15 17:00:53 +01:00
Kai Michaelis 7e240126cf make keys group readable 2019-01-04 14:20:48 +01:00
Kai Michaelis 6d3ccd9762 allow lookup by keyid and subkey fpr 2019-01-04 14:08:07 +01:00
Nico Weichbrodt f255de892a Fix openpgp references in the code 2018-11-25 14:03:27 +00:00
seu 66caaf4074 rename to hagrid 2018-11-22 16:41:33 +01:00
seu 49f15fd5e0 Move paths around.
Server new accepts
  /
  /vks/{verify,confirm,delete}
  /pks/{add,lookup}
2018-11-02 11:48:02 +01:00
seu b189bcf127 fix warnings when compiling tests 2018-10-25 17:42:02 +02:00
seu d4fd651ff1 rename public to static 2018-10-25 17:38:16 +02:00
seu 7844c81774 use uuencode for userids and hex for fprs 2018-10-24 19:45:11 +02:00
seu acab286a66 port to new sequoia API 2018-10-18 13:06:39 +02:00
seu 2013eb21bf fix dir traversal vuln 2018-09-19 22:23:39 +02:00
seu 6070c58bd0 Add polymorphic database 2018-09-19 22:22:59 +02:00
seu 66fef4a275 initial commit 2018-08-16 20:35:19 +02:00