added orca docker file, make target and credential reset capabilities (#2846)

* added orca docker file and make target
* made clippy happy
* fixed Orca dockerfile
* Update tools/orca/src/profile.rs
* trying to fix debian builds

---------

Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
This commit is contained in:
Sebastiano Tocci 2024-07-04 02:38:10 +02:00 committed by GitHub
parent 3ec9b320a1
commit 772c6ca9f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 92 additions and 0 deletions

View file

@ -95,6 +95,17 @@ build/kanidmd:
--label "com.kanidm.version=$(IMAGE_EXT_VERSION)" \
$(CONTAINER_BUILD_ARGS) .
.PHONY: build/orca
build/orca: ## Build the orca docker image locally
build/orca:
@$(CONTAINER_TOOL) build $(CONTAINER_TOOL_ARGS) -f tools/orca/Dockerfile \
-t $(IMAGE_BASE)/orca:$(IMAGE_VERSION) \
--build-arg "KANIDM_BUILD_PROFILE=container_generic" \
--build-arg "KANIDM_FEATURES=" \
--label "com.kanidm.git-commit=$(GIT_COMMIT)" \
--label "com.kanidm.version=$(IMAGE_EXT_VERSION)" \
$(CONTAINER_BUILD_ARGS) .
.PHONY: build/radiusd
build/radiusd: ## Build the radiusd docker image locally
build/radiusd:

View file

@ -17,6 +17,7 @@ ${SUDOCMD} apt-get install -y \
curl \
rsync \
git \
cmake \
build-essential \
jq \
tpm-udev

70
tools/orca/Dockerfile Normal file
View file

@ -0,0 +1,70 @@
# This builds the kanidm CLI tools
ARG BASE_IMAGE=opensuse/tumbleweed:latest
# ARG BASE_IMAGE=opensuse/leap:15.5
FROM ${BASE_IMAGE} AS repos
ADD ../../scripts/zypper_fixing.sh /zypper_fixing.sh
RUN --mount=type=cache,id=zypp,target=/var/cache/zypp /zypper_fixing.sh
FROM repos AS builder
ARG KANIDM_FEATURES
ARG KANIDM_BUILD_PROFILE
ARG KANIDM_BUILD_OPTIONS=""
# Set the build profile
ENV KANIDM_BUILD_PROFILE=${KANIDM_BUILD_PROFILE:-container_generic}
ENV RUSTFLAGS="-Clinker=clang -Clink-arg=-fuse-ld=/usr/bin/ld.mold"
RUN \
--mount=type=cache,id=zypp,target=/var/cache/zypp \
zypper install -y --no-recommends \
sccache \
cargo \
clang \
make \
automake \
autoconf \
libopenssl-3-devel \
pam-devel \
libudev-devel \
sqlite3-devel \
rsync \
mold
COPY . /usr/src/kanidm
WORKDIR /usr/src/kanidm/
# build the CLI
RUN \
--mount=type=cache,id=cargo,target=/cargo \
--mount=type=cache,id=sccache,target=/sccache \
export CARGO_HOME=/cargo; \
export SCCACHE_DIR=/sccache; \
export RUSTC_WRAPPER=/usr/bin/sccache; \
export CC="/usr/bin/clang"; \
cargo build -p orca ${KANIDM_BUILD_OPTIONS} \
--target-dir="/usr/src/kanidm/target/" \
--features="${KANIDM_FEATURES}" \
--release && \
cargo install \
--git https://github.com/kanidm/webauthn-rs.git \
--rev 5f4db4172f8e22aedc68c282d177e98db2b1892f \
--force fido-mds-tool \
--target-dir="/usr/src/kanidm/target/" && \
sccache -s
# == Construct the orca container
FROM repos
ENV RUST_BACKTRACE 1
COPY --from=builder /usr/src/kanidm/target/release/orca /sbin/
COPY ./tools/orca/profile-sample.toml /etc/kanidm/profile-sample.toml
RUN chmod +x /sbin/orca
CMD [ "/sbin/orca", "-h" ]

View file

@ -0,0 +1,10 @@
control_uri = "https://localhost:8443"
admin_password = ""
idm_admin_password = ""
seed = -1236045086759770365
extra_uris = []
warmup_time = 10
test_time = 180
group_count = 5
person_count = 500
thread_count = 20