Skip to content

MacOS: cannot use /usr/local/lib/opensc-pkcs11.so (provider not whitelisted) #1008

@jc-m

Description

@jc-m

Expected behaviour

ssh-add -s /usr/local/lib/opensc-pkcs11.so
would return
Card added: /usr/local/lib/opensc-pkcs11.so
What should happen?
this would add certificate from a PIV card

Actual behaviour

command returns
Could not add card "/usr/local/lib/opensc-pkcs11.so": agent refused operation
What happens instead?
because of an upgrade to OSX Sierra

	<dict>
		<key>date</key>
		<date>2017-03-28T17:55:21Z</date>
		<key>displayName</key>
		<string>macOS Sierra Update</string>
		<key>displayVersion</key>
		<string>10.12.4</string>
		<key>packageIdentifiers</key>
		<array>
			<string>com.apple.pkg.update.os.10.12.4.16E195</string>
			<string>com.apple.pkg.FirmwareUpdate</string>
			<string>com.apple.update.fullbundleupdate.16E195</string>
			<string>com.apple.pkg.EmbeddedOSFirmware</string>
		</array>
		<key>processName</key>
		<string>softwareupdated</string>
	</dict>
	<dict>
		<key>date</key>
		<date>2017-03-28T17:55:21Z</date>
		<key>displayName</key>
		<string>Command Line Tools (macOS Sierra version 10.12) for Xcode</string>
		<key>displayVersion</key>
		<string>8.3</string>
		<key>packageIdentifiers</key>
		<array>
			<string>com.apple.pkg.CLTools_Executables</string>
			<string>com.apple.pkg.DevSDK_OSX1012</string>
			<string>com.apple.pkg.CLTools_SDK_OSX1012</string>
		</array>

it seems that the opensc pkcs11 module is not recognized as whitelisted:

/usr/bin/ssh-agent -d
SSH_AUTH_SOCK=/var/folders/6c/qjsjzv_11y9966w9pp0p364h0000gp/T//ssh-WllIzcD6QWqA/agent.2768; export SSH_AUTH_SOCK;
echo Agent pid 2768;
debug2: fd 3 setting O_NONBLOCK
debug3: fd 4 is O_NONBLOCK
debug1: type 20
refusing PKCS#11 add of "/Library/OpenSC/lib/opensc-pkcs11.so": provider not whitelisted

Since "/usr/local/lib/opensc-pkcs11.so" is a link to "/Library/OpenSC/lib/opensc-pkcs11.so" it seems that now the link is followed and the provider rejected.

A workaround is to:

sudo rm /usr/local/lib/opensc-pkcs11.so
sudo cp /Library/OpenSC/lib/opensc-pkcs11.so /usr/local/lib/opensc-pkcs11.so

and always use /usr/local/lib/opensc-pkcs11.so in ssh-add

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions