Got it!! And I stubbed my toe jumping up and down in frustration at the answer.
If you follow the example configuration for the PAM authentication module in openvpn it'll lead you astray in this case. The documentation example suggests an example configuration for server.config of:
plugin openvpn-auth-pam.so "login login USERNAME password PASSWORD"
So I was haplessly using:
plugin openvpn-auth-pam.so "openvpn login USERNAME password PASSWORD"
And when I finally tried (after about 30 hail-mary style guess-and-check attempts at every wild possibility under the sun) changing the configuration to:
plugin /usr/local/openvpn/sbin/openvpn-auth-pam.so "openvpn"
Voila!! Sweet success, but with a sort of lingering feeling that you somehow cheated to get the answer.
But thank you very much for the replies, they helped clear up a number of problems I had to deal with before this would have worked anyway.
To spell it out clearly, with the above configuration the username is passed to the script as PAM_USER, and the password is written to STDIN followed by an <EOF> marker. The file /etc/pam.d/openvpn has one line in it:
auth required pam_exec.so expose_authtok /usr/local/openvpn/bin/myshellscript