Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5098a5d510 | |||
| 320098dd76 | |||
| 1d185f5d6c | |||
| 32821d2604 | |||
| e220b5a0c2 |
@@ -16,24 +16,48 @@
|
|||||||
# release — Supervisor pulls the image tag matching that version
|
# release — Supervisor pulls the image tag matching that version
|
||||||
# exactly, so an unbumped version means it silently keeps using the
|
# exactly, so an unbumped version means it silently keeps using the
|
||||||
# old image.
|
# old image.
|
||||||
|
#
|
||||||
|
# Triggers only on pushed tags matching "v*", and only builds if that
|
||||||
|
# tag's commit is actually part of main's history (see check-branch job).
|
||||||
|
|
||||||
name: build-and-push
|
name: build-and-push
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
# paths:
|
|
||||||
# - "mqtt-cert-manager/**"
|
|
||||||
# branches:
|
|
||||||
# - main
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY_HOST: git.example.com
|
REGISTRY_HOST: gitea.viratak.com
|
||||||
REGISTRY_OWNER: YOUR_USER
|
REGISTRY_OWNER: bitopa
|
||||||
IMAGE_NAME: mqtt-cert-manager
|
IMAGE_NAME: mqtt-cert-manager
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check-branch:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
on_main: ${{ steps.check.outputs.on_main }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout (full history)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Make sure we have main's history too
|
||||||
|
run: git fetch origin main:refs/remotes/origin/main
|
||||||
|
|
||||||
|
- name: Is this tag's commit part of main?
|
||||||
|
id: check
|
||||||
|
run: |
|
||||||
|
if git merge-base --is-ancestor HEAD origin/main; then
|
||||||
|
echo "on_main=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "on_main=false" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Tag $GITHUB_REF_NAME points to a commit that is not on main — skipping build."
|
||||||
|
fi
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
needs: check-branch
|
||||||
|
if: needs.check-branch.outputs.on_main == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -56,18 +80,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Read add-on version
|
- name: Read add-on version
|
||||||
id: version
|
id: version
|
||||||
|
# Plain shell instead of python3+PyYAML: the runner's Python has
|
||||||
|
# no yaml module installed, and this value is a simple one-liner
|
||||||
|
# anyway (version: "0.1.0"), so there's no need for a real YAML
|
||||||
|
# parser or an extra apt/pip install step just for this.
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(python3 -c "import yaml; print(yaml.safe_load(open('mqtt-cert-manager/config.yaml'))['version'])")
|
VERSION=$(grep '^version:' mqtt-cert-manager/config.yaml | cut -d'"' -f2)
|
||||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Read base image for this arch from build.yaml
|
- name: Read base image for this arch from build.yaml
|
||||||
id: base
|
id: base
|
||||||
run: |
|
run: |
|
||||||
BUILD_FROM=$(python3 -c "
|
BUILD_FROM=$(grep -E "^[[:space:]]*${{ matrix.arch }}:" mqtt-cert-manager/build.yaml | cut -d'"' -f2)
|
||||||
import yaml
|
|
||||||
d = yaml.safe_load(open('mqtt-cert-manager/build.yaml'))
|
|
||||||
print(d['build_from']['${{ matrix.arch }}'])
|
|
||||||
")
|
|
||||||
echo "build_from=$BUILD_FROM" >> "$GITHUB_OUTPUT"
|
echo "build_from=$BUILD_FROM" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Set up QEMU (needed to build non-amd64 targets on an amd64 runner)
|
- name: Set up QEMU (needed to build non-amd64 targets on an amd64 runner)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ App/add-on repository for [Viratak](https://viratak.com).
|
|||||||
|
|
||||||
Apps documentation: <https://developers.home-assistant.io/docs/apps>
|
Apps documentation: <https://developers.home-assistant.io/docs/apps>
|
||||||
|
|
||||||
[](https://my.home-assistant.io/redirect/supervisor_store/?repository_url=https://gitea.viratak.com/eta/virarepo)
|
[](https://my.home-assistant.io/redirect/supervisor_store/?repository_url=https://gitea.viratak.com/bitopa/virarepo)
|
||||||
|
|
||||||
## Apps
|
## Apps
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,11 @@ self-signed CA — no external CA or internet dependency.
|
|||||||
|
|
||||||
Full device-side wire protocol: see `DEVICE_PROTOCOL.md`.
|
Full device-side wire protocol: see `DEVICE_PROTOCOL.md`.
|
||||||
|
|
||||||
## Installing this add-on
|
## Installing this application
|
||||||
|
1. Add [virarepo repository](https://gitea.viratak.com/bitopa/virarepo) in applications section
|
||||||
|
2. Look for this project, and click install
|
||||||
|
|
||||||
|
## Offline Installing this application
|
||||||
|
|
||||||
1. Copy this folder into your Home Assistant add-ons repository (or add
|
1. Copy this folder into your Home Assistant add-ons repository (or add
|
||||||
it as a local add-on under `/addons/mqtt_cert_manager` on HAOS).
|
it as a local add-on under `/addons/mqtt_cert_manager` on HAOS).
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class CertificateAuthority:
|
|||||||
# -- setup ---------------------------------------------------------
|
# -- setup ---------------------------------------------------------
|
||||||
|
|
||||||
def _generate_root_ca(self):
|
def _generate_root_ca(self):
|
||||||
key = rsa.generate_private_key(public_exponent=65537, key_size=4096)
|
key = ec.generate_private_key(ec.SECP256R1())
|
||||||
subject = issuer = x509.Name(
|
subject = issuer = x509.Name(
|
||||||
[x509.NameAttribute(NameOID.COMMON_NAME, CA_COMMON_NAME)]
|
[x509.NameAttribute(NameOID.COMMON_NAME, CA_COMMON_NAME)]
|
||||||
)
|
)
|
||||||
@@ -157,7 +157,7 @@ class CertificateAuthority:
|
|||||||
if not hostnames:
|
if not hostnames:
|
||||||
raise ValueError("at least one hostname/IP is required")
|
raise ValueError("at least one hostname/IP is required")
|
||||||
|
|
||||||
key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
|
key = ec.generate_private_key(ec.SECP256R1())
|
||||||
now = datetime.datetime.now(datetime.timezone.utc)
|
now = datetime.datetime.now(datetime.timezone.utc)
|
||||||
subject = x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, hostnames[0])])
|
subject = x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, hostnames[0])])
|
||||||
|
|
||||||
@@ -180,7 +180,12 @@ class CertificateAuthority:
|
|||||||
.add_extension(
|
.add_extension(
|
||||||
x509.KeyUsage(
|
x509.KeyUsage(
|
||||||
digital_signature=True,
|
digital_signature=True,
|
||||||
key_encipherment=True,
|
# key_encipherment only applies to RSA (key-transport)
|
||||||
|
# keys; it's meaningless for an ECDSA key and shouldn't
|
||||||
|
# be set here now that this is EC. ECDHE cipher suites
|
||||||
|
# use ephemeral keys for the actual exchange — this
|
||||||
|
# cert's key is only ever used to sign, not encipher.
|
||||||
|
key_encipherment=False,
|
||||||
content_commitment=False,
|
content_commitment=False,
|
||||||
data_encipherment=False,
|
data_encipherment=False,
|
||||||
key_agreement=False,
|
key_agreement=False,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
name: "MQTT Certificate Manager"
|
name: "MQTT Certificate Manager"
|
||||||
version: "0.3.1"
|
version: "0.4.0"
|
||||||
slug: "mqtt_cert_manager"
|
slug: "mqtt_cert_manager"
|
||||||
description: "Local CA that issues and manages TLS client certificates for MQTT nodes"
|
description: "Local CA that issues and manages TLS client certificates for MQTT nodes"
|
||||||
url: "https://gitea.viratak.com/eta/mqtt-cert-manager"
|
url: "https://gitea.viratak.com/bitopa/mqtt-cert-manager"
|
||||||
# Points Supervisor at a pre-built image instead of building locally on
|
# Points Supervisor at a pre-built image instead of building locally on
|
||||||
# install. {arch} is substituted with each entry in "arch:" below (amd64,
|
# install. {arch} is substituted with each entry in "arch:" below (amd64,
|
||||||
# aarch64, ...) — Supervisor then pulls
|
# aarch64, ...) — Supervisor then pulls
|
||||||
@@ -10,7 +10,7 @@ url: "https://gitea.viratak.com/eta/mqtt-cert-manager"
|
|||||||
# REPLACE git.example.com/YOUR_USER with your actual Gitea host + owner.
|
# REPLACE git.example.com/YOUR_USER with your actual Gitea host + owner.
|
||||||
# Remove this line entirely to fall back to local building (e.g. while
|
# Remove this line entirely to fall back to local building (e.g. while
|
||||||
# developing, before you've set up CI).
|
# developing, before you've set up CI).
|
||||||
image: "gitea.viratak.com/eta/mqtt-cert-manager-{arch}"
|
image: "gitea.viratak.com/bitopa/mqtt-cert-manager-{arch}"
|
||||||
# TEMPORARY: restricted to amd64 only while developing against a single
|
# TEMPORARY: restricted to amd64 only while developing against a single
|
||||||
# Dell thin client. Restore the full list before publishing for others —
|
# Dell thin client. Restore the full list before publishing for others —
|
||||||
# see the commented-out entries below.
|
# see the commented-out entries below.
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
# https://developers.home-assistant.io/docs/apps/repository#repository-configuration
|
# https://developers.home-assistant.io/docs/apps/repository#repository-configuration
|
||||||
name: Viratak Home Assistant app repository
|
name: Viratak Home Assistant app repository
|
||||||
url: 'https://gitea.viratak.com/eta/virarepo'
|
url: 'https://gitea.viratak.com/bitopa/virarepo'
|
||||||
maintainer: Saman Sajedi <sajedi@viratak.com>
|
maintainer: Saman Sajedi <sajedi@viratak.com>
|
||||||
|
|||||||
Reference in New Issue
Block a user