diff --git a/Makefile b/Makefile
index b4b6074c4..b8435c4c0 100644
--- a/Makefile
+++ b/Makefile
@@ -60,6 +60,7 @@ build/kanidmd: ## Build the kanidmd docker image locally
build/kanidmd:
@$(CONTAINER_TOOL) build $(CONTAINER_TOOL_ARGS) -f server/Dockerfile \
-t $(IMAGE_BASE)/server:$(IMAGE_VERSION) \
+ --platform $(IMAGE_ARCH) \
--build-arg "KANIDM_BUILD_PROFILE=container_generic" \
--build-arg "KANIDM_FEATURES=" \
$(CONTAINER_BUILD_ARGS) .
@@ -68,6 +69,7 @@ build/kanidmd:
build/radiusd: ## Build the radiusd docker image locally
build/radiusd:
@$(CONTAINER_TOOL) build $(CONTAINER_TOOL_ARGS) \
+ --platform $(IMAGE_ARCH) \
-f rlm_python/Dockerfile \
-t $(IMAGE_BASE)/radius:$(IMAGE_VERSION) .
diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md
index 0c5c5ff5c..719f9f53b 100644
--- a/book/src/SUMMARY.md
+++ b/book/src/SUMMARY.md
@@ -1,6 +1,7 @@
# Kanidm
- [Introduction to Kanidm](intro.md)
+- [Evaluation Quickstart](quickstart.md)
- [Installing the Server](installing_the_server.md)
- [Choosing a Domain Name](choosing_a_domain_name.md)
- [Preparing for your Deployment](prepare_the_server.md)
diff --git a/book/src/quickstart.md b/book/src/quickstart.md
new file mode 100644
index 000000000..ed43b82f2
--- /dev/null
+++ b/book/src/quickstart.md
@@ -0,0 +1,83 @@
+# Evaluation Quickstart
+
+This section will guide you through a quick setup of Kanidm for evaluation. It's recommended that
+for a production deployment you follow the steps in the
+[installation chapter](installing_the_server.html) instead as there are a number of security
+considerations you should understand.
+
+### Requirements
+
+- docker or podman
+- `x86_64` cpu supporting `x86_64_v2` OR `aarch64` cpu supporting `neon`
+
+### Get the software
+
+```bash
+docker pull kanidm/server:latest
+```
+
+### Configure the container
+
+```bash
+docker volume create kanidmd
+docker create --name kanidmd \
+ -p 443:8443 \
+ -p 636:3636 \
+ -v kanidmd:/data \
+ kanidm/server:latest
+```
+
+### Configure the server
+
+Create server.toml
+
+```toml
+{{#rustdoc_include ../../examples/server_container.toml}}
+```
+
+### Add configuration to container
+
+```bash
+docker cp server.toml kanidmd:/data/server.toml
+```
+
+### Generate evaluation certificates
+
+```bash
+docker run --rm -i -t -v kanidmd:/data \
+ kanidm/server:latest \
+ kanidmd cert-generate -c /data/server.toml
+```
+
+### Recover the admin password
+
+```bash
+docker run --rm -i -t -v kanidmd:/data \
+ kanidm/server:latest \
+ kanidmd recover-account admin -c /data/server.toml
+```
+
+### Start Kanidmd
+
+```bash
+docker start kanidmd
+```
+
+### Setup the client configuration
+
+```toml
+# ~/.config/kanidm
+
+uri = "https://localhost:443"
+verify_ca = false
+```
+
+### Check you can login
+
+```bash
+kanidm login
+```
+
+### What next?
+
+You can now follow the steps in the [administration section](administrivia.md)
diff --git a/examples/kanidm b/examples/kanidm
index 1a9b1a959..efb0431da 100644
--- a/examples/kanidm
+++ b/examples/kanidm
@@ -19,8 +19,8 @@ auth_token = "putyourtokenhere"
radius_cert_path = "/certs/cert.pem" # the TLS certificate
radius_key_path = "/certs/key.pem" # the signing key for radius TLS
-radius_dh_path = "/certs/dh.pem" # the diffie-hellman output
radius_ca_path = "/certs/ca.pem" # the CA certificate
+radius_dh_path = "/certs/dh.pem" # the diffie-hellman output
# A list of groups, if a user is in them, they're approved for RADIUS authentication
radius_required_groups = [
@@ -42,4 +42,4 @@ radius_clients = [
]
# The client connection timeout, in seconds.
-connect_timeout = 30
\ No newline at end of file
+connect_timeout = 30
diff --git a/rlm_python/Dockerfile b/rlm_python/Dockerfile
index 56fbfbcc9..ff0e8a16f 100644
--- a/rlm_python/Dockerfile
+++ b/rlm_python/Dockerfile
@@ -47,7 +47,6 @@ RUN python3 -m pip install --no-cache-dir --no-warn-script-location /pkg/pykanid
COPY rlm_python/radius_entrypoint.py /radius_entrypoint.py
-ENV LD_PRELOAD=/usr/lib64/libpython3.so
ENV KANIDM_CONFIG_FILE="/data/kanidm"
RUN chmod a+r /etc/raddb/certs/ -R
diff --git a/rlm_python/radius_entrypoint.py b/rlm_python/radius_entrypoint.py
index b881e7a39..3c2cbaa14 100644
--- a/rlm_python/radius_entrypoint.py
+++ b/rlm_python/radius_entrypoint.py
@@ -79,12 +79,15 @@ def setup_certs(
if kanidm_config_object.radius_dh_path is not None:
cert_dh = Path(kanidm_config_object.radius_dh_path).expanduser().resolve()
if not cert_dh.exists():
- print(f"Failed to find radiusd dh file ({cert_dh}), quitting!", file=sys.stderr)
- sys.exit(1)
+ # print(f"Failed to find radiusd dh file ({cert_dh}), quitting!", file=sys.stderr)
+ # sys.exit(1)
+ print(f"Generating dh params in {cert_dh}")
+ subprocess.check_call(["openssl", "dhparam", "-out", cert_dh, "2048"])
if cert_dh != CERT_DH_DEST:
print(f"Copying {cert_dh} to {CERT_DH_DEST}")
shutil.copyfile(cert_dh, CERT_DH_DEST)
+
server_key = Path(kanidm_config_object.radius_key_path).expanduser().resolve()
if not server_key.exists() or not server_key.is_file():
print(
diff --git a/rlm_python/run_radius_container.sh b/rlm_python/run_radius_container.sh
index d73e8ec07..b58d6fc80 100755
--- a/rlm_python/run_radius_container.sh
+++ b/rlm_python/run_radius_container.sh
@@ -1,23 +1,29 @@
#!/bin/bash
set -x
+
if [ -z "${IMAGE}" ]; then
IMAGE="kanidm/radius:devel"
fi
echo "Running docker container: ${IMAGE}"
+if [ ! -z "${IMAGE_ARCH}" ]; then
+ IMAGE_ARCH="--platform ${IMAGE_ARCH}"
+fi
+
if [ -z "${CONFIG_FILE}" ]; then
CONFIG_FILE="$(pwd)/../examples/kanidm"
fi
echo "Using config file: ${CONFIG_FILE}"
if [ ! -d "/tmp/kanidm/" ]; then
- echo "Can't find /tmp/kanidm - you might need to run insecure_generate_tls.sh"
+ echo "Can't find /tmp/kanidm - you may need to run run_insecure_dev_server"
fi
echo "Starting the dev container..."
#shellcheck disable=SC2068
docker run --rm -it \
+ ${IMAGE_ARCH} \
--network host \
--name radiusd \
-v /tmp/kanidm/:/data/ \
diff --git a/server/core/src/crypto.rs b/server/core/src/crypto.rs
index 5bd96da7f..f19886ab6 100644
--- a/server/core/src/crypto.rs
+++ b/server/core/src/crypto.rs
@@ -1,11 +1,28 @@
//! This module contains cryptographic setup code, a long with what policy
//! and ciphers we accept.
+use openssl::ec::{EcGroup, EcKey};
use openssl::error::ErrorStack;
+use openssl::nid::Nid;
use openssl::ssl::{SslAcceptor, SslAcceptorBuilder, SslFiletype, SslMethod};
+use openssl::x509::{
+ extension::{
+ AuthorityKeyIdentifier, BasicConstraints, KeyUsage, SubjectAlternativeName,
+ SubjectKeyIdentifier,
+ },
+ X509NameBuilder, X509ReqBuilder, X509,
+};
+use openssl::{asn1, bn, hash, pkey};
use crate::config::Configuration;
+use std::fs::File;
+use std::io::{Read, Write};
+use std::path::Path;
+
+const CA_VALID_DAYS: u32 = 30;
+const CERT_VALID_DAYS: u32 = 5;
+
/// From the server configuration, generate an OpenSSL acceptor that we can use
/// to build our sockets for https/ldaps.
pub fn setup_tls(config: &Configuration) -> Result