Fix docker-compose so it uses the right cert hex.

This commit is contained in:
Luke Curley 2023-05-18 12:05:38 -07:00
parent 4675c27179
commit 16abb2d6dc
5 changed files with 21 additions and 14 deletions

View File

@ -1,13 +1,12 @@
# Use ubuntu because it's ez
FROM ubuntu:latest
WORKDIR /build
# Use openssl and golang to generate certificates
RUN apt-get update && \
apt-get install -y ca-certificates openssl golang
apt-get install -y ca-certificates openssl golang xxd
# Save the certificates to a volume
VOLUME /cert
WORKDIR /cert
# Download the go modules
COPY go.mod go.sum ./
@ -16,5 +15,8 @@ RUN go mod download
# Copy over the remaining files.
COPY . .
# Save the certificates to a volume
VOLUME /cert
# TODO support an output directory
CMD ./generate
CMD ./generate && cp localhost.* /cert

View File

@ -17,4 +17,4 @@ go run filippo.io/mkcert -ecdsa -install
go run filippo.io/mkcert -ecdsa -days 10 -cert-file "$CRT" -key-file "$KEY" localhost 127.0.0.1 ::1
# Compute the sha256 fingerprint of the certificate for WebTransport
openssl x509 -in "$CRT" -outform der | openssl dgst -sha256 > localhost.hex
openssl x509 -in "$CRT" -outform der | openssl dgst -sha256 -binary | xxd -p -c 256 > localhost.hex

View File

@ -1,6 +1,9 @@
# Create a build image
FROM ubuntu:latest
# Create the working directory.
WORKDIR /build
# Install necessary packages
RUN apt-get update && \
apt-get install -y \
@ -8,13 +11,15 @@ RUN apt-get update && \
wget \
ffmpeg
# Create a media volume
VOLUME /media
WORKDIR /media
# Download a file from the internet, in this case my boy big buck bunny
RUN wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 -O source.mp4
# Copy an run a script to create a fragmented mp4 (more overhead, easier to split)
COPY fragment .
CMD ./fragment
# Create a media volume
VOLUME /media
# Fragment the media
# TODO support an output directory
CMD ./fragment && cp fragmented.mp4 /media

View File

@ -6,7 +6,7 @@ use clap::Parser;
#[derive(Parser)]
struct Cli {
/// Listen on this address
#[arg(short, long, default_value = "0.0.0.0:4443")]
#[arg(short, long, default_value = "[::]:4443")]
addr: String,
/// Use the certificate file at this path

View File

@ -6,8 +6,8 @@ import fingerprintHex from 'bundle-text:../fingerprint.hex';
// Convert the hex to binary.
let fingerprint = [];
for (let c = 0; c < fingerprintHex.length-1; c += 2) {
fingerprint.push(parseInt(fingerprintHex.substring(c, c+2), 16));
for (let c = 0; c < fingerprintHex.length - 1; c += 2) {
fingerprint.push(parseInt(fingerprintHex.substring(c, c + 2), 16));
}
const params = new URLSearchParams(window.location.search)