Validate certificates on API endpoints

This verifies a backend before an attempt is made to connect to it,
unfortunately without enforcing any strict guarantees about transport
security on the live connection itself, owing to shortcomings in the
stdlibs ssl support.