]> the.earth.li Git - onak.git/log
onak.git
7 years ago0.5.0 release onak-0.5.0
Jonathan McDowell [Sun, 28 Aug 2016 15:26:17 +0000 (16:26 +0100)]
0.5.0 release

Release; update version string in configure.ac, README, Doxyfile.
Update HISTORY and debian/changelog.

7 years agoRelax packet version check
Jonathan McDowell [Tue, 23 Aug 2016 10:54:30 +0000 (11:54 +0100)]
Relax packet version check

The version check on packets was too strict - there are a bunch of
packets that don't have a version (such as the UID). Make these checks
more specific based on the definitions from RFC4800.

(Lesson learned: Do not commit without running the automated tests.)

7 years agoImprove subpacket parsing robustness
Jonathan McDowell [Tue, 23 Aug 2016 08:27:30 +0000 (09:27 +0100)]
Improve subpacket parsing robustness

Although we checked on each round of subpackets that we were still
within the correct length, we weren't checking the subpacket length
itself fit within the remaining data. Fixes some issues found using
American Fuzzy Lop.

7 years agoAdd sanity check for PGP packet version
Jonathan McDowell [Mon, 22 Aug 2016 22:14:24 +0000 (23:14 +0100)]
Add sanity check for PGP packet version

At present only PGP packet versions up to 4 are supported. There's no
indication version 5+ will be backwards compatible, so if we see
anything higher it indicates something unsupported. Fixes some issues
found using American Fuzzy Lop.

7 years agoThrow away invalid packet data when parsing packets
Jonathan McDowell [Mon, 22 Aug 2016 16:35:02 +0000 (17:35 +0100)]
Throw away invalid packet data when parsing packets

We would detect that a packet wasn't correctly formed, and handle
requests to try to allocation too much memory that failed, when parsing
keys. However the old partial packet structure was still left around. If
we hit an error when parsing an incoming packet make sure it's fully
cleaned up.

7 years agoBe more robust when handling unexpected lack of data
Jonathan McDowell [Mon, 22 Aug 2016 16:32:37 +0000 (17:32 +0100)]
Be more robust when handling unexpected lack of data

Make sure we don't assume packets have data (though they should), or
that a key has any uids. Found using American Fuzzy Lop.

7 years agoPrevent sign extension when parsing large packet sizes
Jonathan McDowell [Mon, 22 Aug 2016 16:30:14 +0000 (17:30 +0100)]
Prevent sign extension when parsing large packet sizes

A 2GB+ packet is likely to be a mistake, but in the event it was
legitimate sign extension could result in a much larger amount of
memory being allocated (and probably failing). Fix this by trying
to ensure we're doing an unsigned left shift.

7 years agoInclude - in the permitted characters for the HKP base URL
Jonathan McDowell [Mon, 8 Aug 2016 22:05:18 +0000 (23:05 +0100)]
Include - in the permitted characters for the HKP base URL

- had been missed out as a valid character in the domain name for
the host we forward HKP requests to; add it.

7 years agoAdd logging of the HKP base URL for the HKP forwarding backend
Jonathan McDowell [Mon, 8 Aug 2016 22:04:14 +0000 (23:04 +0100)]
Add logging of the HKP base URL for the HKP forwarding backend

7 years agoAdd cleankey.o to CORE_OBJS
Jonathan McDowell [Mon, 8 Aug 2016 16:35:45 +0000 (17:35 +0100)]
Add cleankey.o to CORE_OBJS

Move cleankey.o from being an extra object to being part of the core
objects; the HKP backend is using it for starters and it so do various
other bits.

7 years agoAdd KEYD_CMD_UPDATE to keyd protocol
Jonathan McDowell [Mon, 4 Jul 2016 08:07:02 +0000 (10:07 +0200)]
Add KEYD_CMD_UPDATE to keyd protocol

When a key was being updated over keyd it would do a delete and then
a store, which ended up being outside a transaction. Add an update
command so that the backend can do the update fully itself.

7 years agoFix errors in onak-mail.pl
Jonathan McDowell [Fri, 10 Jun 2016 07:58:12 +0000 (08:58 +0100)]
Fix errors in onak-mail.pl

The change to the new configuration file format introduced some paper
bag errors in the mail processing script. Fix these, and add a Perl
syntax check into the test target to try and prevent this sort of thing
in future.

7 years agoFix use of keyd backend
Jonathan McDowell [Fri, 10 Jun 2016 07:26:53 +0000 (08:26 +0100)]
Fix use of keyd backend

When keyd is in use any backend configuration is ignored for the clients
and keyd contacted instead. The new config changes failed to correctly
migrate the overriding mechanism for this and as a result nothing was
using keyd.

7 years agoFix compilation breakage with PostgreSQL backend
Jonathan McDowell [Thu, 9 Jun 2016 14:35:09 +0000 (15:35 +0100)]
Fix compilation breakage with PostgreSQL backend

The migration to a specific backend database configuration structure
was incomplete for the PostgreSQL backend, causing compilation failures.

7 years agoRun autoreconf -i to produce configure script for Travis CI builds
Jonathan McDowell [Thu, 9 Jun 2016 14:23:33 +0000 (15:23 +0100)]
Run autoreconf -i to produce configure script for Travis CI builds

7 years agoAdd initial Travis CI configuration for GitHub CI builds
Jonathan McDowell [Thu, 9 Jun 2016 14:20:19 +0000 (15:20 +0100)]
Add initial Travis CI configuration for GitHub CI builds

7 years agoInclude statistics for fetching by SKS hash in "keydctl status"
Jonathan McDowell [Thu, 9 Jun 2016 11:00:50 +0000 (12:00 +0100)]
Include statistics for fetching by SKS hash in "keydctl status"

These statistics were already being collected and passed to keydctl,
but were not being displayed.

7 years agoClean keys before storing them in the stacked backend
Jonathan McDowell [Wed, 8 Jun 2016 22:24:05 +0000 (23:24 +0100)]
Clean keys before storing them in the stacked backend

If we fetch keys from a lower level of the stacked backends then run
the clean functions before trying to store them in the top level.

7 years agoAdd all hardening options for Debian build (in particular for bindnow + pie)
Jonathan McDowell [Wed, 8 Jun 2016 18:10:05 +0000 (19:10 +0100)]
Add all hardening options for Debian build (in particular for bindnow + pie)

7 years agoAdd onak to Provides: in Debian init script rather than just pgp-server
Jonathan McDowell [Wed, 8 Jun 2016 18:08:36 +0000 (19:08 +0100)]
Add onak to Provides: in Debian init script rather than just pgp-server

7 years agoUpdate Debian Vcs URLs to use secure variants
Jonathan McDowell [Wed, 8 Jun 2016 18:07:28 +0000 (19:07 +0100)]
Update Debian Vcs URLs to use secure variants

7 years agoFix up Debian systemd control file to allow non-socket activation
Jonathan McDowell [Wed, 8 Jun 2016 15:25:39 +0000 (16:25 +0100)]
Fix up Debian systemd control file to allow non-socket activation

Rather than relying on socket activation allow keyd to be started on
boot by adding the appropriate stanza to the onak.service file.

7 years agoBump Debian Standards-Version to 3.9.8.0
Jonathan McDowell [Wed, 8 Jun 2016 14:14:15 +0000 (15:14 +0100)]
Bump Debian Standards-Version to 3.9.8.0

No changes.

7 years agoFix use of absolute path in Debian postinst script
Jonathan McDowell [Wed, 8 Jun 2016 14:07:35 +0000 (15:07 +0100)]
Fix use of absolute path in Debian postinst script

The changes to the Debian postinst to update an existing modified
configuration to the new style called onak with a full pathname. This
is contrary to Policy, so drop the path as dpkg should call us with
a sane $PATH.

7 years agoAdd stacked backend
Jonathan McDowell [Wed, 8 Jun 2016 11:35:10 +0000 (12:35 +0100)]
Add stacked backend

This backend takes advantage of the new configuration file flexibility
to enable the stacking of multiple backends together, with each being
tried in turn until the desired keys are found. All stores go to the
first configured backend, and fetches from subsequent backends are
also stored in the first backend.

7 years agoSilence scan-build warning about uninitialised fd_set structure
Jonathan McDowell [Wed, 8 Jun 2016 11:27:41 +0000 (12:27 +0100)]
Silence scan-build warning about uninitialised fd_set structure

This is a false positive by scan-build (as FD_ZERO will initialise the
structure for us), but silence it anyway to achieve a clean run.

7 years agoError out when trying to load a dynamic backend with no configuration
Jonathan McDowell [Tue, 7 Jun 2016 15:28:06 +0000 (16:28 +0100)]
Error out when trying to load a dynamic backend with no configuration

If we don't have a valid onak_db_config when trying to load a backend
in keydb_dynamic, error out right at the start.

7 years agoUpdate Debian packaging to cope with onak.conf -> onak.ini change
Jonathan McDowell [Tue, 7 Jun 2016 15:11:04 +0000 (16:11 +0100)]
Update Debian packaging to cope with onak.conf -> onak.ini change

Use the "onak dumpconfig" utility to provide a smooth upgrade path for
previous versions of onak, and notify the user that the change has taken
place.

7 years agoAdd "dumpconfig" command to onak to aide configuration file migration
Jonathan McDowell [Tue, 7 Jun 2016 12:59:56 +0000 (13:59 +0100)]
Add "dumpconfig" command to onak to aide configuration file migration

onak is capable of parsing both old and new style configuration files,
but future improvements will only be added to the new style. To aide
users in the migration to the new format add a "dumpconfig" option to
the onak binary which will dump the current configuration in new format.

7 years agoAdd getlogthreshold() to obtain current log level setting
Jonathan McDowell [Tue, 7 Jun 2016 12:49:59 +0000 (13:49 +0100)]
Add getlogthreshold() to obtain current log level setting

7 years agoChange config format to a cleaner .ini style
Jonathan McDowell [Tue, 7 Jun 2016 11:23:18 +0000 (12:23 +0100)]
Change config format to a cleaner .ini style

onak's config file format grew from the pksd config style. pksd is long
obsolete and there are a number of features it would be nice to support
in onak which this config format makes hard to support cleanly. Move to
a .ini style config file, with [section] and name=value definitions. The
old format is still supported and at present an old style config is
searched for first to ensure smooth upgrades, but any new config options
will only be supported by the new style.

Additionally add tests against both old + new config styles for all
backends.

7 years agoImprove memory clean-up on exit
Jonathan McDowell [Tue, 7 Jun 2016 10:37:37 +0000 (11:37 +0100)]
Improve memory clean-up on exit

onak + wotsap were failing to free the memory allocated for the config
file name if it was passed on the command line, and the config structure
cleanups failed to free any configured sock_dir or the actual DB
backend config structure. All of this gets cleaned up by normal program
exit (which is when we do our clean-up anyway), but fix it anyway.

7 years agoPass config file name into test scripts
Jonathan McDowell [Tue, 7 Jun 2016 10:09:32 +0000 (11:09 +0100)]
Pass config file name into test scripts

Rather than having each test script hard code the config file that
should be use, have the top level runtests script pass the filename
to use as the config in as a command line parameter.

7 years agoPull config line parsing out to its own function
Jonathan McDowell [Tue, 7 Jun 2016 08:36:33 +0000 (09:36 +0100)]
Pull config line parsing out to its own function

The indentation in the config file reading function is horrible, so
pull the actual parsing of the line out to its own function simplifying
the loop to primarily be about reading each line and trimming white
space.

7 years agoParse pks_bin_dir / mail_dir in the C config handling
Jonathan McDowell [Tue, 7 Jun 2016 07:37:07 +0000 (08:37 +0100)]
Parse pks_bin_dir / mail_dir in the C config handling

pks_bin_dir and mail_dir are only used by the Perl that handles
incoming keyserver email, but parse them in the C code rather than
just ignoring them. This helps pave the way for some config file format
changes and tightening up the parsing to complain about unused options.

7 years agoFix compilation breakage introduced in last commit
Jonathan McDowell [Mon, 6 Jun 2016 22:03:11 +0000 (23:03 +0100)]
Fix compilation breakage introduced in last commit

An unrelated change sneaked in as part of the proper splitting out of
backend database configuration - configuration initialisation for not
yet present config options. Remove them.

7 years agoProperly isolate database backend configuration
Jonathan McDowell [Mon, 6 Jun 2016 20:54:42 +0000 (21:54 +0100)]
Properly isolate database backend configuration

While database backends have had private context for some time they've
all been using the same configuration details from the global config
structure. Create a new DB specific config structure and initialise
a single instance from the config file. Also modify the DB backend
initialise functions to take this config structure as a parameter.
This will allow in the future for multiple different backends (whether
the same type or different) to be included at the same time.

7 years agoSwitch to C99 struct initialisation for default configuration
Jonathan McDowell [Mon, 6 Jun 2016 19:19:17 +0000 (20:19 +0100)]
Switch to C99 struct initialisation for default configuration

Inbound changes to the configuration file handling will change the
config structure around. Switch to using C99 style initialisation, which
is much clearer to read and reduces the risk of assigning values to the
wrong configuration variable.

7 years agoSwitch to using mail_dir for incoming mail lock file
Jonathan McDowell [Sun, 5 Jun 2016 20:28:58 +0000 (21:28 +0100)]
Switch to using mail_dir for incoming mail lock file

Rather than using the db_dir for the lock file to prevent multiple
onak-mail instances processing incoming requests at the same time, use
the mail_dir file where the incoming messages are spooled anyway. This
is cleaner and will cope with the potential for multiple DB backends to
be in play in the future.

8 years agoRemove Ross Burton from Uploaders
Jonathan McDowell [Sun, 17 Jan 2016 14:14:21 +0000 (14:14 +0000)]
Remove Ross Burton from Uploaders

Ross requested to be removed from Uploaders due to a lack of
time/inclination to work on onak maintainership.

8 years ago0.4.6 release onak-0.4.6
Jonathan McDowell [Tue, 25 Aug 2015 15:19:14 +0000 (16:19 +0100)]
0.4.6 release

Release; update version string in configure.ac, README, Doxyfile.
Update HISTORY and debian/changelog.

8 years agoFix stupid sock_dir bug
Jonathan McDowell [Tue, 25 Aug 2015 15:46:30 +0000 (16:46 +0100)]
Fix stupid sock_dir bug

I forgot to actually parse the sock_dir info from the config file. Do
so.

8 years agoSupport --runstatedir with autoconf 2.70+
Jonathan McDowell [Tue, 25 Aug 2015 14:22:24 +0000 (15:22 +0100)]
Support --runstatedir with autoconf 2.70+

Rather than putting our socket in $localstatedir/run use $runstatedir
which is support by the Debian package autoconf 2.69-9 and will be in
autoconf 2.70. Fall back to $localstatedir/run when an older version
of autoconf is used.

8 years agoAdd config option to specify keyd socket directory
Jonathan McDowell [Fri, 21 Aug 2015 10:44:22 +0000 (12:44 +0200)]
Add config option to specify keyd socket directory

keyd was stashing its Unix domain socket in the DB directory, which
is contrary to convention. Add a sock_dir config option and default it
to ${prefix}/var/run in the sample config file.

8 years agoUpdate version.h when source files change
Jonathan McDowell [Thu, 20 Aug 2015 12:22:25 +0000 (14:22 +0200)]
Update version.h when source files change

Make $(SRCS) a Makefile dependency for version.h so once any of the
source files change we can update our version to reflect this fact.

8 years agoUpdate debian/watch file to deal with non-gz compressed tarballs
Jonathan McDowell [Thu, 20 Aug 2015 10:43:01 +0000 (12:43 +0200)]
Update debian/watch file to deal with non-gz compressed tarballs

8 years agoAdd git commit details to non-release builds
Jonathan McDowell [Thu, 20 Aug 2015 10:30:52 +0000 (12:30 +0200)]
Add git commit details to non-release builds

The previous bzr version info is long unused, so replace with
'git describe' to embed the git version status in builds from git.

8 years agoAdd Curve25519 ECC OID details
Jonathan McDowell [Sat, 15 Aug 2015 09:28:31 +0000 (10:28 +0100)]
Add Curve25519 ECC OID details

8 years agoFix keysize for Ed25519 to 255 bits
Jonathan McDowell [Sat, 15 Aug 2015 09:24:58 +0000 (10:24 +0100)]
Fix keysize for Ed25519 to 255 bits

8 years agoAdd support for displaying EDDSA keys
Jonathan McDowell [Sat, 15 Aug 2015 09:23:54 +0000 (10:23 +0100)]
Add support for displaying EDDSA keys

EDDSA is not yet formally defined, but understood by GnuPG 2.1 and
has been seen in the wild. Key size is defined by the OID as for
ECDH/ECDSA keys.

8 years agoAdd de-duplication of subkeys on a key
Jonathan McDowell [Fri, 14 Aug 2015 17:19:15 +0000 (18:19 +0100)]
Add de-duplication of subkeys on a key

GnuPG will incorrectly add a pre-existing subkey that it doesn't
understand (e.g. ECC) to a key. This results in keys with a large
number of identical subkeys. Avoid this by detecting such keys and
de-duplicating the identical subkeys.

(gnupg bug report at https://bugs.gnupg.org/gnupg/issue1962)

8 years agoRe-order linking for backend plugins to cope with ld --as-needed
Jonathan McDowell [Sun, 17 May 2015 20:11:04 +0000 (21:11 +0100)]
Re-order linking for backend plugins to cope with ld --as-needed

The shared libraries for DB4/curl/PostgreSQL should all come after the
object file that uses them so that ld --as-needed can correctly pick up
the required linkage.

Fixes Debian bug #772433

9 years agoAdd additional ECC OIDs
Jonathan McDowell [Thu, 5 Mar 2015 15:27:14 +0000 (15:27 +0000)]
Add additional ECC OIDs

In addition to the 3 NIST curves add Ed25519, the 3 brainpool curves and
secp256k1 (as used in Bitcoin).

9 years agoDon't build-depend on Debian systemd dev packages for non-Linux architectures
Jonathan McDowell [Sun, 5 Oct 2014 13:43:11 +0000 (14:43 +0100)]
Don't build-depend on Debian systemd dev packages for non-Linux architectures

Later versions of systemd aren't build on FreeBSD etc so the Debian build
was failing due to an unmet build-dep on libsystemd-dev; limit this
requirement to Linux archs.

Fixes Debian bug #763924. Thanks to Pino Toscano <pino@debian.org>

9 years ago0.4.5 release onak-0.4.5
Jonathan McDowell [Fri, 3 Oct 2014 16:30:51 +0000 (17:30 +0100)]
0.4.5 release

Release; update version string in configure.ac, README, Doxyfile.
Update HISTORY and debian/changelog.

9 years agoCheck for sd_listen_fds in libsystemd as well as libsystemd-daemon
Jonathan McDowell [Wed, 1 Oct 2014 08:37:56 +0000 (09:37 +0100)]
Check for sd_listen_fds in libsystemd as well as libsystemd-daemon

Upstream systemd has moved the sd_listen_fds function from
libsystemd-daemon into a combined libsystemd. For Debian this change
happens in the 214-1 package. Make the autoconf script look in both
and change the Debian build-deps to look for either suitably
recent libsystemd-dev or fall back to libsystemd-daemon-dev (to aid
backports).

9 years ago0.4.4 release onak-0.4.4
Jonathan McDowell [Tue, 30 Sep 2014 21:38:04 +0000 (22:38 +0100)]
0.4.4 release

Release; update version string in configure.ac, README, Doxyfile.
Update HISTORY and debian/changelog.

9 years agoUse strtouq to parse keyid instead of strtoul
Jonathan McDowell [Tue, 30 Sep 2014 21:34:21 +0000 (22:34 +0100)]
Use strtouq to parse keyid instead of strtoul

The use of strtoul to parse the key ID breaks parsing 64 bit key IDs
on 32 bit platforms. Use strtouq instead, which is defined as returning
a 64 bit rather than being dependant on the length of "unsigned long".

9 years ago0.4.3 release onak-0.4.3
Jonathan McDowell [Tue, 30 Sep 2014 09:10:03 +0000 (10:10 +0100)]
0.4.3 release

Release; update version string in configure.ac, README, Doxyfile.
Update HISTORY and debian/changelog.

9 years agoBump Debian Standards-Version to 3.9.6.0
Jonathan McDowell [Tue, 30 Sep 2014 08:59:35 +0000 (09:59 +0100)]
Bump Debian Standards-Version to 3.9.6.0

No changes.

9 years agoAdd dependency on dh-systemd to Debian packaging
Jonathan McDowell [Tue, 30 Sep 2014 08:52:01 +0000 (09:52 +0100)]
Add dependency on dh-systemd to Debian packaging

9 years agoDon't ignore errors in newly added Debian prerm script
Jonathan McDowell [Tue, 30 Sep 2014 08:51:10 +0000 (09:51 +0100)]
Don't ignore errors in newly added Debian prerm script

9 years agoEnable use of systemd + socket activation support for Debian package
Jonathan McDowell [Mon, 29 Sep 2014 20:57:08 +0000 (21:57 +0100)]
Enable use of systemd + socket activation support for Debian package

Now that onak supports systemd socket activation add the appropriate
systemd service files to enable this on Debian installs. In the longer
term I'd like this to be generic for any distro; patches from people
experienced with them most welcome.

9 years agoAdd keyd support for systemd socket activation
Jonathan McDowell [Tue, 23 Sep 2014 21:41:38 +0000 (22:41 +0100)]
Add keyd support for systemd socket activation

If we have libsystemd-daemon available then enable support for
systemd socket activation of keyd. Even if this support is compiled
in we will fall back to the old behaviour of setting up our own
listening Unix domain socket if systemd is not in use.

9 years agoFix issue with pre-seeding key database on Debian install
Jonathan McDowell [Tue, 23 Sep 2014 15:59:34 +0000 (16:59 +0100)]
Fix issue with pre-seeding key database on Debian install

The test for my key didn't include the .gz file extension, so the
key database wasn't getting created upon initial install.

9 years agoUse generic rule for rebuilding .in files
Jonathan McDowell [Tue, 23 Sep 2014 14:42:44 +0000 (15:42 +0100)]
Use generic rule for rebuilding .in files

Rather than a specific Makefile rule for each .in file use a generic
approach so we can easily add more if necessary.

9 years agoUse common function for command sending in keyd client code
Jonathan McDowell [Tue, 22 Jul 2014 13:48:46 +0000 (14:48 +0100)]
Use common function for command sending in keyd client code

Rather than duplicating the checks for writing ok and getting a non
error response use a common function for sending commands to keyd from
the DB backend client code.

9 years agoGuard max lock setting with error check
Jonathan McDowell [Tue, 22 Jul 2014 12:01:14 +0000 (13:01 +0100)]
Guard max lock setting with error check

We weren't checking for an error before setting the DB4 maxlocks
parameter, which could cause a NULL dereference in the error path.

9 years agoCleanup key array logic to make llvm scan-build happier
Jonathan McDowell [Tue, 22 Jul 2014 11:59:32 +0000 (12:59 +0100)]
Cleanup key array logic to make llvm scan-build happier

We can't have the size != 0 without keys != NULL, but the fact we
checked one at the start and the other later was confusing the static
checks from scan-build. Use size in both places; it keeps scan-build
happy and make the code a little easier to read.

9 years agoFix keyd memory leak on error reading client provided search text
Jonathan McDowell [Tue, 22 Jul 2014 11:53:40 +0000 (12:53 +0100)]
Fix keyd memory leak on error reading client provided search text

9 years agoBail out if we can't change to the DB directory for the FS backend
Jonathan McDowell [Tue, 22 Jul 2014 11:42:35 +0000 (12:42 +0100)]
Bail out if we can't change to the DB directory for the FS backend

9 years agoBail out if we get errors reading the config file
Jonathan McDowell [Tue, 22 Jul 2014 11:38:33 +0000 (12:38 +0100)]
Bail out if we get errors reading the config file

10 years agoMake keyd more robust in the face of socket errors
Jonathan McDowell [Mon, 6 Jan 2014 19:48:59 +0000 (11:48 -0800)]
Make keyd more robust in the face of socket errors

We were mostly ignoring errors back from reads or writes to the keyd
socket. Check that we've read/written as many bytes as we expect and
pull some of this out to common functions for sending keys/replies.

10 years agoMake keyd internal functions static
Jonathan McDowell [Mon, 6 Jan 2014 19:02:37 +0000 (11:02 -0800)]
Make keyd internal functions static

Nothing else links to keyd.o, but these functions are internal so mark
them static.

10 years agoAdd error checking when trying to daemonize in keyd
Jonathan McDowell [Mon, 6 Jan 2014 18:58:11 +0000 (10:58 -0800)]
Add error checking when trying to daemonize in keyd

We weren't checking the return from freopen, which causes warnings when
compiling with -D_FORTIFY_SOURCE=2. Do so, and also for the setsid().

10 years agoCheck return value when writing PID to DB4 upgrade lock file
Jonathan McDowell [Sun, 5 Jan 2014 17:50:55 +0000 (17:50 +0000)]
Check return value when writing PID to DB4 upgrade lock file

When writing our PID to the lock file for upgrading the DB4 version
we didn't check it was actually successful. This doesn't matter in
general (because it's the existence or not of the file we care about)
but catch it and error out appropriate anyway.

10 years agoFix issue with looking up keys by fingerprint via HKP interface
Jonathan McDowell [Sun, 5 Jan 2014 17:44:47 +0000 (09:44 -0800)]
Fix issue with looking up keys by fingerprint via HKP interface

The index variable for the current parameter was being reused to parse
the fingerprint, resulting in attempting to free an unallocated piece of
memory and crashing. Use a different loop variable instead.

10 years agoAdd a reindex command to the onak tool
Jonathan McDowell [Tue, 24 Dec 2013 17:28:04 +0000 (17:28 +0000)]
Add a reindex command to the onak tool

With the changes to the backends to store keys using the full fingerprints
it can be useful to force a key to be re-indexed and thus transitioned to
a fingerprint rather than 64 bit key id index. Ideally we'd want to be
able to do this across the entire backend, but that's a bit heavyweight for
a full keyserver so add the ability to do it for a single key to start with.

10 years agoCheck that signature data lengths do not exceed the available data
Jonathan McDowell [Thu, 28 Nov 2013 21:30:06 +0000 (13:30 -0800)]
Check that signature data lengths do not exceed the available data

Some signatures have been witnessed on the keyserver network where the
hashed data lengths reported exceed the size of the overall packet. It
is assumed these are the results of some corruption somewhere, so if
they're detected don't try to parse any further (and drop them if we're
doing signature checking).

10 years agoDon't end an existing transaction if trying to delete a non-existent key
Jonathan McDowell [Wed, 20 Nov 2013 02:44:39 +0000 (18:44 -0800)]
Don't end an existing transaction if trying to delete a non-existent key

The DB4 key deletion routine would always exit the current transaction
if the key wasn't found, even if it had been called by another function
which had entered the transaction. Only do so if the deletion routine
itself is what caused the transaction to be started.

10 years agoAnother deletion fix of 64 bit keys in DB4 backend
Jonathan McDowell [Tue, 19 Nov 2013 05:44:46 +0000 (21:44 -0800)]
Another deletion fix of 64 bit keys in DB4 backend

We weren't deleting the actual key data when a key had been correctly
stored using its fingerprint.

10 years agoCode cleanups
Jonathan McDowell [Tue, 19 Nov 2013 05:34:48 +0000 (21:34 -0800)]
Code cleanups

Unused return values + unnecessary setting of variable.

10 years agoFix deletion of 64 bit keys in DB4 backend
Jonathan McDowell [Thu, 14 Nov 2013 05:39:14 +0000 (21:39 -0800)]
Fix deletion of 64 bit keys in DB4 backend

We were using the cursor from the id32db instead of the one for the
id64db.

10 years agoUse fingerprints as key index in DB4 backend
Jonathan McDowell [Wed, 13 Nov 2013 03:10:49 +0000 (19:10 -0800)]
Use fingerprints as key index in DB4 backend

Up until now the DB4 backend has used the 64 bit key ID as the index
into the key database. The fingerprint has always been a better idea
and it's easy to create a v3 key that causes a collision, so switch to
using the fingerprint in the DB4 backend.

These changes to not require an upgrade to an existing DB4 setup; keys
will get transitioned to the new storage method as they are updated in
the keyserver.

10 years agoAdd some more subpacket types to key decoder
Jonathan McDowell [Tue, 12 Nov 2013 05:46:16 +0000 (21:46 -0800)]
Add some more subpacket types to key decoder

Observed in keys sent to the keyserver and taken from either RFC 4880
or the source of various older PGP implementations. Some of these are
legacy but we can identify and ignore them.

10 years agoSwitch keysubkeys to returning an array of fingerprints instead of IDs
Jonathan McDowell [Sun, 10 Nov 2013 04:14:26 +0000 (20:14 -0800)]
Switch keysubkeys to returning an array of fingerprints instead of IDs

No functional change at present because the users only currently use the
64 bit key ID, so add a helper function fingerprint2keyid as well (which
only works for v4 keys, but v3 keys can't have subkeys).

10 years agoFix subkey retrieval with fs backend
Jonathan McDowell [Sun, 10 Nov 2013 01:21:42 +0000 (17:21 -0800)]
Fix subkey retrieval with fs backend

Fix retrieving keys by the 64 bit key id from one of their subkeys.

10 years agoAdd tests for retrieving by sub key ID
Jonathan McDowell [Sun, 10 Nov 2013 00:16:00 +0000 (16:16 -0800)]
Add tests for retrieving by sub key ID

2 tests for retrieving a key by a short 32 bit key id of a subkey and
the full 64 bit sub key id.

10 years agoIntroduce and use a structure to hold OpenPGP fingerprints
Jonathan McDowell [Sat, 9 Nov 2013 20:29:15 +0000 (12:29 -0800)]
Introduce and use a structure to hold OpenPGP fingerprints

Fingerprint lengths can be 16 bytes (for v3 keys) or 20 bytes (for v4
keys). Rather than passing around a size and fingerprint buffer separately
use a structure to hold both pieces of information and just pass that
around.

10 years agoUse full key id in key id retrieval test + add separate short key id test
Jonathan McDowell [Sat, 9 Nov 2013 19:17:21 +0000 (11:17 -0800)]
Use full key id in key id retrieval test + add separate short key id test

10 years agoFix issues found by llvm scan-build static analysis
Jonathan McDowell [Sat, 9 Nov 2013 16:34:08 +0000 (08:34 -0800)]
Fix issues found by llvm scan-build static analysis

A mixture of fixes: some variables set but never used (fix by either
removing or correctly checking error codes), some unlikely but possible
memory leaks, some invalid casting.

10 years agoUse dynamic context for all backend databases
Jonathan McDowell [Sat, 9 Nov 2013 07:02:45 +0000 (23:02 -0800)]
Use dynamic context for all backend databases

Rather than defining a static set of database functions use a well
known initialisation function for each database backend that then
returns a database context structure. This structure contains function
pointers for all of the functions previously held in dbstructs as well
as a private instance context pointer.

For the moment this doesn't provide any change to behaviour, but it
provides the initial preparation for allowing multiple database instance
(whether of the same or differing types) to be used at the same time.

10 years agoSkip signature hash verification for X509 signatures
Jonathan McDowell [Tue, 5 Nov 2013 05:57:49 +0000 (21:57 -0800)]
Skip signature hash verification for X509 signatures

X509 signatures don't have a valid hash checksum and can't be easily
verified without full X509 support. Skip them in check_packet_sighash
entirely.

10 years agoAdd SHA1x hash support
Jonathan McDowell [Tue, 5 Nov 2013 04:52:38 +0000 (20:52 -0800)]
Add SHA1x hash support

A hash variant that uses 8 SHA-1 instances and results in a double width
hash (320 bits instead of SHA-1's 160 bits). This was used in older
versions of PGP and there are quite a few keys on the keyservers with
signatures using it. Added mainly to enable the sig hash checking
routine to do some sanity checking on these signatures.

10 years agoRemove DB2 backend
Jonathan McDowell [Tue, 5 Nov 2013 03:13:39 +0000 (19:13 -0800)]
Remove DB2 backend

This was originally for pulling keys from an old pksd keyserver setup.
The code has bit-rotted and no one should have been running pksd for
years now, so just remove the backend entirely. DB4 has been the best
choice for onak backend for some time now.

10 years agoRemove trailing newline on sigcheck debug output
Jonathan McDowell [Tue, 5 Nov 2013 03:05:20 +0000 (19:05 -0800)]
Remove trailing newline on sigcheck debug output

10 years agoChange SHA_DIGEST_LENGTH to SHA1_DIGEST_SIZE to match nettle
Jonathan McDowell [Tue, 5 Nov 2013 03:04:51 +0000 (19:04 -0800)]
Change SHA_DIGEST_LENGTH to SHA1_DIGEST_SIZE to match nettle

10 years agoExtend database backends to support fetching by key fingerprint
Jonathan McDowell [Tue, 5 Nov 2013 00:56:31 +0000 (16:56 -0800)]
Extend database backends to support fetching by key fingerprint

Up until now the database backends have supported fetching a specific
key only by 64 bit key id. We should really have been using the
fingerprint where possible. Add a new backend function, fetch_key_fp,
to allow us to fetch using the fingerprint, and a generic implementation
that just truncates the fingerprint to get the 64 bit key id (valid for
v4 only). The HKP, keyd and dynamic backends gain full passthrough
support for retrieval by fingerprint with this commit.

10 years agoAdd support for displaying ECDH/ECDSA key sizes
Jonathan McDowell [Mon, 4 Nov 2013 07:09:12 +0000 (23:09 -0800)]
Add support for displaying ECDH/ECDSA key sizes

The key size of an elliptic curve key is given by the OID defining the
curve. Add support for understanding the OIDs listed in RFC6637 (256,
384 + 521 bits).

10 years agoAdd support for displaying EC/ECDSA key types
Jonathan McDowell [Mon, 4 Nov 2013 00:41:13 +0000 (16:41 -0800)]
Add support for displaying EC/ECDSA key types

Switch to a common pkalgo to char function and include the EC/ECDSA
key types (e/E) in it.