Skip to content

Commit c292587

Browse files
committed
Update signing timestamp servers and protocol (#253)
This commit adds a few fallback servers that signtool.exe will run against, in case there's an error in the signing process. It also switches to using the RFC3161 format and SHA256 dig. algorithm. signtool.exe will now be run in debug mode. (cherry picked from commit 2c41f12)
1 parent d4c36e4 commit c292587

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

installer/build/scripts/Build.fsx

+16-5
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,15 @@ module Builder =
5757
tracefn "Signing MSI"
5858
let certificate = getBuildParam "certificate"
5959
let password = getBuildParam "password"
60-
let timestampServer = "http://timestamp.comodoca.com"
6160
let timeout = TimeSpan.FromMinutes 1.
61+
let timestampServers = ["http://timestamp.digicert.com" ; "http://timestamp.comodoca.com" ;
62+
"http://timestamp.globalsign.com/scripts/timestamp.dll" ; "http://tsa.starfieldtech.com" ;
63+
"http://zeitstempel.dfn.de"]
6264

63-
let sign () =
65+
let sign timestampServer =
6466
let signToolExe = ToolsDir @@ "signtool/signtool.exe"
65-
let args = ["sign"; "/f"; certificate; "/p"; password; "/t"; timestampServer; "/d"; "\"Elasticsearch ODBC Driver\""; "/v"; file] |> String.concat " "
67+
let args = ["sign"; "/debug" ; "/f"; certificate; "/p"; password; "/tr"; timestampServer; "/td" ; "SHA256" ;
68+
"/d"; "\"Elasticsearch ODBC Driver\""; "/v"; file] |> String.concat " "
6669
let redactedArgs = args.Replace(password, "<redacted>")
6770

6871
use proc = new Process()
@@ -94,8 +97,16 @@ module Builder =
9497
proc.WaitForExit()
9598
proc.ExitCode
9699

97-
let exitCode = sign()
98-
if exitCode <> 0 then failwithf "Signing returned error exit code: %i" exitCode
100+
let mutable notSigned = true
101+
for server in timestampServers do
102+
if notSigned then
103+
let exitCode = sign server
104+
if (exitCode = 0) then
105+
notSigned <- false
106+
else
107+
tracefn "Signing with a timestamp from %s failed with code: %i" server exitCode
108+
if notSigned then failwithf "Signing failed"
109+
else tracefn "Signing succeeded."
99110

100111
// Using DotNetZip due to errors with CMAKE zip files: https://github.com/fsharp/FAKE/issues/775
101112
let unzipFile(zipFolder: string, unzipFolder: string) =

0 commit comments

Comments
 (0)