"How to" for dext distribution

I have a DriverKit system extension (dext) that uses PCIDriverKit. I would like to get the build environment straightened out to successfully distribute the dext and associated software to end users.

There are three types of software involved:

  1. The Dext-hosting application - this is the application that must be installed to /Applications/, and will perform the registration of the dext. The dext is deployed "within" this application, and can be found in the /Contents/Library/SystemExtensions folder of the app bundle.
  2. The dext itself - this is the actual binary system extension, which will be registered by its owning application, and will operate in its own application space independent of the hosting application.
  3. Additional applications that communicate with the dext - these are applications which will connect to the dext through user clients, but these applications do not contain the dext themselves.

There are multiple locations where settings need to be exactly correct for each type of software to be signed, provisioned, and notarized properly in order to be distributed to users:

  1. developer.apple.com - where "identifiers" and "provisioning profiles" are managed. Note that there are differences in access between "Team Agent", "Admin", and "Developer" at this site.
  2. Xcode project's Target "Signing & Capabilities" tab - this is where "automatically manage signing" can be selected, as well as team selection, provisioning profile selection, and capabilities can be modified.
  3. Xcode project's Target "Build Settings" tab - this is where code signing identity, code signing development team, code signing entitlements file selection, Info.plist options and file selection, and provisioning profile selection.
  4. Xcode's Organizer window, which is where you manage archives and select for distribution. In this case, I am interested in "Developer ID" Direct Distribution - I want the software signed with our company's credentials (Team Developer ID) so that users know they can trust the software.

Choosing "automatically manage signing" does not work for deployment. The debug versions of software include DriverKit (development) capability (under App ID configuration at developer.apple.com), and this apparently must not be present in distributable provisioning. I believe this means that different provisioning needs to occur between debug and release builds?

I have tried many iterations of selections at all the locations, for all three types of binaries, and rather than post everything that does not work, I am asking, "what is supposed to work?"

Answered by DTS Engineer in 811868022

Stepping back for a moment, I think it's important to understand what's actually going on here. The starting point here is that there are two sets of data at work here:

  • (1) Your Xcode project has a set of data about your app, particularly the entitlement list, which are embedded in the codes signature of your app. That data can actually be viewed with the command:
codesign -dvvv --ent :- <path>
  • (2) The developer portal has a set of data about apps bundle ID, particularly the entitlement list, which is used to generate a provisioning profile which will be embedded inside your apps bundle. That data can actually be viewed with one of the following commands*:

*iOS and macOS use slightly different names and locations, a fact which is annoying when you jump back and forth between platforms. I wrote a script years ago which simply tried all 4 possibilities and am now working hard to not remember which is which.

security cms -D -i <path>/embedded.mobileprovision
security cms -D -i <path>/embedded.provisionprofile
security cms -D -i <path>/Contents/embedded.mobileprovision
security cms -D -i <path>/Contents/embedded.provisionprofile

All of the issues here boil down to "the data in those two files doesn't match". That leads to the difference between "Automatic" and "Manual":

  • Automatic-> Xcode will interact with the dev portal, adjusting the dev portal configuration (if it can) and generating/downloading provisioning profiles as needed.

  • Manual-> Xcode will (try) use whatever provisioning profiles you tell it to.

What's changed over time is Xcode's involvement with "adjusting the dev portal configuration". Originally, it didn't really do ANY adjustment. You'd configure the data on the Dev Portal and Xcode would use that data. Between Xcode v14 -> v16, Xcode expanded it's role, with the goal being that Xcode would be able to handle "all" of this configuration. That evolution is also what made Xcode 15 so problematic for DEXT. Xcode 15 added support for configuring managed capabilities (which is what DEXTs rely on) but it DIDN'T properly handle the particular configuration DEXTs use.

The key point here is that manual shouldn't actually "different" than automatic in an fundamental way, as all automatic should be generating exactly the same profile manual would.

That leads to the errors you're seeing. First off, this one:

  1. There is a problem with the request entity - You already have a current Developer ID Application Managed (with Kext) certificate or a pending certificate request.

I don't know what's causing that, but I don't believe it's directly related to this issue. I suspect it's a side effect of how your archive was originally signed and will self correct once other issues are resolved.

That leads to the other two errors, which are actually the same underlying error. First the manual error:

Profile doesn't match the entitlements file's value for the com.apple.developer.driverkit.userclient-access entitlement.

In other words, you pointed Xcode at a provisioning profile ("2") which didn't match apps signing ("1") configuration. You were actually on the right track here;

there is no place to declare that in the developer portal when making the provisioning profile.

Historically, the portal added a mechanism that could artificially "inject" a single "chunk" of entitlement data into the profile being generated. This was a poor solution that didn't scale which is why we replaced it with the right approach, which is to manage all capabilities in a single place (the App ID).

That leads to this error:

  1. No profiles for 'com.company.AppName' were found - Xcode couldn't find any Developer ID provisioning profiles matching 'com.company.AppName'.

This could be phrased better, but the issue here is the same as the manual case. That is, the configuration on the portal doesn't match the configuration your app was signed with, so Xcode can't/won't use that profile.

Somewhat ironically, the easiest way to fix these issues is the same in Xcode 15 and 16. Turn on automatic codesign'ing and configure the entitlements you need in the Capability interface. If you're using Xcode 15 that interaction may look pretty broken, as some of the capabilities you add will end up adding two entries in the capability section when there should only be one. That behavior is the visible symptom of Xcode 15s issue with DEXT. It's correctly enabling the entitlement on the portal, but it doesn't understand that the entitlements "collide", so it ends up mishandling profile generation.

The key point is that you shouldn't try to fix archive signing issues at the archive level, you need to move "back" to the earlier archive and fix in there.

Once the portal is corrected:

  • Xcode 16 should handle everything with automatic signing.

  • In Xcode 15, you need to manually generate provisioning profiles which you'd then select during export.

One tip I've found helpful on the manual provisioning side. On a machine that's been used for a long time, I've seen profiles "build up" to the point where it becomes very difficult to pick the right profile. These profile files are actually located in

~/Library/Developer/Xcode/UserData/Provisioning Profiles/

...and you can move/delete them to clear out the "cruft" so you can be sure it's doing the right thing.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

SO, while looking into another issue (r.139973639), I did find an issue in Xcode 16 that might explain the issues you're seeing. Basically, Xcode 16 isn't properly handling situations where the same account has multiple approved version of the same entitlement.

In concrete terms, if you have these two entitlements approved on your account:

Entitlement A:
<key>com.apple.developer.driverkit.transport.usb</key>
<array>
	<dict>
		<key>idVendor</key>
		<integer>10</integer>
		
	</dict>
</array>


Entitlement B:
<key>com.apple.developer.driverkit.transport.usb</key>
<array>
	<dict>
		<key>idVendor</key>
		<integer>14</integer>
		
		<key>idProduct</key>
		<integer>6</integer>
	</dict>
</array>

...then automatic code signing always chooses "A", ignoring "B". In addition, the portal will allow you to enable "A" and "B" on the same bundle ID, even though this configuration doesn't work. If both are enabled, the the first will always be used (even with manual profile generation).

SO, here is what you need to do to address this:

  1. On the portal side, configure whichever entitlement value you need and disable the others. You should only have ONE of any of these keys configured on any bundle ID.

  2. Manually generate the provisioning profiles you need.

  3. In Xcode 16 switch to manual code signing and sign with the profiles you generated.

Note that #1 is critical here. If you don't do one first, you'll end up generating a slightly different variation of the same failure.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

I've been able to re-test all of these automatic codesigning/provisioning/notarization suggestions on Xcode 16.1, by modifying all of the bundle IDs, changing to "Automatically Manage Signing" and attempting again with my "Admin" developer portal credentials.

It does not work. I still get all 3 errors of:

  • There is a problem with the request entity - you already have a current Developer ID Application Managed (With Kext) certificate or pending certificate request.
  • No profiles for "com.company.HostingApp.Driver" were found - Xcode couldn't find any Developer ID provisioning profiles matching 'com.company.HostingApp.Driver'.
  • No profiles for com.company.HostingApp" were found - Xcode couldn't find any Developer ID provisioning profiles matching 'com.company.HostingApp'.

It seems you are correct, the Admin level does not have authority to manipulate the developer portal side of the automatic process.

"Tightly controlled account access" does not really work in the modern world of two-factor authentication and remote development teams. The "Team Agent"/"Account Holder" is the CEO, typically - the only one empowered by the company to make legally binding agreements with Apple. The CEOs in most large organizations are not going to distribute their 2FA information to multiple developers just to get tasks like constructing App Identifiers done.

Yes, most companies use something of a "build machine" account that produces the corporate-signed software, however, that account is rarely, if ever, operated by the CEO either.

I understand that my complaint needs to be entered as a feature request, and I will enter a Feedback Assistant report to this effect.

In the meantime, however, the above set of instructions I provided has made it possible for me to complete the task of producing distributable dext software, so I will be marking that as the accepted solution.

Thank you!

So, I believe the "root" error here is this:

There is a problem with the request entity - you already have a current Developer ID Application Managed (With Kext) certificate or pending certificate request.

...which I think is caused by your machine not having a Developer ID certificate. Xcode tries to generate one and fails because, yes, that's restricted to the Team Agent. That is documented in "Roles and access", which I previously referenced.

The reason for that restriction is at least partially tied to this:

The "Team Agent"/"Account Holder" is the CEO, typically - the only one empowered by the company to make legally binding agreements with Apple.

Strictly speaking, the Developer ID certificate is the ONLY object required to sign and distribute software as "your company", hence the restrictive setting.

However, Admins can "Create cloud-managed Developer ID certificates", however, that access is restricted as a separate permission in " Granted as a separate permission in Users and Access".

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

"How to" for dext distribution
 
 
Q