Azure Artifact Signing | PFX | Codesigning | jsign
801
The Docker Image is based on Debian and has the following components installed:
aas-codesign.sh and pfx-codesign.sh.pfx
aas-codesign.sh [FILE] [PATTERN] [@FILELIST]...pfx-codesign.sh [FILE] [PATTERN] [@FILELIST]...[FILE] [PATTERN] [@FILELIST]...Source:
You can use this Docker Image to do Windows Code Signing using Azure Artifact Signing or with a codesign certificate .pfx.
Create the following two .json files on your host machine:
azure.json
{
"TenantId": "[Azure Tenant Id]",
"ClientId": "[Azure Client Id]",
"ClientSecret": "[Azure Client Secret]"
}
acs.json
{
"Endpoint": "https://weu.codesigning.azure.net",
"CodeSigningAccountName": "[ACS Code Signing Account Name]",
"CertificateProfileName": "[ACS Certificate Profile Name]"
}
And mount them into the following location when running the Docker Container:
/etc/aas-codesign/azure.json
/etc/aas-codesign/acs.json
Instead of mounting the two .json files, you can also provide the configuration via Environment Variables:
AZURE_TENANT_ID=[Azure Tenant Id]
AZURE_CLIENT_ID=[Azure Client Id]
AZURE_CLIENT_SECRET=[Azure Client Secret]
ACS_ENDPOINT=https://weu.codesigning.azure.net
ACS_ACCOUNT_NAME=[ACS Code Signing Account Name]
ACS_CERTIFICATE_PROFILE_NAME=[ACS Certificate Profile Name]
The Timestamp Server will be automatically chosen by jsign.
To change it you can set the Environment Variables:
TIMESTAMP_SERVER=http://timestamp.domain.org
TIMESTAMP_MODE=[RFC3161|Authenticode]
Create the following .json file on your host machine:
pfx.json
{
"Password": "pfx-password",
"TimestampServer": "http://timestamp.digicert.com",
"TimestampMode": "Authenticode"
}
Have your codesign certificate certificate.pfx located on your host machine.
Mount them into the following location when running the Docker Container:
/etc/pfx-codesign/pfx.json
/etc/pfx-codesign/certificate.pfx (Note: always required)
Instead of mounting the .json file, you can also provide the configuration via Environment Variable:
PFX_PASSWORD=[PFX Password]
TIMESTAMP_SERVER=http://timestamp.domain.org
TIMESTAMP_MODE=[RFC3161|Authenticode]
aas-codesign.shThe included Shell Script aas-codesign.sh is a helper script which will
.json filesThe following example will
.json files stored on the host machine/dataaas-codesign.sh.exe's and .dll's in /data (recursively)docker run \
--rm \
-v /local/path/to/acs.json:/etc/aas-codesign/acs.json \
-v /local/path/to/azure.json:/etc/aas-codesign/azure.json \
-v /local/path/to/build-folder:/data \
-w /data \
--entrypoint aas-codesign.sh \
jotools/codesign \
"./**/*.exe" "./**/*.dll"
The same example, but
docker run \
--rm \
-e TIMESTAMP_SERVER=http://timestamp.digicert.com \
-v /local/path/to/acs.json:/etc/aas-codesign/acs.json \
-v /local/path/to/azure.json:/etc/aas-codesign/azure.json \
-v /local/path/to/build-folder:/data \
-w /data \
--entrypoint aas-codesign.sh \
jotools/codesign \
"./**/*.exe" "./**/*.dll"
The following example will
/datashaas-codesign.sh "./**/*.exe" "./**/*.dll"aas-codesign.sh myapp.exe mylib.dlldocker run \
--rm \
-it \
--entrypoint sh \
-e AZURE_TENANT_ID="MY_AZURE_TENANT_ID" \
-e AZURE_CLIENT_ID="MY_AZURE_CLIENT_ID" \
-e AZURE_CLIENT_SECRET="MY_AZURE_CLIENT_SECRET" \
-e ACS_ENDPOINT=https://weu.codesigning.azure.net \
-e ACS_ACCOUNT_NAME="ACS Code Signing Account Name" \
-e ACS_CERTIFICATE_PROFILE_NAME="ACS Certificate Profile Name" \
-v /local/path/to/build-folder:/data \
jotools/codesign
The following example will
acs.json and azure.json/datashaas-codesign.sh "./**/*.exe" "./**/*.dll"aas-codesign.sh myapp.exe mylib.dlldocker run \
--rm \
-it \
--entrypoint sh \
-v /local/path/to/acs.json:/etc/aas-codesign/acs.json \
-v /local/path/to/azure.json:/etc/aas-codesign/azure.json \
-v /local/path/to/build-folder:/data \
jotools/codesign
pfx-codesign.shThe included Shell Script pfx-codesign.sh is a helper script which will
.json fileThe following example will
.json file stored on the host machine.pfx stored on the host machine/datapfx-codesign.sh.exe's and .dll's in /data (recursively)docker run \
--rm \
-v /local/path/to/pfx.json:/etc/pfx-codesign/pfx.json \
-v /local/path/to/my-certificate.pfx:/etc/pfx-codesign/certificate.pfx \
-v /local/path/to/build-folder:/data \
-w /data \
--entrypoint pfx-codesign.sh \
jotools/codesign \
"./**/*.exe" "./**/*.dll"
The following example will
pfx.json.pfx stored on the host machine/datashpfx-codesign.sh "./**/*.exe" "./**/*.dll"pfx-codesign.sh myapp.exe mylib.dlldocker run \
--rm \
-it \
--entrypoint sh \
-v /local/path/to/pfx.json:/etc/pfx-codesign/pfx.json \
-v /local/path/to/my-certificate.pfx:/etc/pfx-codesign/certificate.pfx \
-v /local/path/to/build-folder:/data \
jotools/codesign
The provided Scripts aas-codesign.sh and pfx-codesign.sh allow retrieving sensitive information (such as a Client Secret or Certificate Password) from a plaintext .json configuration file, which is not secure.
That's just intended for demonstration and testing purposes only. If using similar logic in a production environment, implement a secure method for managing secrets to protect sensitive information.
Retrieve the secrets from a secure storage, and run the Docker Container from the script with the corresponding Environment Variables, omitting the secrets in the .json configuration files.
Storing secrets in plaintext files poses significant security risks, including:
Instead of storing secrets in a .json configuration file, consider these more secure approaches:
Use OS-Level Secret Storage
security CLI tool.Use a Secrets Manager
Use GitHub Actions Secrets (for CI/CD Pipelines)
${{ secrets.MY_SECRET }} instead of storing them in the repository.
Do you like this project? Does it help you? Has it saved you time and money?
You're welcome - it's free... If you want to say thanks I'd appreciate a message or a small donation via PayPal.
Content type
Image
Digest
sha256:1338e4b96…
Size
275.6 MB
Last updated
4 months ago
docker pull jotools/codesign