Skip to contentSkip to conversation

Mac OS X Keychain management client

PATCH Superseded Vasily Kulikov 6 participants 17 messages Jan 24, 2015 – Feb 23, 2015

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Mac OS X Keychain management client

This patch adds support for using certificates stored in the Mac OSX Keychain to authenticate with the OpenVPN server. This works with certificates stored on the computer as well as certificates on hardware tokens that support Apple's tokend interface.

This patch version implements management client which handles RSA-SIGN command for RSA offloading. Also it handles new 'NEED-CERTIFICATE' request to pass a certificate from the keychain to OpenVPN.

OpenVPN itself gets new 'NEED-CERTIFICATE" command which is called when --management-external-cert is used. It is implemented as a multiline command very similar to an existing 'RSA-SIGN' command.

The patch is against commit 3341a98c2852d1d0c1eafdc70a3bdb218ec29049.

v3:
- used new 'NEED-CERTIFICATE' command for certificate data request instead of 'NEED-OK'
- improved option checking
- improved invalid certificate selection string handling
- added man page for keychain-mcd
- handle INFO, FATAL commands from openvpn and show them to user

v2 (http://sourceforge.net/p/openvpn/mailman/message/33225603/):
- used management interface to communicate with OpenVPN process

v1 (http://sourceforge.net/p/openvpn/mailman/message/33125844/):
- used RSA_METHOD to extend openvpn itself
- used autoconf and automake scripts
- used newer Mac OS X API
- improved crypto API errors checking

Brian Raderman's version:
http://thread.gmane.org/gmane.network.openvpn.devel/3631

--

.gitignore +0 -1
index 538c020..f504ddb 100644
@@ -19,7 +19,6 @@ Debug
 Win32-Output
 .deps
 .libs
-Makefile
 Makefile.in
 aclocal.m4
 autodefs.h
contrib/keychain-mcd/Makefile new file +13 -0
new file mode 100644
index 0000000..c6431df
@@ -0,0 +1,13 @@
+CFILES = cert_data.c common_osx.c crypto_osx.c main.c
+OFILES = $(CFILES:.c=.o) ../../src/openvpn/base64.o
+prog = keychain-mcd
+
+CC = gcc
+CFLAGS = -Wall
+LDFLAGS =  -framework CoreFoundation -framework Security -framework CoreServices
+
+$(prog): $(OFILES)
+	$(CC) $(LDFLAGS) $(OFILES) -o $(prog)
+
+%.o: %.c
+	$(CC) $(CFLAGS) -c $< -o $@
contrib/keychain-mcd/cert_data.c new file +733 -0

733 lines not on this page · raw message

contrib/keychain-mcd/cert_data.h new file +46 -0

46 lines not on this page · raw message

contrib/keychain-mcd/common_osx.c new file +94 -0

94 lines not on this page · raw message

contrib/keychain-mcd/common_osx.h new file +36 -0
new file mode 100644
index 0000000..4273548
@@ -0,0 +1,36 @@
+/*
+ *  OpenVPN -- An application to securely tunnel IP networks
+ *             over a single UDP port, with support for SSL/TLS-based
+ *             session authentication and key exchange,
+ *             packet encryption, packet authentication, and
+ *             packet compression.
+ *
+ *  Copyright (C) 2010 Brian Raderman <[email protected]...>
+ *  Copyright (C) 2013-2015 Vasily Kulikov <[email protected]...>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program (see the file COPYING included with this
+ *  distribution); if not, write to the Free Software Foundation, Inc.,
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __common_osx_h__
+#define __common_osx_h__
+
+#include <CoreFoundation/CoreFoundation.h>
+
+void printCFString(CFStringRef str);
+char* cfstringToCstr(CFStringRef str);
+CFStringRef createHexString(unsigned char *pData, int length);
+void printHex(unsigned char *pData, int length);
+
+#endif //__Common_osx_h__
contrib/keychain-mcd/crypto_osx.c new file +75 -0

75 lines not on this page · raw message

contrib/keychain-mcd/crypto_osx.h new file +44 -0

44 lines not on this page · raw message

contrib/keychain-mcd/keychain-mcd.8 new file +150 -0

150 lines not on this page · raw message

contrib/keychain-mcd/main.c new file +244 -0

244 lines not on this page · raw message

src/openvpn/buffer.c +11 -2
index 46f874b..421d60e 100644
@@ -1066,8 +1066,10 @@ buffer_list_peek (struct buffer_list *ol)
 }
 
 void
-buffer_list_aggregate (struct buffer_list *bl, const size_t max)
+buffer_list_aggregate_separator (struct buffer_list *bl, const size_t max, const char *sep)
 {
+  int sep_len = strlen(sep);
+
   if (bl->head)
     {
       struct buffer_entry *more = bl->head;
@@ -1075,7 +1077,7 @@ buffer_list_aggregate (struct buffer_list *bl, const size_t max)
       int count = 0;
       for (count = 0; more && size <= max; ++count)
 	{
-	  size += BLEN(&more->buf);
+	  size += BLEN(&more->buf) + sep_len;
 	  more = more->next;
 	}
 
@@ -1092,6 +1094,7 @@ buffer_list_aggregate (struct buffer_list *bl, const size_t max)
 	    {
 	      struct buffer_entry *next = e->next;
 	      buf_copy (&f->buf, &e->buf);
+	      buf_write(&f->buf, sep, sep_len);
 	      free_buf (&e->buf);
 	      free (e);
 	      e = next;
@@ -1105,6 +1108,12 @@ buffer_list_aggregate (struct buffer_list *bl, const size_t max)
 }
 
 void
+buffer_list_aggregate (struct buffer_list *bl, const size_t max)
+{
+  buffer_list_aggregate_separator(bl, max, "");
+}
+
+void
 buffer_list_pop (struct buffer_list *ol)
 {
   if (ol && ol->head)
src/openvpn/buffer.h +1 -0
index 7469da6..5695f64 100644
@@ -931,6 +931,7 @@ void buffer_list_advance (struct buffer_list *ol, int n);
 void buffer_list_pop (struct buffer_list *ol);
 
 void buffer_list_aggregate (struct buffer_list *bl, const size_t max);
+void buffer_list_aggregate_separator (struct buffer_list *bl, const size_t max, const char *sep);
 
 struct buffer_list *buffer_list_file (const char *fn, int max_line_len);
 #endif /* BUFFER_H */
src/openvpn/manage.c +117 -28

206 lines not on this page · raw message

src/openvpn/manage.h +5 -0
index 1c8dda6..95d2776 100644
@@ -268,6 +268,7 @@ struct man_connection {
 # define IEC_CLIENT_AUTH 1
 # define IEC_CLIENT_PF   2
 # define IEC_RSA_SIGN    3
+# define IEC_CERTIFICATE 4
   int in_extra_cmd;
   struct buffer_list *in_extra;
 #ifdef MANAGEMENT_DEF_AUTH
@@ -281,6 +282,8 @@ struct man_connection {
 # define EKS_READY   3
   int ext_key_state;
   struct buffer_list *ext_key_input;
+  int ext_cert_state;
+  struct buffer_list *ext_cert_input;
 #endif
 #endif
   struct event_set *es;
@@ -338,6 +341,7 @@ struct management *management_init (void);
 #define MF_UP_DOWN          (1<<10)
 #define MF_QUERY_REMOTE     (1<<11)
 #define MF_QUERY_PROXY      (1<<12)
+#define MF_EXTERNAL_CERT    (1<<13)
 
 bool management_open (struct management *man,
 		      const char *addr,
@@ -420,6 +424,7 @@ void management_learn_addr (struct management *management,
 #ifdef MANAGMENT_EXTERNAL_KEY
 
 char *management_query_rsa_sig (struct management *man, const char *b64_data);
+char* management_query_cert (struct management *man);
 
 #endif
 
src/openvpn/options.c +19 -0
index 64ded09..6ef14a3 100644
@@ -1591,6 +1591,11 @@ show_settings (const struct options *o)
   SHOW_STR (ca_file);
   SHOW_STR (ca_path);
   SHOW_STR (dh_file);
+#ifdef MANAGMENT_EXTERNAL_KEY
+  if((o->management_flags & MF_EXTERNAL_CERT))
+	SHOW_PARM ("cert_file","EXTERNAL_CERT","%s");
+  else
+#endif
   SHOW_STR (cert_file);
 
 #ifdef MANAGMENT_EXTERNAL_KEY
@@ -2172,6 +2177,8 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
 #ifdef MANAGMENT_EXTERNAL_KEY
 	if (options->management_flags & MF_EXTERNAL_KEY)
 	  msg(M_USAGE, "Parameter --management-external-key cannot be used when --pkcs11-provider is also specified.");
+	if (options->management_flags & MF_EXTERNAL_CERT)
+	  msg(M_USAGE, "Parameter --management-external-cert cannot be used when --pkcs11-provider is also specified.");
 #endif
 	if (options->pkcs12_file)
 	  msg(M_USAGE, "Parameter --pkcs12 cannot be used when --pkcs11-provider is also specified.");
@@ -2203,6 +2210,8 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
 #ifdef MANAGMENT_EXTERNAL_KEY
           if (options->management_flags & MF_EXTERNAL_KEY)
 	    msg(M_USAGE, "Parameter --management-external-key cannot be used when --cryptoapicert is also specified.");
+          if (options->management_flags & MF_EXTERNAL_CERT)
+	    msg(M_USAGE, "Parameter --management-external-cert cannot be used when --cryptoapicert is also specified.");
 #endif
 	}
       else
@@ -2221,6 +2230,8 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
 #ifdef MANAGMENT_EXTERNAL_KEY
           if (options->management_flags & MF_EXTERNAL_KEY)
 	    msg(M_USAGE, "Parameter --external-management-key cannot be used when --pkcs12 is also specified.");
+          if (options->management_flags & MF_EXTERNAL_CERT)
+	    msg(M_USAGE, "Parameter --external-management-cert cannot be used when --pkcs12 is also specified.");
 #endif
 #endif
         }
@@ -2262,6 +2273,9 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
 	    }
 	  else
 	    {
+#ifdef MANAGMENT_EXTERNAL_KEY
+          if (!(options->management_flags & MF_EXTERNAL_CERT))
+#endif
 	      notnull (options->cert_file, "certificate file (--cert) or PKCS#12 file (--pkcs12)");
 #ifdef MANAGMENT_EXTERNAL_KEY
           if (!(options->management_flags & MF_EXTERNAL_KEY))
@@ -4249,6 +4263,11 @@ add_option (struct options *options,
       VERIFY_PERMISSION (OPT_P_GENERAL);
       options->management_flags |= MF_EXTERNAL_KEY;
     }
+  else if (streq (p[0], "management-external-cert"))
+    {
+      VERIFY_PERMISSION (OPT_P_GENERAL);
+      options->management_flags |= MF_EXTERNAL_CERT;
+    }
 #endif
 #ifdef MANAGEMENT_DEF_AUTH
   else if (streq (p[0], "management-client-auth"))
src/openvpn/ssl.c +12 -4
index c81659f..cb8a739 100644
@@ -516,10 +516,18 @@ init_ssl (const struct options *options, struct tls_root_ctx *new_ctx)
     }
 #endif
 #ifdef MANAGMENT_EXTERNAL_KEY
-  else if ((options->management_flags & MF_EXTERNAL_KEY) && options->cert_file)
-    {
-      tls_ctx_use_external_private_key(new_ctx, options->cert_file,
-	  options->cert_file_inline);
+  else if ((options->management_flags & MF_EXTERNAL_KEY) && 
+           (options->cert_file || options->management_flags & MF_EXTERNAL_CERT))
+    {
+      if (options->cert_file) {
+        tls_ctx_use_external_private_key(new_ctx, options->cert_file,
+          options->cert_file_inline);
+      } else {
+        char *external_certificate = management_query_cert(management);
+        tls_ctx_use_external_private_key(new_ctx, INLINE_FILE_TAG,
+            external_certificate);
+        free(external_certificate);
+      }
     }
 #endif
   else
#1 lore raw

Am 24.01.15 um 18:04 schrieb Vasily Kulikov:

Quoted 9 lines

This patch adds support for using certificates stored in the Mac OSX Keychain to authenticate with the OpenVPN server. This works with certificates stored on the computer as well as certificates on hardware tokens that support Apple's tokend interface.

This patch version implements management client which handles RSA-SIGN command for RSA offloading. Also it handles new 'NEED-CERTIFICATE' request to pass a certificate from the keychain to OpenVPN.

Quoted 7 lines

OpenVPN itself gets new 'NEED-CERTIFICATE" command which is called when --management-external-cert is used. It is implemented as a multiline command very similar to an existing 'RSA-SIGN' command.

The patch is against commit 3341a98c2852d1d0c1eafdc70a3bdb218ec29049.

ACK from me to the OpenVPN part. I also tested the patch in OpenVPN for Android and the RSA-SIGN still works as expected. I have not reviewed the OS X contrib program (other than a quick glance at the code) but I think marking it as contrib it should be allowed to be still included.

Arne

#2 lore raw

Hi,

Quoted 1 line · Arne Schwabe

Am 24.01.15 um 18:04 schrieb Vasily Kulikov:

[..]

Quoted 9 lines
Quoted 5 lines

OpenVPN itself gets new 'NEED-CERTIFICATE" command which is called when --management-external-cert is used. It is implemented as a multiline command very similar to an existing 'RSA-SIGN' command.

The patch is against commit 3341a98c2852d1d0c1eafdc70a3bdb218ec29049.

ACK from me to the OpenVPN part. I also tested the patch in OpenVPN for Android and the RSA-SIGN still works as expected. I have not reviewed the OS X contrib program (other than a quick glance at the code) but I think marking it as contrib it should be allowed to be still included.

I hear Arne, and James also ACKed this ("based on testing", which Arne did).

I'm not merging it yet, though - Vasily, please provide a v4 of the patch that adds:

- documentation of --management-external-cert in doc/openvpn.8
- documentation of the new management command and response in doc/management-notes.txt
- fix the typos in the options here (please fix the other one, too):

@@ -2221,6 +2230,8 @@ options_postprocess_verify_ce (const struct options *optio ns, const struct conne
#ifdef MANAGMENT_EXTERNAL_KEY
if (options->management_flags & MF_EXTERNAL_KEY)
msg(M_USAGE, "Parameter --external-management-key cannot be used whe
n --pkcs12 is also specified.");
+ if (options->management_flags & MF_EXTERNAL_CERT)
+ msg(M_USAGE, "Parameter --external-management-cert cannot be used wh
en --pkcs12 is also specified.");
#endif

 #endif
         }

... it's "--management-external-*", not "--external-management-*".

With that, I'll merge right away :-)

thanks,

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#3 lore raw

Hi Gert,

Quoted 5 lines · Gert Doering

I hear Arne, and James also ACKed this ("based on testing", which Arne did).

I'm not merging it yet, though - Vasily, please provide a v4 of the patch that adds:

...

Quoted 1 line

With that, I'll merge right away :-)

Thank you for the review, I'll send the patch during the weekends.

Signature · 2 lines
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments
#4 lore raw
In reply to Gert Doering

Hi,

Quoted 36 lines · Gert Doering

Hi,

Quoted 1 line · Arne Schwabe

Am 24.01.15 um 18:04 schrieb Vasily Kulikov:

[..]

Quoted 9 lines
Quoted 5 lines

OpenVPN itself gets new 'NEED-CERTIFICATE" command which is called when --management-external-cert is used. It is implemented as a multiline command very similar to an existing 'RSA-SIGN' command.

The patch is against commit 3341a98c2852d1d0c1eafdc70a3bdb218ec29049.

ACK from me to the OpenVPN part. I also tested the patch in OpenVPN for Android and the RSA-SIGN still works as expected. I have not reviewed the OS X contrib program (other than a quick glance at the code) but I think marking it as contrib it should be allowed to be still included.

I hear Arne, and James also ACKed this ("based on testing", which Arne did).

I'm not merging it yet, though - Vasily, please provide a v4 of the patch that adds:

- documentation of --management-external-cert in doc/openvpn.8
- documentation of the new management command and response in doc/management-notes.txt
- fix the typos in the options here (please fix the other one, too):

(quoted diff) +0 -0
@@ -2221,6 +2230,8 @@ options_postprocess_verify_ce (const struct options *optio

ns, const struct conne
#ifdef MANAGMENT_EXTERNAL_KEY
if (options->management_flags & MF_EXTERNAL_KEY)
msg(M_USAGE, "Parameter --external-management-key cannot be used whe
n --pkcs12 is also specified.");

(quoted diff) +2 -0
+          if (options->management_flags & MF_EXTERNAL_CERT)
+           msg(M_USAGE, "Parameter --external-management-cert cannot be used wh

en --pkcs12 is also specified.");
#endif

Quoted 6 lines
 #endif
         }

... it's "--management-external-*", not "--external-management-*".

With that, I'll merge right away :-)

I've implemented the changes above, but don't send the patch yet. While talking with Jonathan Bullard we identified that with the current design it is very hard to implement a simple identity template passing independently of GUI implementation. Currently identity template is passed to keychain-mcd leaving aside openvpn itself and thus the openvpn configuration file doesn't contain the identity template. Tunnelblick or another GUI has to start keychain-mcd and pass the identity template itself. The way a user notifies TB/openvpn what identity template to use is TB-dependent: it can be e.g. storing XXX-keychain-identityTemplate preference in Info.plist file inside .tblk directory. Other GUI might use a different configuration method and thus store the identity template in some other place. It would be better to have a single GUI-independent way of configuring keychain-mcd.

Jonathan suggested the following method. --management-external-cert has a single argument, the identity template. This template is passed as-is to management interface client as an argument to NEED-CERTIFICATE request. Management interface client parses this string and chooses an identity based on the argument. In this case the argument is an opaque value which is simply passed to a management interface client, which handles it as it likes (or ignores). Also an argument can be used with an arbitrary management interface client, not only keychain-mcd.

We can restrict a bit a format of XXX in '--management-external-cert XXX' option argument. It can consist of two parts, e.g.:

--management-external-cert 'macosx-keychain:SUBJECT:c=US'

The first part is a hint how management client should handle the argument. In case of keychain-mcd it parses the argument, checks whether it starts with 'macosx-keychain:', and uses the end of the argument as an identity template.

If the change is implemented openvpn config can contain all information needed to start openvpn connection. A user has to start openvpn with the config file and to start keychain-mcd. Specifically it would contain a line like the following:

management-external-cert 'macosx-keychain:SUBJECT:c=US'

With the approach in patch v3 a user has to start openvpn with the config file, start keychain-mcd, and pass identity template as an argument to keychain-mcd.

What do you think of the change?

Thanks,

Signature · 2 lines
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments
#5 lore raw

Am 23.02.15 um 09:04 schrieb Vasily Kulikov:

Quoted 7 lines

management-external-cert 'macosx-keychain:SUBJECT:c=US'

With the approach in patch v3 a user has to start openvpn with the config file, start keychain-mcd, and pass identity template as an argument to keychain-mcd.

What do you think of the change?

I like the idea. You could make the macos-keychain in the string optional.

Arne

#6 lore raw

Hi,

Quoted 2 lines · Arne Schwabe
Quoted 1 line

What do you think of the change?

I like the idea. You could make the macos-keychain in the string optional.

What Arne said (both parts of it) :-)

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#7 lore raw
Quoted 7 lines · Gert Doering

Hi,

Quoted 2 lines · Arne Schwabe
Quoted 1 line

What do you think of the change?

I like the idea. You could make the macos-keychain in the string optional.

What Arne said (both parts of it) :-)

Excellent!

Signature · 2 lines
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments
#8 lore raw
In reply to Gert Doering
Quoted 6 lines · Gert Doering
Quoted 2 lines · Arne Schwabe
Quoted 1 line

What do you think of the change?

I like the idea. You could make the macos-keychain in the string optional.

What Arne said (both parts of it) :-)

I agree -- the argument to --needs-external-cert should be optional.

Note: the argument to --needs-external-cert should be passed on to "RSA_SIGN", too. (I think Vasily omitted that from his writeup.)

So the idea would be:

* Add an optional UTF-8 string argument to --needs-external-cert.
(Perhaps the docs should say this requires support from the management interface software and that currently such support is only available when using certain GUIs on OS X.)

* OpenVPN passes that argument to RSA_SIGN and NEEDS-CERTIFICATE,
passing an empty string if the argument does not appear.

* OS X GUIs such as Tunnelblick and Viscosity see the new RSA_SIGN or
NEEDS-CERTIFICATE argument and use keychain-mcd to deal with it. Other GUIs ignore it or use something that does something equivalent to what keychain-mcd does on OS X.

I'm not sure exactly how to add an argument to RSA_SIGN and NEEDS-CERTIFICATE without breaking existing management interface software but assume that is possible. (Also, the argument may need to be escaped when it is passed to RSA_SIGN or NEEDS-CERTIFICATE if it contains characters that are used as delimiters.)

#9 lore raw
Quoted 9 lines · Jonathan K. Bullard
Quoted 6 lines · Gert Doering
Quoted 2 lines · Arne Schwabe
Quoted 1 line

What do you think of the change?

I like the idea. You could make the macos-keychain in the string optional.

What Arne said (both parts of it) :-)

I agree -- the argument to --needs-external-cert should be optional.

Note: Arne said about 'macos-keychain' prefix in the argument being optional, not the argument itself being optional. Acually, I don't think making the argument optional is a good idea -- its parsing would be ambiguous unless it is the last argument in argv.

Quoted 9 lines

Note: the argument to --needs-external-cert should be passed on to "RSA_SIGN", too. (I think Vasily omitted that from his writeup.)

So the idea would be:

* Add an optional UTF-8 string argument to --needs-external-cert.
(Perhaps the docs should say this requires support from the management interface software and that currently such support is only available when using certain GUIs on OS X.)

Right.

Quoted 2 lines

* OpenVPN passes that argument to RSA_SIGN and NEEDS-CERTIFICATE,
passing an empty string if the argument does not appear.

Why rsa-sign? I think doing it with NEEDS-CERTIFICATE is enough. Identity contains both cert and private key, certificate request is made at first. Rsa-sign uses already chosen identity.

Quoted 4 lines

* OS X GUIs such as Tunnelblick and Viscosity see the new RSA_SIGN or
NEEDS-CERTIFICATE argument and use keychain-mcd to deal with it. Other GUIs ignore it or use something that does something equivalent to what keychain-mcd does on OS X.

Right.

Quoted 5 lines

I'm not sure exactly how to add an argument to RSA_SIGN and NEEDS-CERTIFICATE without breaking existing management interface software but assume that is possible. (Also, the argument may need to be escaped when it is passed to RSA_SIGN or NEEDS-CERTIFICATE if it contains characters that are used as delimiters.)

IMNSHO don't change rsa-sign at all and have no API breakage.

Signature · 2 lines
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments
#10 lore raw

Hi,

Quoted 6 lines · Vasily Kulikov
Quoted 1 line

I agree -- the argument to --needs-external-cert should be optional.

Note: Arne said about 'macos-keychain' prefix in the argument being optional, not the argument itself being optional. Acually, I don't think making the argument optional is a good idea -- its parsing would be ambiguous unless it is the last argument in argv.

Oh, *that* is something our config parser does all the time :-)

The question to me is "if we don't want to specify anything particular, because there is only one cert anyway, how would we do it?" - or is the assumption that we better should specify it always?

[..]

Quoted 7 lines
Quoted 5 lines

I'm not sure exactly how to add an argument to RSA_SIGN and NEEDS-CERTIFICATE without breaking existing management interface software but assume that is possible. (Also, the argument may need to be escaped when it is passed to RSA_SIGN or NEEDS-CERTIFICATE if it contains characters that are used as delimiters.)

IMNSHO don't change rsa-sign at all and have no API breakage.

That sounds like a reasonable approach to me.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#11 lore raw
In reply to Arne Schwabe
Quoted 10 lines · Arne Schwabe

Am 23.02.15 um 09:04 schrieb Vasily Kulikov:

Quoted 7 lines

management-external-cert 'macosx-keychain:SUBJECT:c=US'

With the approach in patch v3 a user has to start openvpn with the config file, start keychain-mcd, and pass identity template as an argument to keychain-mcd.

What do you think of the change?

I like the idea. You could make the macos-keychain in the string optional.

I wouldn't make it optional. Keep it URI-like, with 'macos-keychain' as the URI scheme.

We'll also want to support pkcs11: and file: URIs. In both cases we will have the same issue, with objects accessible only by a user *other* than the user that OpenVPN runs as.

GnuTLS HEAD also has support for CNG under Windows, and a system:id=XXX URI format to specify keys therein. We might even want to support an agent using that too.

If any URI scheme is going to be the default, and specifying it is going to be optional. I'd probably suggest that it be the file: scheme. But better still, just don't have a default. Certainly not macos-keychain :)

It might also be worth looking to see if the URI format we're using for the macos-keychain: URIs could be made more similar to the PKCS#11 URI standard.

Signature · 2 lines
David Woodhouse                            Open Source Technology Centre
[email protected]...                              Intel Corporation
#12 lore raw

Am 23.02.15 um 13:55 schrieb David Woodhouse:

Quoted 21 lines · Arne Schwabe
Quoted 9 lines

Am 23.02.15 um 09:04 schrieb Vasily Kulikov:

Quoted 7 lines

management-external-cert 'macosx-keychain:SUBJECT:c=US'

With the approach in patch v3 a user has to start openvpn with the config file, start keychain-mcd, and pass identity template as an argument to keychain-mcd.

What do you think of the change?

I like the idea. You could make the macos-keychain in the string optional.

I wouldn't make it optional. Keep it URI-like, with 'macos-keychain' as the URI scheme.

We'll also want to support pkcs11: and file: URIs. In both cases we will have the same issue, with objects accessible only by a user *other* than the user that OpenVPN runs as.

GnuTLS HEAD also has support for CNG under Windows, and a system:id=XXX URI format to specify keys therein. We might even want to support an agent using that too.

Quoted 8 lines

If any URI scheme is going to be the default, and specifying it is going to be optional. I'd probably suggest that it be the file: scheme. But better still, just don't have a default. Certainly not macos-keychain :)

It might also be worth looking to see if the URI format we're using for the macos-keychain: URIs could be made more similar to the PKCS#11 URI standard.

All fine. My rationale was like, if I want a certificate with a certain SUBJECT (e.g. [email protected]...) etc. it should not matter for men wether I get it from OS X, Windows or Android Certificate store.

Arne

#13 lore raw
Quoted 4 lines · Arne Schwabe

All fine. My rationale was like, if I want a certificate with a certain SUBJECT (e.g. [email protected]...) etc. it should not matter for men wether I get it from OS X, Windows or Android Certificate store.

The canonical way of representing that would be
pkcs11:[email protected]...

Signature · 1 line
dwmw2
#14 lore raw
Quoted 8 lines · David Woodhouse
Quoted 4 lines · Arne Schwabe

All fine. My rationale was like, if I want a certificate with a certain SUBJECT (e.g. [email protected]...) etc. it should not matter for men wether I get it from OS X, Windows or Android Certificate store.

The canonical way of representing that would be
pkcs11:[email protected]...

But that implies that pkcs11 is somehow in the loop. I might (1) use a different mechanism, such as a separate daemon that directly uses a private key file (as is possible on Android), or (2) simply don't care for what mechanism my daemon uses.

That said, I *do* agree that it would be worthwhile to see if we can use the same URI format as pkcs11-uris (most recent draft:
https://tools.ietf.org/html/draft-pechanec-pkcs11uri-21). If I recall correctly, there even are pkcs11-uri parsing libs available.

I think omitting 'pkcs11:' or 'osxkeychain:' should be possible, and if omitted the backend application should just use whatever it prefers.

-Steffan

#15 lore raw
In reply to David Woodhouse
Quoted 8 lines · David Woodhouse
Quoted 4 lines · Arne Schwabe

All fine. My rationale was like, if I want a certificate with a certain SUBJECT (e.g. [email protected]...) etc. it should not matter for men wether I get it from OS X, Windows or Android Certificate store.

The canonical way of representing that would be
pkcs11:[email protected]...

That representation loses the "CN=" (and maybe doesn't allow for additional search options -- I'm not sure).

OpenVPN already has an entire set of options that deal with PKCS-11. This patch is a completely different, parallel way of dealing with certificates, so I'm not sure why a "pkcs11:" scheme is needed. I probably would not implement it in Tunnelblick myself.

There are two things here: (A) what this "select" string is and (B) where/how to find the cert.

As to "what this 'select' string is" -- well, for "future-proofing", I would want it to be labeled as a selection string in case we want to pass something else at some time in the future.

Adding a scheme makes sense to me -- the "file:" scheme looks interesting, but it isn't part of this patch. But I think the scheme should be optional, so the configuration could include (the platform-independent):

     --management-external-keychain select:[email protected]...

and have it use the Keychain on OS X, Android Certificate Store on Android, something-I-don't-know on Windows, etc.

The tricky aspect of that is that the default would really depend on the management interface software, which really means it depends on the GUI. It is conceivable that two GUIs for the same platform could have different defaults (although I assume both Tunnelblick and Viscosity would use Keychain as the default, accessing it with keychain-mcd).

#16 lore raw
In reply to David Woodhouse
Quoted 9 lines · David Woodhouse
Quoted 8 lines · Arne Schwabe

Am 23.02.15 um 09:04 schrieb Vasily Kulikov:

Quoted 6 lines

management-external-cert 'macosx-keychain:SUBJECT:c=US'

With the approach in patch v3 a user has to start openvpn with the config file, start keychain-mcd, and pass identity template as an argument to keychain-mcd.

Quoted 5 lines
Quoted 2 lines
Quoted 1 line

What do you think of the change?

I like the idea. You could make the macos-keychain in the string optional.

I wouldn't make it optional. Keep it URI-like, with 'macos-keychain' as the URI scheme.

I'll keep it. I don't have a strict understanding what is the purpose of a default scheme, so I don't declare any default.

Also please note that openvpn itself doesn't know about any "scheme", it simply passes the value to a management interface client. A client is the process which parses the value and must know about schemes, default scheme, etc.

Thanks,

Signature · 2 lines
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments