turn subcommands into subfunctions, that will need to be sourced and executed.
[monkeysphere.git] / src / subcommands / mh / extend-key
1 #!/usr/bin/env bash
2
3 # Monkeysphere host extend-key subcommand
4 #
5 # The monkeysphere scripts are written by:
6 # Jameson Rollins <jrollins@fifthhorseman.net>
7 # Jamie McClelland <jm@mayfirst.org>
8 # Daniel Kahn Gillmor <dkg@fifthhorseman.net>
9 #
10 # They are Copyright 2008, and are all released under the GPL, version 3
11 # or later.
12
13 # extend the lifetime of a host key:
14
15 extend_key() {
16
17 local fpr=$(fingerprint_server_key)
18 local extendTo="$1"
19
20 # get the new expiration date
21 extendTo=$(get_gpg_expiration "$extendTo")
22
23 gpg_host --quiet --command-fd 0 --edit-key "$fpr" <<EOF 
24 expire
25 $extendTo
26 save
27 EOF
28
29 echo
30 echo "NOTE: Host key expiration date adjusted, but not yet published."
31 echo "Run '$PGRM publish-key' to publish the new expiration date."
32
33 }