Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image #12

Open
DragoMlakar opened this issue Oct 23, 2024 · 2 comments
Open

Docker image #12

DragoMlakar opened this issue Oct 23, 2024 · 2 comments
Labels
good first issue Good for newcomers question Further information is requested

Comments

@DragoMlakar
Copy link

Would be very convenient to just have docker image to use it. As it looks that already support linux os?

@harrison314
Copy link
Owner

harrison314 commented Oct 23, 2024

Would be very convenient to just have docker image to use it.

I am not planning a Docker Image at the moment, when I have more time I will at least make a tutorial and a docker file.
Well, pull requests are accepted.

As it looks that already support linux os?

Operating system support should be understood on two levels:

  • BouncyHsm (as application)
  • BouncyHsm.Pkcs11lib.so (as PKCS#11 native liberally).

BouncyHsm

BouncyHsm is .NET 8.0 application without native dependencies, run on all supported platforms https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md.

I tried it myself on Debian 12, RockyLinux 9, AlmaLinux 9, Ubuntu 24.04.

BouncyHsm.Pkcs11lib.so

BouncyHsm.Pkcs11lib is written in pure C with no external dependencies, so it should compile with gcc/Clang for any linux/unix system or architecture.

Github actions compile the native library on Ubuntu, and it works for Debian based systems (with the same version of glibc).

On REHEL based systems (RockyLinux 9, AlmaLinux 9), I compile the library directly on them https://github.com/harrison314/BouncyHsm/blob/main/Doc/BuildPkcs11Lib.md.
Likewise, the native library must be compiled for other systems that do not use glibc or have a different architecture (Alpine Linux, raspberry pi,...).
It should even compile for FreeBSD (I plan to try) and MacOS (I don't have HW).

Final note: The BouncyHSM application and the native library do not need to be on the same node (virtual machine). The native library only needs to set the TCP endpoint to which it should be connected via the environment variable. So it goes to test applications that run for example on FreeBSD (not supported for .NET 8) and have BouncyHSM running on another node that already supports .NET 8 (eg. Debian).

@harrison314 harrison314 added good first issue Good for newcomers question Further information is requested labels Oct 24, 2024
@MaxFichtelmann
Copy link

MaxFichtelmann commented Oct 29, 2024

I have recently built a simple image around BouncyHsm based on the prebuilt artifacts.

below Dockerfile should be a good starting point, but may need some adjustments in appsettings.json, especially to expose the port .

FROM alpine:3.20.3

ENV APP_VERSION=1.1.0

WORKDIR /unzip
ADD https://github.com/harrison314/BouncyHsm/releases/download/v${APP_VERSION}/BouncyHsm.zip .
RUN apk --update add unzip && rm -rf /var/cache/apk/* && unzip BouncyHsm.zip && rm BouncyHsm.zip

FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /App

COPY --from=0 /unzip /App

EXPOSE 8080
EXPOSE 8765
VOLUME /App/bin

CMD ["dotnet", "BouncyHsm.dll"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants