Configuration profile containing VPN payload and certificate chain not working

I created a configuration profile using Apple Configurator 2.2 containing a VPN payload based on certificate authentication and a certificate payload containing three things: The client certificate, the private key for the client certificate and the (self signed) CA certificate.

When I install the profile, both certificates are installed to the keychain "system" - as desired and the client certificate is shown as "trusted". However when trying to establish the VPN connection, an error message "the server certificate could not be verified" is displayed.

The CA certificate has "special trust settings". When I delete the CA certificate and install it manually (from a .crt-file), I can / have to set the trust settings manually. Doing this, the VPN connection can be established successfully.


In opposite to the situation above, the CA certificates trust settings are shown as "trusted for all users".


It seems as if the CA certificate is not correctly installed when contained in the configuration profile.


Is this a bug in Apple Configurator?


P.S. English messages may not be reproduced correctly because I translated them from a german Mac OS release.

Mac mini (Late 2012), OS X Mountain Lion (10.8.4)

Posted on Mar 31, 2016 2:15 AM

Reply
13 replies

Apr 1, 2016 1:28 AM in response to John Lockwood

I'm not convinced that another profile editing tool would help as there obviously is no way to specify the destination keychain within the profile. So all depends on the installation process.

Furthermore I will have to edit the profile manually to add the OnDemanRules for the VPN connection.


I will give a short summary of my experiences.

a) This is the only working solution. The CA certificate has been installed manually from a PEM file. The certificate is installed in the system keychain and has the following properties. Please note that this certificate is marked as trusted for all users:

User uploaded file

b) Almost working solution although not clearly specified. The CA certificate is included in a certificate chain, originating from a p12-file together with the client certificate and the client private key. The certificate chain and the VPN settings are both contained in one profile.

User uploaded file

The CA certificate (together with the client certificate) is installed to the system keychain, however its trust settings are marked as custom. Although everything looks the same like in case a), the VPN tunnel can not be established due to the following error message:

User uploaded file

c) The CA certificate is contained in a common profile together with the VPN settings and the client certificate. However the CA certificate has its own entry in the profile.

d) The CA certificate is contained in its own profile containing nothing else.

Both case c) and d) lead to the result that the CA certificate is installed in the login keychain. Again the VPN tunnel can not be established. And again the trust settings are marked as custom.

User uploaded file

As a conclusion the CA certificate must be manually installed from a PEM file (.cer, .crt etc.) and can't be installed using a profile.

Mar 31, 2016 2:56 AM in response to John Lockwood

Hi John,

thank you very much for your suggestions.

Indeed I tried both solutions, because I found in Apple's Configuration Profile Reference that only one certificate may be included with the Certificate Payload.

So I tried the following:

- Profile with certificate chain (i.e. including CA cert) - not working

- Profile including client cert + key and a second certificate payload containing the CA cert - not working (*)

- Profile including client cert + key and manually installing CA cert - working


(*) In this case the CA cert is not installed in the keychain "system" but in the keychain of the current user.


What I also tried was to create a second profile containing only the CA cert but again the CA cert will be installed in the wrong keychain. I described this problem in another thread: Configuration profile containing certificate for keychain system

Mar 31, 2016 7:44 AM in response to Hagen-1

I use XCA under OS X and don't have that option.


You could add a second partition to a Mac and reinstall Yosemite on it for testing purposes. Adding and removing a second partition will not upset the first one as long as you have enough spare space.


If it turns out Apple Configurator is at fault then you need to report it as an issue to Apple. I currently have an open bug-report over a different issue in Apple Configurator and have not yet had a response. Sometimes Apple are more responsive than others. 😕


If you have a developer account you can use the bugreport.apple.com site, otherwise you will have to use the feedback page here - http://www.apple.com/feedback/configurator.html


Any reason you cannot use Profile Manager?

Mar 31, 2016 2:37 AM in response to Hagen-1

It is not clear from your post but there is one 'gotcha' regarding also including self-signed rootCA certificates in the case you describe.


It is as your probably aware possible to include multiple certificates in a single .cer or .p12 file. You might therefore think the simplest option is to include the self-signed rootCA and the client cert in the same .p12 file. This might work in some situations but apparently will not in this case. You therefore need to start off with a .cer file for the self-signed rootCA and a .p12 for the client cert & private key and add both files to the certificates payload section in Apple Configurator. You should then see it lists two certificate payloads and not one.

Mar 31, 2016 5:22 AM in response to Hagen-1

Hagen-1 wrote:


Sorry for being unclear:


Of course I could add both certificates to the profile (even adding the certificate chain from a p12-file was working)!


But I couldn't get the VPN tunnel up - this is what "not working" stands for.


When you add your self-signed rootCA to the profile in Apple Configurator does it look like mine? Mine is a self-signed rootCA but is as you can see 'trusted'. This maybe because this certificate is already installed and trusted on the Mac that is running Apple Configurator.


Could you post a similar picture? Concentrate on the rootCA as that seems to be your problem area, expanding the info for the rootCA even if this prevents showing the other cert would be better.

Mar 31, 2016 7:29 AM in response to John Lockwood

From your previous message and especially the fact that if you manually install the rootCA it works it does seem to be down to how this profile is installing that rootCA. Can you try a Yosemite client? Can you try making a profile using the older Apple Configurator under Yosemite? If the issue is that each time the self-signed rootCA is ending up in the login keychain when it should be in the system keychain then this would be the cause of the failure to connect but we then need to look at why it is ending up in the wrong keychain.

Yes, that's exactly what I suppose to be the reason for my problems.

I'm really missing a kind of an option in the profile to determine the keychain where the certificate shall be installed.


I'm sorry but all my clients have already been updated to Mac OS 10.11.4 and Apple Configurator 2.2.


I'm using Cisco IPSec with certificate and VPN on demand, not IKEv2.


I'm also using XCA, although I had an issue selecting the right program option.

FYI: I had started with openssl on CentOS 6.x which is using UTF-8 as default while XCA is using PrintableString as default for string encoding. However the naming of the options is a bit misleading:

Go to File / Options / Settings and select "UTF8 strings only (RFC2459)" for the String types. The program default is "Printable string or UTF8 (default)".

Mar 31, 2016 8:15 AM in response to John Lockwood

XCA: Under OS X you will find it under Preferences / Settings / String types. But you will have to open a database first (Version 1.3.2).


Bug report: Yes I have a developer account and will think about posting a bug report.


Profile Manager: It's part of OS X Server as far as I know. We only use OS X client versions.


Thank you very much for your efforts!

Mar 31, 2016 8:49 AM in response to Hagen-1

Yes Profile Manager is part of Server.app but that is very cheap to buy. If as it sounds you are a smaller organisation you could look at using the free version of Meraki Systems Manager. I use this myself along with Profile Manager.


See https://meraki.cisco.com/form/systems-manager-signup


Note: I am using Profile Manager to manage Macs, and Meraki Systems Manager to manage iOS devices. In theory both can do both but this approach worked best for my particular needs.

Apr 1, 2016 1:49 AM in response to Hagen-1

As I mentioned I use Meraki Systems Manager for iOS devices and this is because it allows me to upload a hand edited mobileconfig file which it can then push out. I currently use the old discontinued iPhone Configuration Utility but in principle Apple Configurator would also work for initially creating the mobile config file. Obviously for iOS devices the keychain issue is moot.


Like you I am manually adding VPN-on-Demand rules because for some insane reason Apple never added the ability to define all the officially supported rules to Profile Manager.


However with IKEv2 VPN profiles Apple have changes the rules, you don't have VPN-on-Demand any more instead you have a single setting of 'always on'. I suspect this maybe down to Apple losing a lawsuit against VirnetX. Therefore in theory you don't have to add custom VPN-on-Demand rules anymore if you use IKEv2. In my own case I did however discover a conflict between another rule that Apple Configurator adds to force all traffic to go via the VPN connection - which I want to happen anyway, and the fact that my VPN server already has its own rule set to do this. So I would have to hand edit it to unset that rule. 😟


I suggest you go ahead and log a bug report.

Mar 31, 2016 7:01 AM in response to Hagen-1

Ok, I was using a different version of Apple Configurator but I am now running the same as yours so my screen looks more like yours now. I was running the Apple Configurator for Yosemite before, you I can see are running it under El Capitan which is a newer version of Apple Configurator. I suppose it could be an issue with the newer version.


From your previous message and especially the fact that if you manually install the rootCA it works it does seem to be down to how this profile is installing that rootCA. Can you try a Yosemite client? Can you try making a profile using the older Apple Configurator under Yosemite? If the issue is that each time the self-signed rootCA is ending up in the login keychain when it should be in the system keychain then this would be the cause of the failure to connect but we then need to look at why it is ending up in the wrong keychain.


I don't know if it was one of your posts but I seem to recall seeing a similar issue of certs ending up in the wrong keychain posted relatively recently. I normally use a MDM solution e.g. Profile Manager or similar to push profiles to clients. The way that Profile Manager works at least is that if the profile is applied to a device or member of a device group then the certs gets put in to the system keychain and this would apply to both the self-signed rootCA and the client device cert. If however the profile is being applied to a user or member of user group then it gets put in to the login keychain. The later would be more appropriate to using a S/MIME certificate.


You have not yet identified the type of VPN you are using but in the case of IKEv2 it is very important to include a Subject Alternative Name (SAN) as well as a common name. It is also the case that currently a hostname will not work as a subject alternative name for IKEv2 on a Mac. I use a dummy email address e.g. serialnumber@domain.com


I use a free tool called XCA which makes creating certificates much easier especially when dealing with Subject Alternative Names. See https://sourceforge.net/projects/xca/?source=directory

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Configuration profile containing VPN payload and certificate chain not working

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.