summaryrefslogtreecommitdiff
path: root/src/share/mh/set_expire
blob: 14d2501b6928d5a87f33989cfb3825be2b3bf53f (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. read -p "Are you sure you want to change the expiration on the host key to '$extendTo'? (y/N) " OK; OK=${OK:-N}
  21. if [ "${OK/y/Y}" != 'Y' ] ; then
  22. failure "expiration not set."
  23. fi
  24. else
  25. log debug "extending without prompting."
  26. fi
  27. log info "setting host key expiration to ${extendTo}:"
  28. log debug "executing host expire script..."
  29. gpg_host_edit expire <<EOF
  30. $extendTo
  31. save
  32. EOF
  33. update_gpg_pub_file
  34. cat <<EOF | log info
  35. NOTE: Host key expiration date adjusted, but not yet published.
  36. Run '$PGRM publish-key' to publish the new expiration date.
  37. EOF
  38. }