I have a command line process which is calling an API and fetching tokens from login keychain. When I am running this process standalone with/without sudo from terminal, it is able to access the keychain entries. Now I have converted this into a launch daemon and trying to execute it as a launch daemon then it is not able to access tokens and giving me the error as **"errSecItemNotFound = -25300, /* The specified item could not be found in the keychain. */". **
I am using the below plist for creating the launch daemon.
Is there any way we can access the login keychain items using launch daemons with sudo?
Further I tried to execute launch daemon by impersonating the logged in user context "su user_name" and tried to execute it without sudo. Now also I am not able to get the access of keychain entries and got the different error **as errSecInteractionNotAllowed = -25308, /* User interaction is not allowed. */**
Is there any way of truly impersonating the logged int user context to execute the launch daemon so that I can get access of login keychain items?
I am using the below plist for creating the launch daemon.
Code Block <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>TestAuth_SilentDaemon</string> <key>Program</key> <string>*complete path of TestAuth_SilentDaemon*</string> <key>KeepAlive</key> <true/> <key>SessionCreate</key> <true/> </dict> </plist>
Is there any way we can access the login keychain items using launch daemons with sudo?
Further I tried to execute launch daemon by impersonating the logged in user context "su user_name" and tried to execute it without sudo. Now also I am not able to get the access of keychain entries and got the different error **as errSecInteractionNotAllowed = -25308, /* User interaction is not allowed. */**
Is there any way of truly impersonating the logged int user context to execute the launch daemon so that I can get access of login keychain items?