Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,19 @@ jobs:
- name: Build and test all modules
run: ./gradlew clean build

- name: Sign module
run: ./scripts/sign-module.sh

- name: Verify signed module
run: |
unzip -l webcompat-build/build/webdev-compat.modl | grep -q "certificates.p7b"
unzip -l webcompat-build/build/webdev-compat.modl | grep -q "signatures.properties"

- name: Upload module artifact
uses: actions/upload-artifact@v4
with:
name: webdev-compat-module
path: webcompat-build/build/*.modl
path: |
webcompat-build/build/*.modl
!webcompat-build/build/*.unsigned.modl
retention-days: 30
25 changes: 17 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,32 @@ jobs:
- name: Build and test all modules
run: ./gradlew clean build

- name: Sign module
run: ./scripts/sign-module.sh

- name: Get version from gradle.properties
id: get_version
run: |
VERSION=$(grep "^moduleVersion=" gradle.properties | cut -d'=' -f2)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Module version: $VERSION"

- name: Verify tag matches module version
if: github.ref_type == 'tag'
run: |
EXPECTED_TAG="v$VERSION"
if [ "$GITHUB_REF_NAME" != "$EXPECTED_TAG" ]; then
echo "Tag $GITHUB_REF_NAME does not match module version $VERSION; expected $EXPECTED_TAG" >&2
exit 1
fi

- name: Find .modl file
id: find_modl
run: |
MODL_FILE=$(find webcompat-build/build -name "*.modl" ! -name "*.unsigned.modl" -type f | head -1)
if [ -z "$MODL_FILE" ]; then
MODL_FILE=$(find webcompat-build/build -name "*.unsigned.modl" -type f | head -1)
fi
if [ -z "$MODL_FILE" ]; then
echo "No .modl file found under webcompat-build/build"
exit 1
fi
test -n "$MODL_FILE"
unzip -l "$MODL_FILE" | grep -q "certificates.p7b"
unzip -l "$MODL_FILE" | grep -q "signatures.properties"
echo "MODL_FILE=$MODL_FILE" >> $GITHUB_ENV
echo "Found module file: $MODL_FILE"

Expand All @@ -66,8 +74,9 @@ jobs:
Version: ${{ env.VERSION }}

### Installation
1. Download the .modl file below
1. Download the signed .modl file below
2. Install it in Ignition via Config > Modules > Install or Upgrade a Module
3. Accept the self-signed certificate if prompted

### Changes
See the commit history for details on changes in this release.
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ build/
*.iml
.idea/
out/

# Module signing certificates, keystores, and downloaded signing tools
certs/*
!certs/README.md
*.jks
*.keystore
*.p12
*.p7b
tools/module-signer/
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,18 @@ From repo root:

- `./gradlew test`
- `./gradlew build`
- `./scripts/sign-module.sh`

Module artifact:

- `webcompat-build/build/webdev-compat.unsigned.modl`
- unsigned intermediate: `webcompat-build/build/webdev-compat.unsigned.modl`
- signed module: `webcompat-build/build/webdev-compat.modl`

If signing material does not exist yet, `./scripts/sign-module.sh` creates a simple self-signed certificate under `certs/`; those files are ignored by git. Keep the same generated files if you want future builds to use the same certificate, so Ignition users only need to accept that certificate once.

Verify the module contains the signing payload:

- `unzip -l webcompat-build/build/webdev-compat.modl | grep -E 'certificates.p7b|signatures.properties'`

## Live smoke test helper

Expand Down
11 changes: 5 additions & 6 deletions RELEASE_CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ Use this checklist before creating a public release.
- [ ] (Optional) Run targeted smoke test:
- `./scripts/smoke_webdev.sh http://localhost:8088 webcompat_live_parity text GET 200`

## 3. Signing Decision
## 3. Signing

- [ ] Decide artifact type for this release:
- Unsigned (default): keep `skipModlSigning=true`
- Signed: run with `-PskipModlSigning=false` plus required signing configuration
- [ ] Build release artifact:
- Unsigned: `./gradlew clean build`
- Signed: `./gradlew clean build -PskipModlSigning=false`
- `./gradlew clean build`
- `./scripts/sign-module.sh`
- [ ] Verify signed artifact:
- `unzip -l webcompat-build/build/webdev-compat.modl | grep -E 'certificates.p7b|signatures.properties'`

## 4. Tag and Publish

Expand Down
9 changes: 9 additions & 0 deletions certs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Module signing certificates

Run this from the repository root to create a simple self-signed module signing certificate:

```bash
./scripts/create-self-signed-module-cert.sh
```

The generated keystore, PEM certificate, and PKCS7 chain are ignored by git because they include local signing material. Keep the same generated files if you want future builds to use the same certificate, so Ignition users only need to accept that certificate once.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ignitionVersion=8.3.0
moduleVersion=1.1.2
moduleVersion=1.1.3
moduleId=com.jg.ignition.webcompat
moduleName=WebDevCompat
skipModlSigning=true
58 changes: 58 additions & 0 deletions scripts/create-self-signed-module-cert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash

set -euo pipefail

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

SIGNING_DIR="${MODULE_SIGNING_DIR:-$REPO_ROOT/certs}"
KEYSTORE="${MODULE_SIGNING_KEYSTORE:-$SIGNING_DIR/module-signing-keystore.jks}"
CERT_PEM="${MODULE_SIGNING_CERT_PEM:-$SIGNING_DIR/module-signing-cert.pem}"
CERT_CHAIN="${MODULE_SIGNING_CHAIN:-$SIGNING_DIR/module-signing-chain.p7b}"
ALIAS="${MODULE_SIGNING_ALIAS:-ignition-webdev-compat-self-signed}"
PASSWORD="${MODULE_SIGNING_PASSWORD:-ignition-webdev-compat}"
DNAME="${MODULE_SIGNING_DNAME:-CN=Ignition WebDevCompat Module, OU=Ignition WebDevCompat, O=J.Grocott, L=San Francisco, ST=CA, C=US}"
VALIDITY_DAYS="${MODULE_SIGNING_VALIDITY_DAYS:-3650}"

mkdir -p "$SIGNING_DIR"

if [ -f "$KEYSTORE" ]; then
echo "Using existing module signing keystore: $KEYSTORE"
else
echo "Creating self-signed module signing keystore: $KEYSTORE"
keytool -genkeypair \
-alias "$ALIAS" \
-keyalg RSA \
-keysize 2048 \
-validity "$VALIDITY_DAYS" \
-keystore "$KEYSTORE" \
-storepass "$PASSWORD" \
-keypass "$PASSWORD" \
-dname "$DNAME" \
-ext KeyUsage=digitalSignature \
-ext ExtendedKeyUsage=codeSigning
fi

echo "Exporting PEM certificate: $CERT_PEM"
keytool -exportcert \
-alias "$ALIAS" \
-keystore "$KEYSTORE" \
-storepass "$PASSWORD" \
-rfc \
-file "$CERT_PEM"

if ! command -v openssl >/dev/null 2>&1; then
echo "openssl is required to create the PKCS7 chain file expected by module-signer." >&2
exit 1
fi

echo "Exporting PKCS7 certificate chain: $CERT_CHAIN"
openssl crl2pkcs7 \
-nocrl \
-certfile "$CERT_PEM" \
-out "$CERT_CHAIN" \
-outform DER

echo "Self-signed module signing certificate is ready."
echo " Keystore: $KEYSTORE"
echo " Alias: $ALIAS"
echo " Chain: $CERT_CHAIN"
19 changes: 19 additions & 0 deletions scripts/download-module-signer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -euo pipefail

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

VERSION="${MODULE_SIGNER_VERSION:-0.0.1.ia}"
SIGNER_DIR="${MODULE_SIGNER_DIR:-$REPO_ROOT/tools/module-signer}"
SIGNER_JAR="${MODULE_SIGNER_JAR:-$SIGNER_DIR/module-signer-$VERSION-jar-with-dependencies.jar}"
SIGNER_URL="${MODULE_SIGNER_URL:-https://nexus.inductiveautomation.com/repository/inductiveautomation-releases/com/inductiveautomation/ignitionsdk/module-signer/$VERSION/module-signer-$VERSION-jar-with-dependencies.jar}"

mkdir -p "$SIGNER_DIR"

if [ ! -f "$SIGNER_JAR" ]; then
echo "Downloading IA module-signer $VERSION..."
curl -fL "$SIGNER_URL" -o "$SIGNER_JAR"
fi

echo "$SIGNER_JAR"
34 changes: 34 additions & 0 deletions scripts/sign-module.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

set -euo pipefail

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

KEYSTORE="${MODULE_SIGNING_KEYSTORE:-$REPO_ROOT/certs/module-signing-keystore.jks}"
CERT_CHAIN="${MODULE_SIGNING_CHAIN:-$REPO_ROOT/certs/module-signing-chain.p7b}"
ALIAS="${MODULE_SIGNING_ALIAS:-ignition-webdev-compat-self-signed}"
PASSWORD="${MODULE_SIGNING_PASSWORD:-ignition-webdev-compat}"
MODULE_IN="${MODULE_IN:-$REPO_ROOT/webcompat-build/build/webdev-compat.unsigned.modl}"
MODULE_OUT="${MODULE_OUT:-$REPO_ROOT/webcompat-build/build/webdev-compat.modl}"

if [ ! -f "$KEYSTORE" ] || [ ! -f "$CERT_CHAIN" ]; then
"$REPO_ROOT/scripts/create-self-signed-module-cert.sh"
fi

if [ ! -f "$MODULE_IN" ]; then
echo "Missing unsigned module: $MODULE_IN" >&2
exit 1
fi

SIGNER_JAR="$("$REPO_ROOT/scripts/download-module-signer.sh" | tail -n 1)"

echo "Signing $(basename "$MODULE_IN") -> $(basename "$MODULE_OUT")"
rm -f "$MODULE_OUT"
java -jar "$SIGNER_JAR" \
-keystore="$KEYSTORE" \
-keystore-pwd="$PASSWORD" \
-alias="$ALIAS" \
-alias-pwd="$PASSWORD" \
-chain="$CERT_CHAIN" \
-module-in="$MODULE_IN" \
-module-out="$MODULE_OUT"
Loading