openvpn: Rewrite the vertificate verify script in perl.

The current shell implementation is not strict with the certificate
common names and does not check all the requirements for the
connection to be accepted.