Discussion:
[Sks-devel] python scripts/other tools you may find useful
brent s.
2018-04-16 05:22:13 UTC
Permalink
Hey, all!

For starters, if any of you happen to be on Arch, I've packaged[0] a
patched version of SKS that will let you provide dumps of your database
from the same box you serve keys from with no downtime. (All it is is a
version of SKS with some filesystem paths changed and a
differently-named binary tied to those paths. You'd peer this to your
other instance - obviously they'll need to run on different ports - so
it stays in sync, and then you can stop that localized instance to dump
keys etc.)

Secondly, I'm not sure if I mentioned this before, but I have an SKS
dump wrapper script in python:

https://git.square-r00t.net/OpTools/tree/gpg/sksdump.py

It has some nice features like being able to perform the dump on one box
and rsync to another, service handling, compression support, and even
pruning of dumps older than X days.

Similarly, I also have a script that will let you query a keyserver's
statistics on the commandline:

https://git.square-r00t.net/OpTools/tree/gpg/keystats.py

I find it a lot faster to use than browsing to a keyserver's keystats
page. Plus it has some nice features like being able to use it for a
module for another python program (since it's classed), JSON output or
YAML output (the default is "pythonic" output), etc.

[***@cylon gpg]$ ./keystats.py sks.mirror.square-r00t.net
{'keys': 5036849,
'server': {'contact': '0x748231EBCBD808A14F5E85D28C004C2F93481F6B',
'debug': 3,
'hkp_port': 11371,
'hostname': 'mirror.square-r00t.net',
'name': 'sks.mirror.square-r00t.net',
'recon_port': 11370,
'version': ('1', '1', '6')}}

[***@cylon gpg]$ ./keystats.py --yaml sks.mirror.square-r00t.net
keys: 5036849
server:
contact: 0x748231EBCBD808A14F5E85D28C004C2F93481F6B
debug: 3
hkp_port: 11371
hostname: mirror.square-r00t.net
name: sks.mirror.square-r00t.net
recon_port: 11370
version:
- 1
- 1
- 6

[***@cylon gpg]$ ./keystats.py --json sks.mirror.square-r00t.net
{"server": {"name": "sks.mirror.square-r00t.net", "hostname":
"mirror.square-r00t.net", "version": ["1", "1", "6"], "contact":
"0x748231EBCBD808A14F5E85D28C004C2F93481F6B", "hkp_port": 11371,
"recon_port": 11370, "debug": 3}, "keys": 5036849}

(There's a "verbose" mode that will print all peers and key histograms
as well.)

Hope you find use for these!


[0] https://aur.archlinux.org/packages/sks-local/
--
brent saner
https://square-r00t.net/
GPG info: https://square-r00t.net/gpg-info
Loading...