Compare commits

...

3 Commits

Author SHA1 Message Date
6516c9caaa Update to Go-1.25.3
All checks were successful
release-tag / release-image (push) Successful in 1m43s
2025-10-21 07:16:11 +02:00
839548922a Update
All checks were successful
release-tag / release-image (push) Successful in 1m47s
2025-09-22 22:00:27 +02:00
edb97ddc58 RC2 2025-09-22 20:51:58 +02:00
6 changed files with 85 additions and 9 deletions

View File

@@ -0,0 +1,51 @@
name: release-tag
on:
push:
branches:
- 'main'
jobs:
release-image:
runs-on: ubuntu-fast
env:
DOCKER_ORG: ${{ vars.DOCKER_ORG }}
DOCKER_LATEST: latest
RUNNER_TOOL_CACHE: /toolcache
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
with: # replace it with your local IP
config-inline: |
[registry."${{ vars.DOCKER_REGISTRY }}"]
http = true
insecure = true
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: ${{ vars.DOCKER_REGISTRY }} # replace it with your local IP
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get Meta
id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: |
linux/amd64
push: true
tags: | # replace it with your local IP and tags
${{ vars.DOCKER_REGISTRY }}/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
${{ vars.DOCKER_REGISTRY }}/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}

25
Dockerfile Normal file
View File

@@ -0,0 +1,25 @@
FROM golang:1.25-alpine AS build
WORKDIR /app
# Optional: git + certs for private modules; cache modules and build cache
RUN apk add --no-cache git ca-certificates
# Go deps first (better layer caching)
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download
# App sources (incl. templates for go:embed)
COPY . .
# Build static binary (templates are embedded via //go:embed)
RUN --mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -trimpath -ldflags "-s -w" -o /out/pgpkeygen ./
### Runtime stage (distroless)
FROM gcr.io/distroless/static:nonroot
WORKDIR /app
COPY --from=build /out/pgpkeygen /app/pgpkeygen
EXPOSE 8080
USER nonroot:nonroot
ENTRYPOINT ["/app/pgpkeygen"]

2
go.mod
View File

@@ -1,6 +1,6 @@
module git.send.nrw/sendnrw/go-pgp-generator
go 1.24.4
go 1.25.3
require github.com/ProtonMail/go-crypto v1.3.0 // indirect

View File

@@ -144,7 +144,7 @@ func generatePGP(in genInput) (*genResult, error) {
name := sanitizeName(in.Name)
email := sanitizeEmail(in.Email)
if !validateEmailBasic(email) {
return nil, errors.New("ungültige EMail-Adresse")
return nil, errors.New("ungültige E-Mail-Adresse")
}
if name == "" {
return nil, errors.New("Name darf nicht leer sein")

View File

@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>PGP Keygenerator (Go)</title>
<style>
body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Inter,sans-serif;max-width:960px;margin:2rem auto;padding:0 1rem;color:#0f172a}
body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Inter,sans-serif;max-width:960px;margin:2rem auto;padding:0 1rem;color:#e2e8f0;background: #0f172a}
header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem}
.card{border:1px solid #e2e8f0;border-radius:14px;padding:1rem 1.25rem;box-shadow:0 1px 2px rgba(0,0,0,0.04)}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:1rem;align-items:start}
@@ -33,15 +33,15 @@
<input id="name" name="name" placeholder="Max Mustermann" required />
</div>
<div>
<label for="email">EMail</label>
<label for="email">E-Mail</label>
<input id="email" name="email" type="email" placeholder="max@example.org" required />
</div>
<div>
<label for="comment">Kommentar (optional)</label>
<input id="comment" name="comment" placeholder="z.B. LaptopKey" />
<input id="comment" name="comment" placeholder="z.B. Laptop-Key" />
</div>
<div>
<label for="rsabits">RSASchlüssellänge</label>
<label for="rsabits">RSA-Schlüssellänge</label>
<select id="rsabits" name="rsabits">
<option value="2048">2048</option>
<option value="3072">3072</option>
@@ -56,10 +56,10 @@
</div>
<div style="margin-top:1rem" class="row">
<button type="submit">Schlüssel erzeugen</button>
<small class="muted">Die Erzeugung erfolgt serverseitig nur lokal auf diesem Host. Schlüssel werden nicht gespeichert.</small>
<small class="muted">Die Erzeugung erfolgt serverseitig - nur lokal auf diesem Host. Schlüssel werden nicht gespeichert.</small>
</div>
</form>
<p class="footer">Hinweis: Für maximale Sicherheit sollten PGPSchlüssel auf einem vertrauenswürdigen, isolierten System erzeugt werden. Dieses Tool ist zu Demo/Entwicklungszwecken gedacht.</p>
<p class="footer">Hinweis: Für maximale Sicherheit sollten PGP-Schlüssel auf einem vertrauenswürdigen, isolierten System erzeugt werden.</p>
</body>
</html>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>PGP Schlüssel Ergebnis</title>
<title>PGP Schlüssel - Ergebnis</title>
<style>
body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Inter,sans-serif;max-width:960px;margin:2rem auto;padding:0 1rem;color:#0f172a}
.card{border:1px solid #e2e8f0;border-radius:14px;padding:1rem 1.25rem;box-shadow:0 1px 2px rgba(0,0,0,0.04);margin-bottom:1rem}