This is an automated email from the ASF dual-hosted git repository.

tomaswolf pushed a commit to branch dev_3.0
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git


The following commit(s) were added to refs/heads/dev_3.0 by this push:
     new ef5219020 GH-928: Add OQS-OpenSSH test image for pure ML-KEM and 
ML-DSA interoperability
ef5219020 is described below

commit ef521902013d3c24409b2e05b6745aca710adc58
Author: Torbjörn Törnkvist <[email protected]>
AuthorDate: Mon Oct 19 10:44:58 2026 +0200

    GH-928: Add OQS-OpenSSH test image for pure ML-KEM and ML-DSA 
interoperability
    
    Add a small multi-arch (amd64, arm64) Docker image that runs the Open
    Quantum Safe fork of OpenSSH. It offers the pure ML-KEM key exchanges
    mlkem512-sha256, mlkem768-sha256 and mlkem1024-sha384, and pure ML-DSA
    host and user keys (ssh-mldsa-44/65/87), so that MINA SSHD can be tested
    against a third-party implementation.
    
    The image pins the Alpine base image by digest and liboqs by commit.
    Include a smoke test and a workflow that builds the image on native
    amd64 and arm64 runners, smoke-tests it, and publishes it to ghcr.io.
    The Maven build workflows ignore changes to docker/ and the image
    workflow.
---
 .gitattributes                          |   1 +
 .github/workflows/build.yml             |   2 +
 .github/workflows/next-build.yml        |   2 +
 .github/workflows/oqs-openssh-image.yml | 135 ++++++++++++++++++++++++++++++++
 docker/oqs-openssh/Dockerfile           |  86 ++++++++++++++++++++
 docker/oqs-openssh/README.md            |  99 +++++++++++++++++++++++
 docker/oqs-openssh/entrypoint.sh        |  40 ++++++++++
 docker/oqs-openssh/smoke-test.sh        |  62 +++++++++++++++
 docker/oqs-openssh/sshd_config          |  33 ++++++++
 9 files changed, 460 insertions(+)

diff --git a/.gitattributes b/.gitattributes
index 37727473e..8032de7b3 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -23,6 +23,7 @@
 *.bat           text eol=crlf
 *.vbs           text eol=crlf
 mvnw            text eol=lf
+sshd_config     text eol=lf
 mvnw.cmd        text eol=crlf
 
 # These files are binary and should be left untouched
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 7adc1131c..0b793fa81 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -27,6 +27,8 @@ on:
       - '*.md'
       - '.github/ISSUE_TEMPLATE/**'
       - '*.txt'
+      - 'docker/**'
+      - '.github/workflows/oqs-openssh-image.yml'
   workflow_call:
 
 jobs:
diff --git a/.github/workflows/next-build.yml b/.github/workflows/next-build.yml
index b3524f21e..a77bc032f 100644
--- a/.github/workflows/next-build.yml
+++ b/.github/workflows/next-build.yml
@@ -26,6 +26,8 @@ on:
       - '*.md'
       - '.github/ISSUE_TEMPLATE/**'
       - '*.txt'
+      - 'docker/**'
+      - '.github/workflows/oqs-openssh-image.yml'
 
 jobs:
   build:
diff --git a/.github/workflows/oqs-openssh-image.yml 
b/.github/workflows/oqs-openssh-image.yml
new file mode 100644
index 000000000..6857f1a33
--- /dev/null
+++ b/.github/workflows/oqs-openssh-image.yml
@@ -0,0 +1,135 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Builds the multi-arch OQS-OpenSSH test image (GH-928), smoke-tests it on each
+# architecture, and publishes it to GitHub Container Registry.
+
+name: oqs-openssh-image
+
+on:
+  workflow_dispatch:
+    inputs:
+      tag:
+        description: 'Image tag'
+        default: 'dev'
+  push:
+    paths:
+      - 'docker/oqs-openssh/**'
+      - '.github/workflows/oqs-openssh-image.yml'
+
+env:
+  CONTEXT: docker/oqs-openssh
+  TAG: ${{ github.event.inputs.tag || 'dev' }}
+
+permissions:
+  contents: read
+  packages: write
+
+jobs:
+  build:
+    name: build and test (${{ matrix.platform }})
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - platform: linux/amd64
+            runner: ubuntu-24.04
+          - platform: linux/arm64
+            runner: ubuntu-24.04-arm
+    runs-on: ${{ matrix.runner }}
+    timeout-minutes: 60
+    steps:
+      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1
+
+      - name: Image name (lower case)
+        run: echo 
"IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/mina-sshd-oqs-openssh" >> 
"$GITHUB_ENV"
+
+      - uses: 
docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 #v4.4.1
+
+      - uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f 
#v4.6.0
+        with:
+          registry: ghcr.io
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Build (load into local Docker)
+        uses: 
docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc #v7.4.0
+        with:
+          context: ${{ env.CONTEXT }}
+          platforms: ${{ matrix.platform }}
+          load: true
+          tags: oqs-test:local
+          cache-from: type=gha,scope=${{ matrix.platform }}
+          cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
+
+      - name: Image size
+        run: docker image ls oqs-test:local
+
+      - name: Smoke test
+        run: ${{ env.CONTEXT }}/smoke-test.sh oqs-test:local docker
+
+      - name: Push by digest
+        id: push
+        uses: 
docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc #v7.4.0
+        with:
+          context: ${{ env.CONTEXT }}
+          platforms: ${{ matrix.platform }}
+          outputs: type=image,name=${{ env.IMAGE 
}},push-by-digest=true,name-canonical=true,push=true
+          cache-from: type=gha,scope=${{ matrix.platform }}
+
+      - name: Export digest
+        run: |
+          mkdir -p /tmp/digests
+          digest="${{ steps.push.outputs.digest }}"
+          touch "/tmp/digests/${digest#sha256:}"
+
+      - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a 
#v7.0.1
+        with:
+          name: digests-${{ strategy.job-index }}
+          path: /tmp/digests/*
+          if-no-files-found: error
+
+  merge:
+    name: publish multi-arch manifest
+    needs: build
+    runs-on: ubuntu-24.04
+    steps:
+      - name: Image name (lower case)
+        run: echo 
"IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/mina-sshd-oqs-openssh" >> 
"$GITHUB_ENV"
+
+      - uses: 
actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 #v8.0.2
+        with:
+          path: /tmp/digests
+          pattern: digests-*
+          merge-multiple: true
+
+      - uses: 
docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 #v4.4.1
+
+      - uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f 
#v4.6.0
+        with:
+          registry: ghcr.io
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Create manifest list
+        working-directory: /tmp/digests
+        run: |
+          docker buildx imagetools create -t "${IMAGE}:${TAG}" \
+            $(printf "${IMAGE}@sha256:%s " *)
+
+      - name: Inspect
+        run: docker buildx imagetools inspect "${IMAGE}:${TAG}"
diff --git a/docker/oqs-openssh/Dockerfile b/docker/oqs-openssh/Dockerfile
new file mode 100644
index 000000000..99138dc16
--- /dev/null
+++ b/docker/oqs-openssh/Dockerfile
@@ -0,0 +1,86 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Small, multi-arch (linux/amd64, linux/arm64) OpenSSH server with PURE ML-KEM
+# key exchange (mlkem768-sha256, ...) and pure ML-DSA host/user keys
+# (ssh-mldsa-44/65/87), for MINA SSHD interoperability tests (GH-928).
+#
+# Based on the Open Quantum Safe OpenSSH fork (branch OQS-v10, OpenSSH 10.3p1).
+# Everything is compiled in the BUILD stage. The final image only has the
+# runtime files, so tests pull a small prebuilt image and need no compiler.
+#
+# Build:   docker buildx build --platform linux/amd64,linux/arm64 -t <name> .
+# Run:     docker run --rm -p 2222:22 <name>
+
+# Alpine 3.22.6 multi-arch index (includes linux/amd64 and linux/arm64).
+# The digest wins over the tag; update the digest to change the base image.
+FROM 
alpine:3.22.6@sha256:5291449c3df73caf6ed85e649dec1b9e818b39a5d8c871e97afc13e9cd5e8fa8
 AS build
+# Pinned versions. Change them together and re-run the interop tests.
+# LIBOQS_REF is the commit of the 0.16.0 tag.
+ARG LIBOQS_REF=5a1a854b0dc9f2141bdc771c555ee60c37950183
+ARG OQS_OPENSSH_REF=10d74f8b27da43705cfab85923ac7e1d769416f1
+RUN apk add --no-cache build-base cmake ninja git autoconf automake \
+        openssl-dev zlib-dev linux-headers
+WORKDIR /src
+
+# liboqs. Do NOT use OQS_MINIMAL_BUILD: ssh-oqs.c references many signature
+# algorithms (mayo, ...), so the fork does not compile against a trimmed 
liboqs.
+RUN git init liboqs \
+ && git -C liboqs fetch --depth 1 
https://github.com/open-quantum-safe/liboqs.git "${LIBOQS_REF}" \
+ && git -C liboqs checkout FETCH_HEAD \
+ && cmake -S liboqs -B liboqs/build -GNinja \
+        -DCMAKE_BUILD_TYPE=Release \
+        -DBUILD_SHARED_LIBS=ON \
+        -DCMAKE_INSTALL_PREFIX=/opt/oqs \
+        -DOQS_BUILD_ONLY_LIB=ON \
+        -DOQS_DIST_BUILD=ON \
+        -DOQS_USE_OPENSSL=ON \
+ && cmake --build liboqs/build \
+ && cmake --install liboqs/build
+
+# OQS-OpenSSH, installed under /opt/ssh.
+# The fork calls sshkey_clear_pkey() without a visible prototype (an upstream
+# header quirk). Its own CI hides this with -Wno-implicit-function-declaration;
+# GCC 14 (Alpine 3.22) needs the "-Wno-error=" form.
+RUN git init openssh \
+ && git -C openssh fetch --depth 1 
https://github.com/open-quantum-safe/openssh.git "${OQS_OPENSSH_REF}" \
+ && git -C openssh checkout FETCH_HEAD \
+ && cd openssh \
+ && autoreconf -i \
+ && ./configure --prefix=/opt/ssh --sysconfdir=/etc/ssh \
+        --with-ssl-dir=/usr --with-liboqs-dir=/opt/oqs \
+        --with-ldflags="-Wl,-rpath,/opt/oqs/lib" --with-libs=-lm \
+        --with-cflags="-Wno-error=implicit-function-declaration" \
+        --without-pam --without-selinux --with-privsep-path=/var/empty \
+ && make -j"$(nproc)" \
+ && make install-nokeys \
+ && strip /opt/ssh/sbin/sshd /opt/ssh/bin/ssh /opt/ssh/bin/ssh-keygen
+
+FROM 
alpine:3.22.6@sha256:5291449c3df73caf6ed85e649dec1b9e818b39a5d8c871e97afc13e9cd5e8fa8
+RUN apk add --no-cache libcrypto3 zlib \
+ && adduser -D -s /bin/sh test \
+ && passwd -u test \
+ && mkdir -p /var/empty /etc/ssh /home/test/.ssh \
+ && chown test:test /home/test/.ssh && chmod 700 /home/test/.ssh
+COPY --from=build /opt/oqs /opt/oqs
+COPY --from=build /opt/ssh /opt/ssh
+COPY sshd_config /etc/ssh/sshd_config
+COPY entrypoint.sh /entrypoint.sh
+RUN chmod +x /entrypoint.sh
+ENV PATH="/opt/ssh/bin:/opt/ssh/sbin:${PATH}"
+EXPOSE 22
+ENTRYPOINT ["/entrypoint.sh"]
diff --git a/docker/oqs-openssh/README.md b/docker/oqs-openssh/README.md
new file mode 100644
index 000000000..a07a8b84b
--- /dev/null
+++ b/docker/oqs-openssh/README.md
@@ -0,0 +1,99 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# OQS-OpenSSH test container (pure ML-KEM and pure ML-DSA)
+
+Interoperability test server for GH-928. It runs the Open Quantum Safe fork of 
OpenSSH
+(branch `OQS-v10`, OpenSSH 10.3p1 based) on Alpine 3.22.6. Compilation happens 
once, in the image build;
+the final image has only the runtime files, so tests pull a small prebuilt 
multi-arch image
+(`linux/amd64`, `linux/arm64`).
+
+The Alpine base image, liboqs (commit of the `0.16.0` tag) and OQS-OpenSSH are 
pinned in the
+[Dockerfile](Dockerfile).
+
+## What it supports
+
+- Pure ML-KEM key exchange, with the names of `draft-harrison-sshm-mlkem`:
+  `mlkem512-sha256`, `mlkem768-sha256`, `mlkem1024-sha384`.
+  (Hybrids such as `mlkem768x25519-sha256` are in the binary, but 
`sshd_config` does not enable them.)
+- Pure ML-DSA host and user keys, with the names of `draft-sfluhrer-ssh-mldsa`:
+  `ssh-mldsa-44`, `ssh-mldsa-65`, `ssh-mldsa-87`.
+- OQS composite keys (`ssh-rsa3072-mldsa-44`, ...). These are **not** the same 
as the
+  `ssh-mldsa44-ed25519` of OpenSSH 10.5.
+
+## Build and run
+
+```
+docker buildx build --platform linux/amd64,linux/arm64 -t 
<registry>/mina-sshd-oqs-openssh:<tag> --push .
+docker run --rm -p 2222:22 <registry>/mina-sshd-oqs-openssh:<tag>
+```
+
+- User `test`. Password login is disabled by default. Set the `TEST_PASSWORD` 
environment variable to set that
+  password and enable password login (the value must not contain line breaks).
+- Public keys: write `/home/test/.ssh/authorized_keys` (Testcontainers 
`withCopyToContainer`).
+  The file must belong to `test` with mode 600.
+- Host keys are generated at first start. Read the `.pub` files from 
`/etc/ssh` to build `known_hosts`.
+- Additional arguments are passed to `sshd`, for example `-o LogLevel=DEBUG3`. 
The default log level is `VERBOSE`.
+
+## Sanity test
+
+```
+./smoke-test.sh <image> docker   # or: podman
+```
+
+It prints `ALL OK` at the end. It checks the algorithm lists, then opens 
sessions with all three pure
+ML-KEM key exchanges and all three ML-DSA host keys, using an `ssh-mldsa-44` 
user key.
+
+Manual test:
+
+1. Start the server: `docker run -d --name oqs -p 2222:22 <image>`
+2. A stock OpenSSH client must be refused, since only pure ML-KEM is offered:
+   `ssh -p 2222 test@localhost true`
+   Expected: `no matching key exchange method found. Their offer: 
mlkem768-sha256,mlkem1024-sha384,mlkem512-sha256,...`
+3. Connect with the client inside the image:
+   ```
+   docker exec -u test oqs ssh-keygen -q -t ssh-mldsa-44 -N '' -f 
/home/test/.ssh/id
+   docker exec -u test oqs sh -c 'cp ~/.ssh/id.pub ~/.ssh/authorized_keys && 
chmod 600 ~/.ssh/authorized_keys'
+   docker exec -u test oqs ssh -v -o StrictHostKeyChecking=no \
+       -o KexAlgorithms=mlkem768-sha256 -o HostKeyAlgorithms=ssh-mldsa-65 \
+       -o PubkeyAcceptedAlgorithms=ssh-mldsa-44 -i /home/test/.ssh/id 
localhost echo OK
+   ```
+   Expected in the output: `kex: algorithm: mlkem768-sha256`, `Server host 
key: ssh-mldsa-65` and `OK`.
+4. Stop it: `docker rm -f oqs`
+
+## Notes
+
+1. **Fork.** The OQS fork describes itself as experimental. No other 
implementation with pure ML-KEM and
+   pure ML-DSA in a small image was found.
+2. **GCC 14 workaround.** The fork calls `sshkey_clear_pkey()` without a 
prototype.
+   `-Wno-error=implicit-function-declaration` hides it, as the fork's own CI 
does.
+3. **liboqs is not trimmed.** `OQS_MINIMAL_BUILD` breaks the build, because 
`ssh-oqs.c` references
+   many signature algorithms. `/opt/oqs` is therefore the largest part of the 
image.
+4. **ML-DSA private key format.** The format written by the fork's 
`ssh-keygen` is not checked against the
+   seed-only format of `draft-ietf-sshm-composite-sigs`.
+5. Host key algorithms in `sshd_config` are limited to the ML-DSA names and 
`ssh-ed25519`.
+
+## CI: build and publish (`.github/workflows/oqs-openssh-image.yml`)
+
+- Runs on `workflow_dispatch` (input: tag, default `dev`) and on pushes that 
touch this directory.
+- Builds each architecture on a native runner (`ubuntu-24.04`, 
`ubuntu-24.04-arm`), without QEMU.
+- Runs `smoke-test.sh` on each image.
+- Pushes each image by digest to `ghcr.io/<owner>/mina-sshd-oqs-openssh`, then 
joins them into one multi-arch tag.
+- All actions are pinned to commit hashes of ASF-approved versions.
+- Publishing under `ghcr.io/apache` needs to be enabled by ASF Infra.
diff --git a/docker/oqs-openssh/entrypoint.sh b/docker/oqs-openssh/entrypoint.sh
new file mode 100644
index 000000000..5eee3c1cc
--- /dev/null
+++ b/docker/oqs-openssh/entrypoint.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Generate host keys on first start, optionally enable password login for the 
test user, run sshd.
+set -e
+K=/etc/ssh
+[ -f "$K/ssh_host_ed25519_key" ] || ssh-keygen -q -t ed25519    -N '' -f 
"$K/ssh_host_ed25519_key"
+[ -f "$K/ssh_host_mldsa44_key" ] || ssh-keygen -q -t ssh-mldsa-44 -N '' -f 
"$K/ssh_host_mldsa44_key"
+[ -f "$K/ssh_host_mldsa65_key" ] || ssh-keygen -q -t ssh-mldsa-65 -N '' -f 
"$K/ssh_host_mldsa65_key"
+[ -f "$K/ssh_host_mldsa87_key" ] || ssh-keygen -q -t ssh-mldsa-87 -N '' -f 
"$K/ssh_host_mldsa87_key"
+
+if [ -n "${TEST_PASSWORD:-}" ]; then
+    nl='
+'
+    cr=$(printf '\r')
+    case $TEST_PASSWORD in
+        *"$nl"* | *"$cr"*)
+            echo "TEST_PASSWORD must not contain line breaks" >&2
+            exit 1
+            ;;
+    esac
+    printf 'test:%s\n' "$TEST_PASSWORD" | chpasswd
+    set -- -o PasswordAuthentication=yes "$@"
+fi
+exec /opt/ssh/sbin/sshd -D -e "$@"
diff --git a/docker/oqs-openssh/smoke-test.sh b/docker/oqs-openssh/smoke-test.sh
new file mode 100755
index 000000000..bde99dede
--- /dev/null
+++ b/docker/oqs-openssh/smoke-test.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Smoke test for the OQS-OpenSSH test image.
+# Usage: smoke-test.sh <image> [docker|podman]
+# Checks that pure ML-KEM and pure ML-DSA work in a real connection.
+set -eu
+IMAGE=${1:?usage: smoke-test.sh <image> [docker|podman]}
+CT=${2:-docker}
+NAME=oqs-smoke-$$
+trap '$CT rm -f "$NAME" >/dev/null 2>&1 || true' EXIT
+
+$CT run -d --name "$NAME" "$IMAGE" >/dev/null
+# Wait for sshd (host key generation happens at start).
+i=0
+until $CT logs "$NAME" 2>&1 | grep -q "Server listening"; do
+    i=$((i + 1)); [ $i -gt 60 ] && { echo "sshd did not start"; $CT logs 
"$NAME"; exit 1; }
+    sleep 1
+done
+
+ctr() { $CT exec "$NAME" sh -c "$1"; }
+
+echo "== architecture: $(ctr 'uname -m')"
+for k in mlkem512-sha256 mlkem768-sha256 mlkem1024-sha384; do
+    ctr 'ssh -Q kex' | grep -qx "$k" || { echo "FAIL kex $k is not available"; 
exit 1; }
+    echo "OK kex $k"
+done
+for k in ssh-mldsa-44 ssh-mldsa-65 ssh-mldsa-87; do
+    ctr 'ssh -Q key' | grep -qx "$k" || { echo "FAIL key $k is not available"; 
exit 1; }
+    echo "OK key $k"
+done
+
+ctr 'su test -c "ssh-keygen -q -t ssh-mldsa-44 -N \"\" -f ~/.ssh/id \
+   && cp ~/.ssh/id.pub ~/.ssh/authorized_keys && chmod 600 
~/.ssh/authorized_keys"'
+
+for kex in mlkem512-sha256 mlkem768-sha256 mlkem1024-sha384; do
+  for hk in ssh-mldsa-44 ssh-mldsa-65 ssh-mldsa-87; do
+    out=$(ctr "su test -c 'ssh -v -o StrictHostKeyChecking=no -o 
KexAlgorithms=$kex \
+        -o HostKeyAlgorithms=$hk -o PubkeyAcceptedAlgorithms=ssh-mldsa-44 -i 
/home/test/.ssh/id \
+        localhost echo CONNECTED_OK' 2>&1")
+    echo "$out" | grep -q "kex: algorithm: $kex" || { echo "FAIL kex $kex"; 
echo "$out"; exit 1; }
+    echo "$out" | grep -q "Server host key: $hk" || { echo "FAIL host key 
$hk"; echo "$out"; exit 1; }
+    echo "$out" | grep -q CONNECTED_OK || { echo "FAIL connect $kex/$hk"; echo 
"$out"; exit 1; }
+    echo "OK session kex=$kex hostkey=$hk user-key=ssh-mldsa-44"
+  done
+done
+echo "ALL OK"
diff --git a/docker/oqs-openssh/sshd_config b/docker/oqs-openssh/sshd_config
new file mode 100644
index 000000000..e5c98b863
--- /dev/null
+++ b/docker/oqs-openssh/sshd_config
@@ -0,0 +1,33 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Test server configuration. Only pure PQC algorithms for key exchange.
+Port 22
+HostKey /etc/ssh/ssh_host_mldsa44_key
+HostKey /etc/ssh/ssh_host_mldsa65_key
+HostKey /etc/ssh/ssh_host_mldsa87_key
+HostKey /etc/ssh/ssh_host_ed25519_key
+
+KexAlgorithms mlkem768-sha256,mlkem1024-sha384,mlkem512-sha256
+HostKeyAlgorithms ssh-mldsa-44,ssh-mldsa-65,ssh-mldsa-87,ssh-ed25519
+PubkeyAcceptedAlgorithms ssh-mldsa-44,ssh-mldsa-65,ssh-mldsa-87,ssh-ed25519
+
+PasswordAuthentication no
+PubkeyAuthentication yes
+PermitRootLogin no
+LogLevel VERBOSE
+AuthorizedKeysFile .ssh/authorized_keys

Reply via email to