diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5d47c21 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 025b3de..060c617 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,7 +12,7 @@ on: env: REGISTRY: ghcr.io - IMAGE_NAME: "thedevminertv/ca-list" + IMAGE_NAME: "thedevminertv/ca-cert-list" jobs: docker: diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 710c156..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.override.yml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a39cd36..75a6aac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,8 @@ -FROM ghcr.io/thedevminertv/gostatic:1.2.3 +FROM ghcr.io/thedevminertv/gostatic:1.2.5 CMD ["-compress-level", "2"] -COPY ./public /static \ No newline at end of file +RUN apk add --no-cache openssl coreutils + +COPY --chown=app:app ./entrypoint.sh /entrypoint.sh +COPY --chown=app:app ./generate.sh /generate.sh +COPY ./public /static diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7289454 --- /dev/null +++ b/LICENSE @@ -0,0 +1,18 @@ +Copyright 2023 DevMiner + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..864bf43 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# CA-Cert List + +> This application provides a simple list to download your own root CA certificates. Useful for people that self-sign their own certificates. + +![Screenshot](./_docs/Example-Page.png) + +## Usage + +Create your own Dockerfile which derives from `ghcr.io/thedevminertv/ca-cert-list:latest` and add your own certificates to `/certs`. +The application will bind to port 80. + +The application expects the `/certs` folder to contain the following files: + +- `` [Folder] + - `cert.crt` [File]: Your certificate + - `description.txt`: A description of your certificate + +Example Dockerfile: + +```dockerfile +FROM ghcr.io/thedevminertv/ca-cert-list:latest + +COPY ./certs /certs +``` + +Build and run the container: + +```bash +docker build -t my-ca-cert-list . +docker run -d -p 80:80 my-ca-cert-list +``` + +## License + +This project is licensed under the MIT License. See [LICENSE](./LICENSE) for more information. diff --git a/_docs/Example-Page.png b/_docs/Example-Page.png new file mode 100644 index 0000000..900b27c Binary files /dev/null and b/_docs/Example-Page.png differ diff --git a/compose.yml b/compose.yml deleted file mode 100644 index 227d976..0000000 --- a/compose.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: '3' - -services: - certs: - build: . - labels: - - "traefik.enable=true" - - "traefik.http.services.certs.loadbalancer.server.port=80" - - "traefik.http.routers.certs.rule=Host(`certs.i.devminer.xyz`)" - - "traefik.http.routers.certs.service=certs" \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..3b8d999 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +./generate.sh + +chown -R app:app /static + +su app -c "/bin/gostatic --files /static --addr :80 $*" diff --git a/generate.sh b/generate.sh new file mode 100644 index 0000000..9e7fecf --- /dev/null +++ b/generate.sh @@ -0,0 +1,84 @@ +#!/bin/sh + +mkdir -p /static/certificates + +CERT_HTML=$( + cat < + +

{{NAME}}

+ {{DESCRIPTION}} + +
+
+ + Expiry + + {{EXPIRY}} +
+ +
+ + SHA256 + + + {{SHA256}} + +
+ +
+ + SHA1 + + + {{SHA1}} + +
+ +
+ + MD5 + + + {{MD5}} + +
+
+
+ +EOF +) + +set -e + +HTML="" +for CERT in /certs/*; do + file="$CERT/cert.crt" + certname=$(basename "$CERT") + + description=$(cat "$CERT/description.txt") + expire_time=$(openssl x509 -enddate -noout -in "$file" | cut -d= -f2) + expire_epoch=$(date -d "$expire_time" +%s) + sha256=$(openssl x509 -in "$file" -noout -sha256 -fingerprint | cut -d= -f2) + sha1=$(openssl x509 -in "$file" -noout -sha1 -fingerprint | cut -d= -f2) + md5=$(openssl x509 -in "$file" -noout -md5 -fingerprint | cut -d= -f2) + + component=$( + echo $CERT_HTML | + sed "s|{{NAME}}|$certname|g" | + sed "s|{{FILENAME}}|${certname}.crt|g" | + sed "s|{{DESCRIPTION}}|$description|g" | + sed "s|{{EXPIRY_TIMESTAMP}}|$expire_epoch|g" | + sed "s|{{EXPIRY}}|$expire_time|g" | + sed "s|{{SHA256}}|$sha256|g" | + sed "s|{{SHA1}}|$sha1|g" | + sed "s|{{MD5}}|$md5|g" + ) + + HTML="$HTML$component" + + cp "$file" "/static/certificates/$certname.crt" +done + +# replace html +sed -i "s|{{HTML}}|$HTML|g" /static/index.html diff --git a/public/MonaspaceNeon-Light.otf b/public/MonaspaceNeon-Light.otf new file mode 100644 index 0000000..d81c016 Binary files /dev/null and b/public/MonaspaceNeon-Light.otf differ diff --git a/public/MonaspaceNeon-Light.woff b/public/MonaspaceNeon-Light.woff new file mode 100644 index 0000000..192619c Binary files /dev/null and b/public/MonaspaceNeon-Light.woff differ diff --git a/public/index.html b/public/index.html index db93bc6..8ccd69c 100644 --- a/public/index.html +++ b/public/index.html @@ -6,6 +6,13 @@ Certificates / Zertifikate -

Certificates / Zertifikate

+

Certificates

+ +