0

I am writing a windows service which takes an uploaded file, runs signtool.exe on it to do the signing and timestamping and then serves the signed file back.

The code for this works when run as a standalone server using twisted however if I try and run it as a service it fails with the error "Signing succeeded, but an error occurred while attempting to timestamp".

If I replace the signcode subprocess call with a curl.exe call which explicitly uses the proxy then this succeeds.

I have set the proxy in internet explorer and running the command manually works. Is there another way of setting an http proxy for signtool/signcode or another way of doing this (I am keen for it to be a service for ease of integration in to some other monitoring systems)?

4

1 回答 1

0

我有同样的问题,但通过 cygwin ssh 运行 signtool(使用密码)。如果我通过 gui 至少登录一次(例如通过 rdesktop),时间戳只能通过代理和 ssh 工作。之后我什至不必登录到 gui 就可以通过 ssh 工作,我只需要确保我至少通过 gui 登录一次。无论它在图形登录时做什么,都可以在重新启动后继续存在。然而,一个区别是我正在使用我通过 ssh 启动的相同 powershell 动态设置代理设置:

$reg_key = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Set-ItemProperty -path $reg_key ProxyServer -value 192.168.0.3:8888
Set-ItemProperty -path $reg_key ProxyOverride -value "<local>"
Set-ItemProperty -path $reg_key ProxyEnable -value 1

我尝试从 ssh 启动 explorer.exe &、notepad & 和 iexplorer.exe &,但它没有帮助。我将了解如何对代理设置进行硬编码,以及是否可以在启动后让签名用户登录到 gui。还将检查以确保 ssh 是使用 cygrunsrv -i 启动的,或者在服务中检查它是否允许与桌面交互。

如果系统停止,系统会恢复其映像(vmware 增量映像)(这就是我能够复制问题的方式),但我总是可以更改它,看起来我可能必须这样做才能解决这个问题。

终于在评论的帮助下弄清楚了:

http://blogs.msdn.com/b/askie/archive/2013/05/09/user-proxy-settings-showing-up-in-local-system-account-correct-way-to-apply-proxy- settings.aspx#10606266

看起来该设置实际上必须在二进制文件中设置:

HKEY_Current_User\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\DefaultConnectionSettings

这个二进制文件直到图形登录后才会在注册表中创建,即使我使用上面所做的 powershell 设置也是如此。最简单的方法是登录(假设您有我在上面使用 powershell 进行的注册表设置,或者通过 gui 中的 Internet 选项 ui 手动设置),导出 HKEY_Current_User\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections 路径,并将其导入:

regedit /s path_to_proxy_settings.reg

如果您希望它适用于所有用户,您需要在以下应用相同的文件:

HKEY_LOCAL_MACHINE\\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections

如帖子中所述。这里提到的可能还有其他方法https://serverfault.com/questions/34940/how-do-i-configure-proxy-settings-for-local-system,但以上对我来说是最简单的。

于 2015-09-07T09:14:30.493 回答