summaryrefslogtreecommitdiff
path: root/src/share/mh/set_expire
blob: 9889e76e62bb28391bd83d3de0c654f9a853550e (plain)
  1. # -*-shell-script-*-
  2. # This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
  3. # Monkeysphere host set-expire subcommand
  4. #
  5. # This is a function to set the expiration date of the monkeysphere
  6. # host key.
  7. #
  8. # The monkeysphere scripts are written by:
  9. # Jameson Rollins <jrollins@finestructure.net>
  10. # Jamie McClelland <jm@mayfirst.org>
  11. # Daniel Kahn Gillmor <dkg@fifthhorseman.net>
  12. #
  13. # They are Copyright 2008-2009, and are all released under the GPL,
  14. # version 3 or later.
  15. set_expire() {
  16. local extendTo
  17. # get the new expiration date
  18. extendTo=$(get_gpg_expiration "$1")
  19. if [ "$PROMPT" = "true" ] ; then
  20. printf "Are you sure you want to change the expiration on the host key to '%s'? (Y/n) " "$extendTo" >&2
  21. read OK; OK=${OK:-Y}
  22. if [ "${OK/y/Y}" != 'Y' ] ; then
  23. failure "expiration not set."
  24. fi
  25. else
  26. log debug "extending without prompting."
  27. fi
  28. log info "setting host key expiration to ${extendTo}."
  29. log debug "executing host expire script..."
  30. gpg_host_edit expire <<EOF
  31. $extendTo
  32. save
  33. EOF
  34. update_gpg_pub_file
  35. log info <<EOF
  36. NOTE: Host key expiration date adjusted, but not yet published.
  37. Run '$PGRM publish-key' to publish the new expiration date.
  38. EOF
  39. }