I'm tasked with moving a Tomcat/Jenkins installation from the deprecated (and now removed in Yosemite) SystemStarter framework to launchd. It launches and runs fine as a "build" user, except for one thing. Part of our build process involves calling the "security" command to manipulate the keychain. This is failing as follows:
security: cert import failed: write permissions error
security: problem decoding
If I ssh into the build machine and launch Tomcat from a command prompt, via bin/startup.sh, then the call to security
doesn't complain. It only complains when I launch Tomcat via launchd. My plist looks like this:
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.apache.tomcat</string>
<key>UserName</key>
<string>builduser</string>
<key>WorkingDirectory</key>
<string>/Users/builduser</string>
<key>Program</key>
<string>/Users/builduser/bin/tomcat.sh</string>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<true/>
</dict>
<key>EnvironmentVariables</key>
<dict>
<key>CATALINA_HOME</key>
<string>/Users/builduser/Tomcat</string>
<key>CATALINA_OPTS</key>
<string>-Djava.awt.headless=true</string>
<key>JAVA_OPTS</key>
<string>-Xmx1024m -XX:MaxPermSize=512m</string>
</dict>
</dict>
</plist>
plist is located in /Library/LaunchDaemons and tomcat.sh is just a wrapper that launches tomcat and then waits for the process to die.