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