SignTool error when running build through Jenkins as another user

3

I have an MSBuild that runs through Jenkins with signed code in one of the components.

When I run the build after starting Jenkins as the same user that the visual studio project was built with originally, it works fine. When I run the project as that same user through a scheduled task started by another local admin, however, the build fails, even though the user name in the processes list is the same.

So, for example, say the project was building fine as the user Admin, both in Visual Studio and when launching an MSBuild through a Jenkins instance on Tomcat started by the user Admin.

When I switch the user to John.admin, a local administrator, and run my scheduled task that launches Tomcat as the user Admin, it fails with the following SignTool error:

VCBUILD: SignTool error : ISignedCode::Sign returned error: 0x80092006

In the processes list, it has Tomcat running as the Admin user, same as if Admin had started it with startup.bat (the Tomcat is a standalone install).

I've been trying for a while but can't figure out why the build fails when launched via the task. Can anyone see the problem? It is necessary for Jenkins build to succeed after the machine is restarted and launched via another local admin.

EDIT : I've copied over all certificates for the Admin user (using the snap-in), all %PATH%, %CD%, %USERPROFILE% variables are the same, and the task is being run from the same folder. The ONLY difference I can see is that the user session IDs are different. I know this because if I start the scheduled task with John.admin, and then log in as Admin, the java.exe is not in the process list until I click "show processes from all users", which then shows it running as the user Admin.

I'm pretty much out of ideas, so I'm ok to try anything.

msbuild
jenkins
code-signing
asked on Stack Overflow Jan 25, 2012 by John Leehey • edited Feb 28, 2012 by John Leehey

1 Answer

1

It's hard to say for sure, but if I'm understanding the question correctly, I'd suggest focusing your efforts on any environment variables or other user-specific config that gets passed from the parent process (scheduled task) when it spawns the child process (Tomcat). Even though Tomcat is running as Admin, it's possible that %USERNAME% is being passed to it as John.admin, or perhaps %USERPROFILE% or even %PATH% is being passed in incorrectly.

Another possibility: for scheduled tasks in particular, I've been burned in the past by not setting the "start in" folder properly, even when the program/script can be found.

To troubleshoot, perhaps write the values of your environment variables, current directory, and other relevant config info to a log file by temporarily modifying startup.bat.

I'm not terribly familiar with SignTool, but this might also help -- SignTool Error: ISignedCode::Sign returned error: 0x80092006 -- the answers discuss where the private key is being stored vs. searched for.

answered on Stack Overflow Feb 23, 2012 by Paul Karlin • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0