ssl: Validate hostnames

Closes #524