You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Tobias Ringström <to...@ringstrom.mine.nu> on 2003/09/12 00:56:06 UTC

[PATCH] Fix issue #1330: accept server cert permanently, take 3

Here is the third iteration of the solution to issue #1330. The changes 
from take 2 are:

   1. Added the server config option ssl-ignore-invalid-date back in, as
      well as the new ssl-override-cert-hostname option.
   2. Permit the user to trust the certificate permanently even if there
      are hostname and date problems. If the certificate has hostname or
      date issues, the user will still be prompted for future connections.
   3. Removed the neon dependancy from the command line client by
      passing the required certificate info as strings to the prompt
      function.

Updated log message and patch are attached. Enjoy!

/Tobias

Log message:
Fix issue #1330: accept server cert permanently

User visible changes
====================

If the server cert is signed by an unknown CA, the user can choose to
reject the cert, to accept it temporarily or to accept it permanently.
If the server certificate has other problems (incorrect hostname, not
yet valid or expired), the user will still be prompted for each
connection. Subversion now behaves in the same way as Mozilla and
other web browsers.

The ssl-ignore-unknown-ca server configuration option is now gone
because it is no longer needed.

The ssl-ignore-host-mismatch server configuration option is replaced
by the new option ssl-override-cert-hostname which takes a single host
name.


Implementation details
======================

See the implementation proposal in notes/server-cert-revamp.txt.

subversion/include/svn_config.h
  Removed ssl-ignore-unknown-ca and ssl-ignore-host-mismatch.
  Added ssl-override-cert-hostname.

subversion/include/svn_client.h
  Add comments.

subversion/include/svn_auth.h
  (svn_auth_cred_server_ssl_t): Replace failures_allow with
  trust_permanantly.
  (svn_auth_ssl_server_cert_info_t): New struct to hold the server
  certificate info.
  (svn_auth_ssl_server_prompt_func_t): Add the cert info struct to
  the server certificate prompt function prototype.

subversion/libsvn_subr/config_file.c
  (ensure_auth_dirs): Create the SVN_AUTH_CRED_SERVER_SSL auth dir.
  (svn_config_ensure): Remove ssl-ignore-unknown-ca and
  ssl-ignore-host-mismatch config options from the
  template servers file, and add ssl-override-cert-hostname.

subversion/libsvn_client/auth.c
  (ssl_server_file_provider_baton_t): New type
  (server_ssl_file_first_credentials): Rewritten to look for the cert
  in the auth system and check for server config options.
  (server_ssl_file_save_credentials): New function used to store a
  certificate in the auth system.
  (svn_client_get_ssl_server_file_provider): Allocate a provider baton
  and initialize the provider type in the baton.
  (server_ssl_prompt_first_cred): Pass the certificate info struct to
  the prompt function.

subversion/clients/cmdline/cl.h
  (svn_cl__auth_ssl_server_prompt): Add the certificate info struct to
  the prompt prototype.

subversion/clients/cmdline/prompt.c
  (svn_cl__auth_ssl_server_prompt): Rewritten to present an
  informative prompt to the user, and create the appropriate
  credentials based on the user's response.

subversion/libsvn_ra_dav/session.c
  (server_ssl_callback): Export the certificate information and put it
  in the auth_baton parameter hash. Use the base-64 encoded DER of the
  certificate as the realm string. Save credentials permanently if
  requested.