Skip to content

Replace ssl-cert snakeoil dependency with custom newcert script - #66

Merged
ohanssen merged 3 commits into
masterfrom
copilot/replace-snakeoil-certificate
Aug 8, 2026
Merged

Replace ssl-cert snakeoil dependency with custom newcert script#66
ohanssen merged 3 commits into
masterfrom
copilot/replace-snakeoil-certificate

Conversation

Copilot AI commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

The package previously depended on ssl-cert solely for its snakeoil self-signed certificate. This replaces that with a newcert script that generates a purpose-built cert, optionally embedding polaric-<callsign> as the CN/SAN when the aprsd backend is configured.

Changes

  • debian/misc/newcert — New script (/usr/sbin/newcert):

    • Reads mycall from /etc/polaric-aprsd/server.ini, strips SSID suffix, lowercases → polaric-la7eca
    • Falls back to hostname -f if no callsign found
    • Sanitizes CN to [a-z0-9.-] before passing to openssl
    • Generates 4096-bit RSA cert + key into /etc/polaric/ssl/, key owned root:ssl-cert
  • debian/misc/aprs_ssl.confSSLCertificateFile/SSLCertificateKeyFile updated to /etc/polaric/ssl/polaric.{crt,key}

  • debian/postinst — Calls newcert on first install if cert absent

  • debian/control — Drops ssl-cert from Depends; openssl was already listed

  • debian/polaric-webapp2.install — Adds newcertusr/sbin

Copilot AI and others added 2 commits August 8, 2026 16:53
…tificate

Co-authored-by: ohanssen <2892992+ohanssen@users.noreply.github.com>
Co-authored-by: ohanssen <2892992+ohanssen@users.noreply.github.com>
Copilot AI changed the title Replace snakeoil ssl-cert with newcert script for self-signed TLS certificate Replace ssl-cert snakeoil dependency with custom newcert script Aug 8, 2026
Copilot AI requested a review from ohanssen August 8, 2026 16:55
Co-authored-by: ohanssen <2892992+ohanssen@users.noreply.github.com>
@ohanssen
ohanssen marked this pull request as ready for review August 8, 2026 18:33
Copilot AI lite review requested due to automatic review settings August 8, 2026 18:33
@ohanssen
ohanssen merged commit d73ef96 into master Aug 8, 2026
1 check passed
@ohanssen
ohanssen deleted the copilot/replace-snakeoil-certificate branch August 8, 2026 18:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces the Debian package’s reliance on ssl-cert snakeoil certs by introducing a dedicated newcert generator and wiring Apache + postinst to use /etc/polaric/ssl/polaric.{crt,key}.

Changes:

  • Add /usr/sbin/newcert script to generate and install a self-signed TLS cert/key under /etc/polaric/ssl/.
  • Update Apache SSL vhost config to use the new Polaric cert/key paths.
  • Update packaging to run newcert on install and drop ssl-cert from dependencies.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
debian/misc/newcert New certificate-generation script for Polaric’s Apache frontend
debian/misc/aprs_ssl.conf Points Apache SSL cert/key directives to /etc/polaric/ssl/polaric.{crt,key}
debian/postinst Runs newcert during install when cert is missing
debian/control Removes ssl-cert dependency
debian/polaric-webapp2.install Installs newcert into usr/sbin

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread debian/postinst
Comment on lines +25 to +27
if [[ ! -f "/etc/polaric/ssl/polaric.crt" ]]; then
/usr/sbin/newcert
fi
Comment thread debian/misc/newcert
Comment on lines +29 to +34
CALLSIGN=$(grep -i '^\s*mycall\s*=' "$APRSD_CONF" 2>/dev/null \
| head -1 \
| sed 's/.*=\s*//' \
| tr -d '[:space:]' \
| tr 'A-Z' 'a-z' \
| sed 's/-[0-9]*$//')
Comment thread debian/misc/newcert
# /etc/polaric/ssl/polaric.key (private key)
#

set -e
Comment thread debian/misc/newcert
Comment on lines +55 to +57
mkdir -p "$CERT_DIR"
chmod 750 "$CERT_DIR"

Comment thread debian/misc/newcert
chmod 640 "$KEY_FILE"
chmod 644 "$CERT_FILE"

# Ensure www-data (Apache) can read the key
Comment thread debian/misc/newcert
Comment on lines +60 to +66
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-384 -sha256 -days 3650 \
-noenc \
-keyout "$KEY_FILE" \
-out "$CERT_FILE" \
-subj "/CN=$CN" \
-addext "subjectAltName=DNS:$CN" \
2>/dev/null
Comment thread debian/misc/newcert
Comment on lines +58 to +60
# ---- Generate EC private key and self-signed certificate ----
# Uses NIST P-384 (secp384r1) elliptic curve.
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-384 -sha256 -days 3650 \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants