@@ -225,6 +225,14 @@ jobs:
225
225
asset_path : src-tauri/target/${{ matrix.target }}/product-signed/defguard.pkg
226
226
asset_name : defguard-${{ matrix.target }}-${{ env.VERSION }}.pkg
227
227
asset_content_type : application/octet-stream
228
+
229
+ # Building signed windows bundle involves a few steps as described here:
230
+ # https://wixtoolset.org/docs/tools/signing/#signing-bundles-at-the-command-line
231
+ # 1. Build defguard & bundle the binaries (defguard & wireguard) using wix (windows)
232
+ # 2. Detach the burn engine from the bundle so that it can be signed (also windows)
233
+ # 3. Sign the burn engine (linux)
234
+ # 4. Reattach the burn engine back to the bundle (windows again)
235
+ # 5. Sign the whole bundle (linux)
228
236
build-windows :
229
237
needs :
230
238
- create-release
@@ -271,18 +279,70 @@ jobs:
271
279
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
272
280
- name : Bundle application
273
281
run : |
282
+ # prepare wix extension
274
283
dotnet tool install --global wix --version 4.0.5
275
284
wix extension add WixToolset.Bal.wixext/4
285
+ # bundle defguard & wireguard binaries together
276
286
wix build .\src-tauri\resources-windows\defguard-client.wxs -ext .\.wix\extensions\WixToolset.Bal.wixext\4\wixext4\WixToolset.Bal.wixext.dll
277
- - name : Upload installer artifact
287
+ # detach burn engine from the bundle to be signed
288
+ wix burn detach .\src-tauri\resources-windows\defguard-client.exe -engine .\src-tauri\resources-windows\burnengine.exe
289
+ - name : Upload unsigned bundle and burn-engine
278
290
uses : actions/upload-artifact@v4
279
291
with :
280
- name : defguard-client.exe
281
- path : src-tauri/resources-windows/defguard-client.exe
282
- sign-msi :
292
+ name : unsigned-bundle-and-burnengine
293
+ path : |
294
+ src-tauri/resources-windows/defguard-client.exe
295
+ src-tauri/resources-windows/burnengine.exe
296
+ sign-burn-engine :
283
297
needs :
284
298
- build-windows
299
+ runs-on :
300
+ - self-hosted
301
+ - Linux
302
+ steps :
303
+ - name : Write release version
304
+ run : |
305
+ VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1)
306
+ echo Version: $VERSION
307
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
308
+ - name : Download unsigned bundle & burn-engine
309
+ uses : actions/download-artifact@v4
310
+ with :
311
+ name : unsigned-bundle-and-burnengine
312
+ - name : Sign burn-engine
313
+ run : osslsigncode sign -pkcs11module /srv/codesign/certum/sc30pkcs11-3.0.6.68-MS.so -certs /srv/codesign/29ee7778ca5217107841bbbf6b3062e1.pem -key ${{ secrets.CODESIGN_KEYID }} -pass ${{ secrets.CODESIGN_PIN }} -h sha256 -t http://time.certum.pl/ -in burnengine.exe -out burnengine-signed.exe
314
+ - name : Upload bundle and burn-engine artifact
315
+ uses : actions/upload-artifact@v4
316
+ with :
317
+ name : unsigned-bundle-and-signed-burnengine
318
+ path : |
319
+ defguard-client.exe
320
+ burnengine-signed.exe
321
+ reattach-burn-engine :
322
+ needs :
323
+ - sign-burn-engine
324
+ runs-on : windows-latest
325
+ steps :
326
+ - name : Download unsigned bundle & signed burn-engine
327
+ uses : actions/download-artifact@v4
328
+ with :
329
+ name : unsigned-bundle-and-signed-burnengine
330
+ - name : Reattach burn-engine
331
+ run : |
332
+ # prepare wix extension
333
+ dotnet tool install --global wix --version 4.0.5
334
+ wix extension add WixToolset.Bal.wixext/4
335
+ # reattach burn engine to the bundle
336
+ wix burn reattach defguard-client.exe -engine burnengine-signed.exe -o defguard-client-reattached.exe
337
+ - name : Upload bundle with reattached burn-engine
338
+ uses : actions/upload-artifact@v4
339
+ with :
340
+ name : unsigned-bundle-with-reattached-signed-burn-engine
341
+ path : defguard-client-reattached.exe
342
+ sign-bundle :
343
+ needs :
285
344
- create-release
345
+ - reattach-burn-engine
286
346
runs-on :
287
347
- self-hosted
288
348
- Linux
@@ -292,13 +352,13 @@ jobs:
292
352
VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1)
293
353
echo Version: $VERSION
294
354
echo "VERSION=$VERSION" >> $GITHUB_ENV
295
- - name : Download a single artifact
355
+ - name : Download unsigned bundle & signed burn-engine
296
356
uses : actions/download-artifact@v4
297
357
with :
298
- name : defguard-client.exe
299
- - name : Sign MSI
300
- run : osslsigncode sign -pkcs11module /srv/codesign/certum/sc30pkcs11-3.0.6.68-MS.so -certs /srv/codesign/29ee7778ca5217107841bbbf6b3062e1.pem -key ${{ secrets.CODESIGN_KEYID }} -pass ${{ secrets.CODESIGN_PIN }} -h sha256 -t http://time.certum.pl/ -in defguard-client.exe -out defguard-client-signed.exe
301
- - name : Upload installer
358
+ name : unsigned-bundle-with-reattached-signed-burn-engine
359
+ - name : Sign bundle
360
+ run : osslsigncode sign -pkcs11module /srv/codesign/certum/sc30pkcs11-3.0.6.68-MS.so -certs /srv/codesign/29ee7778ca5217107841bbbf6b3062e1.pem -key ${{ secrets.CODESIGN_KEYID }} -pass ${{ secrets.CODESIGN_PIN }} -h sha256 -t http://time.certum.pl/ -in defguard-client-reattached .exe -out defguard-client-signed.exe
361
+ - name : Upload installer asset
302
362
303
363
env :
304
364
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments