I have a little pm script that run's user-defined scripts for each logged in user on suspend/hibernate, resume/thaw. I've used this to kill or restart processes that don't behave well over suspend. User's can create scripts in ~/.user-pm which are run in lexicographic order on suspend and reverse order on resume. $1 has the pm operation name.
You could simply add a user-script that calls "ssh-add -D" on suspend/hibernate. (you'll have to look up the SSH_AUTH_SOCK somewhere, but I assume you'd need that for any solution).
Here's the global pm hook:
> cat /etc/pm/sleep.d/10_run_user_parts
#!/bin/sh
USER_PM_DIR=".user-pm"
# foreach logged in user
for user in `users | grep -o "\S*" | sort -u`; do
user_home=`getent passwd "${user}" | awk -F: '{print $6}'`
# check user has a valid home-directory
[ -d $user_home ] || continue
user_pm_dir="$user_home/$USER_PM_DIR"
# check for user-pm directory
[ -d "$user_pm_dir" ] || continue
# call run-parts as $user
case "$1" in
hibernate|suspend)
su -c "run-parts --arg=\"$1\" \"${user_pm_dir}\"" "${user}"
;;
thaw|resume)
su -c "run-parts --reverse --arg=\"$1\" \"${user_pm_dir}\"" "${user}"
;;
*) exit $NA ;;
esac
done
I'm on ubuntu - this should work for debian too - otherwise, YMMV