Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
53098e3
feat: add multiple token support to autologin script
raits Oct 13, 2025
20ae226
feat: improve autologin use in sidecar
raits Oct 14, 2025
cda13ac
chore: update autologin change related documentation
raits Oct 14, 2025
4c6ea16
chore: include autologin pins for e2e
raits Oct 15, 2025
ee9d466
chore(deps-dev): bump vitest from 3.2.4 to 4.0.6 in /src
dependabot[bot] Nov 3, 2025
d26fde7
docs: Update Introduction section with missing management services
melbeltagy Nov 7, 2025
fc4cac9
Merge branch 'nordic-institute:develop' into update-docs
melbeltagy Nov 11, 2025
ec1b20e
Update main version number pr-mserv_x-road_protocol_for_management_se…
melbeltagy Nov 11, 2025
748de92
Merge branch 'nordic-institute:develop' into update-docs
melbeltagy Nov 15, 2025
90d698f
chore: fix `key-management-api-whitelist` and `regular-api-whitelist`…
raits Nov 18, 2025
5ae1215
Merge pull request #3073 from nordic-institute/dependabot/npm_and_yar…
dependabot[bot] Nov 19, 2025
c5b054e
Merge branch 'develop' into XRDDEV-3042
raits Nov 19, 2025
aa8f184
chore: temp fix for check audit vulnerability GHSA-5j98-mcp5-4vw2
Nov 19, 2025
1f59de6
Merge pull request #3108 from nordic-institute/fix-check-audit-vulner…
mikkbachmann Nov 19, 2025
36bbf57
chore(deps): bump the javascript-minor-patch group across 1 directory…
dependabot[bot] Nov 19, 2025
0449dde
Merge branch 'develop' into XRDDEV-3042
raits Nov 19, 2025
a492753
Merge pull request #3106 from nordic-institute/dependabot/npm_and_yar…
dependabot[bot] Nov 19, 2025
e85b8a2
chore: bump documentation version for
raits Nov 20, 2025
1fac660
Merge branch 'develop' into XRDDEV-3020
raits Nov 20, 2025
dbd06fd
chore(deps): bump the javascript-minor-patch group
dependabot[bot] Nov 24, 2025
d5f04ba
Merge pull request #3029 from nordic-institute/XRDDEV-3020
raits Nov 24, 2025
14b45de
Merge pull request #3102 from nordic-institute/XRDDEV-3042
raits Nov 24, 2025
854d586
Merge pull request #3115 from nordic-institute/dependabot/npm_and_yar…
dependabot[bot] Nov 24, 2025
4bd4420
Merge pull request #3083 from melbeltagy/update-docs
raits Nov 26, 2025
d8e89ca
feat: better internal ip resolution for opmonitoring data processor (…
toomy4 Dec 1, 2025
7efa769
feat: add support for testing connections to other security servers o…
enelir Dec 2, 2025
52f8fb2
fix: support querying config directory from private parameter source …
enelir Dec 3, 2025
1196d6c
chore: Update ORT configuration
petkivim Dec 3, 2025
8c8b14f
chore: Update ORT configuration
petkivim Dec 3, 2025
169162e
Merge pull request #3136 from nordic-institute/20251203-update-ort-co…
admin-petkivim Dec 3, 2025
8018e4d
test: stabilize DiagnosticsApiControllerTest.getOtherSecurityServerSt…
enelir Dec 3, 2025
f1b416e
feat: new basic certificate profile with SAN included (#3134)
toomy4 Dec 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .ort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ resolutions:
- message: "property:advertising-clause license LicenseRef-scancode-rsa-md4 in Gradle:ee.ria.xroad:src:1.0."
reason: "LICENSE_ACQUIRED_EXCEPTION"
comment: "The LicenseRef-scancode-rsa-md4 in src/libs/iaikPkcs11Wrapper.AUTHORS is taken into account, and therefore the license conditions are satisfied."
- message: "property:advertising-clause license LicenseRef-scancode-rsa-md4 in Gradle:org.niis.xroad:x-road-core:1.0."
reason: "LICENSE_ACQUIRED_EXCEPTION"
comment: "The LicenseRef-scancode-rsa-md4 in src/libs/iaikPkcs11Wrapper.AUTHORS is taken into account, and therefore the license conditions are satisfied."
- message: "property:advertising-clause license LicenseRef-scancode-rsa-md4 in Unmanaged::X-Road:.*"
reason: "LICENSE_ACQUIRED_EXCEPTION"
comment: "The LicenseRef-scancode-rsa-md4 in src/libs/iaikPkcs11Wrapper.AUTHORS is taken into account, and therefore the license conditions are satisfied."
- message: "commercial license LicenseRef-scancode-proprietary-license in Maven:org.apache.commons:commons-compress:1.26.*"
reason: "LICENSE_ACQUIRED_EXCEPTION"
comment: "This PKWare technology is not in use, therefore license is sufficient."
Expand All @@ -196,6 +202,9 @@ resolutions:
- message: "proprietary-free license LicenseRef-verbatim-no-modifications in Maven:org.hsqldb:hsqldb:2.7.*"
reason: "NOT_MODIFIED_EXCEPTION"
comment: "The license represented by LicenseRef-verbatim-no-modifications allows redistributing without modifications. As long as the files licensed with the said license are redistributed without modifications, the condition is satisfied."
- message: "copyleft-strong license CC-BY-SA-3.0 in Unmanaged::X-Road:.*"
reason: "LICENSE_ACQUIRED_EXCEPTION"
comment: "The files meant by this license hit are not distributed with X-Road."

license_choices:
repository_license_choices:
Expand Down
6 changes: 2 additions & 4 deletions Docker/securityserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,14 @@ RUN useradd xrd-sec && adduser xrd-sec xroad-security-officer && sh -c "echo 'xr
&& adduser xroad softhsm

COPY --chown=xroad:xroad files/etc /etc/
COPY --chown=xroad:xroad files/usr/share/xroad/autologin/custom-fetch-pin.sh /usr/share/xroad/autologin/custom-fetch-pin.sh
COPY --chown=xroad:xroad build/libs /usr/share/xroad/jlib/

COPY files/ss-entrypoint.sh /root/entrypoint.sh
COPY --chown=xroad:xroad files/override-docker.ini /etc/xroad/conf.d/
COPY --chown=root:root files/ss-xroad.conf /etc/supervisor/conf.d/xroad.conf
COPY --chown=root:root files/ss-hwtoken-xroad.conf /etc/supervisor/conf.d/hwtoken-xroad.conf
COPY --chown=root:root files/ss-hwtoken-login-inactive-token.sh /usr/share/xroad/autologin/login-inactive-token.sh
RUN chmod 755 /usr/share/xroad/autologin/login-inactive-token.sh

CMD ["/root/entrypoint.sh"]

VOLUME ["/etc/xroad", "/var/lib/xroad", "/var/lib/postgresql/16/main/", "/var/lib/softhsm/tokens"]
EXPOSE 8080 8443 4000 5432 5500 5577 5558 80
EXPOSE 8080 8443 4000 5432 5500 5577 5558 80
17 changes: 16 additions & 1 deletion Docker/securityserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@ Alternatively, it's possible to use the image (`niis/xroad-security-server`) ava
## Running

Publish the container ports (`8080` and/or `8443`, `4000`, and optionally `5500` and `5577`) to localhost (loopback address).
Also, it's possible to pass the token pin code for autologin using the `XROAD_TOKEN_PIN` environment variable.
Also, it's possible to pass the token pin code for autologin using environment variables. Use `XROAD_TOKEN_PIN` for token 0, or `XROAD_TOKEN_<id>_PIN` for specific token IDs.

Running a locally built image:
```shell
docker run -p 127.0.0.1:4000:4000 -p 127.0.0.1:8080:8080 --name my-ss -e XROAD_TOKEN_PIN=1234 xroad-security-server
```

For multiple tokens:
```shell
docker run -p 127.0.0.1:4000:4000 -p 127.0.0.1:8080:8080 --name my-ss \
-e XROAD_TOKEN_0_PIN=1234 \
-e XROAD_TOKEN_1_PIN=5678 \
xroad-security-server
```

Running an image available on [Docker Hub](https://hub.docker.com/r/niis/xroad-security-server):
```shell
docker run -p 127.0.0.1:4000:4000 -p 127.0.0.1:8080:8080 --name my-ss -e XROAD_TOKEN_PIN=1234 niis/xroad-security-server:focal-7.1.0
Expand Down Expand Up @@ -97,3 +105,10 @@ One can create the autologin file by hand after initializing the Security Server
docker exec my-ss su -c 'echo 1234 >/etc/xroad/autologin' xroad
docker exec my-ss supervisorctl start xroad-autologin
```

For multiple tokens, use one line per token in the format `token-id:token-pin`:

```shell
docker exec my-ss su -c 'echo -e "0:1234\n1:5678" >/etc/xroad/autologin' xroad
docker exec my-ss supervisorctl start xroad-autologin
```
7 changes: 0 additions & 7 deletions Docker/securityserver/files/ss-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ else
echo "WARN: Installed version ($INSTALLED_VERSION) does not match packaged version ($PACKAGED_VERSION)" >&2
fi

if [ -n "$XROAD_TOKEN_PIN" ]
then
echo "XROAD_TOKEN_PIN variable set, writing to /etc/xroad/autologin"
echo "$XROAD_TOKEN_PIN" > /etc/xroad/autologin
unset XROAD_TOKEN_PIN
fi

log "Enabling public postgres access.."
sed -i 's/#listen_addresses = \x27localhost\x27/listen_addresses = \x27*\x27/g' /etc/postgresql/*/main/postgresql.conf
sed -ri 's/host replication all 127.0.0.1\/32/host all all 0.0.0.0\/0/g' /etc/postgresql/*/main/pg_hba.conf
Expand Down
10 changes: 0 additions & 10 deletions Docker/securityserver/files/ss-hwtoken-login-inactive-token.sh

This file was deleted.

8 changes: 0 additions & 8 deletions Docker/securityserver/files/ss-hwtoken-xroad.conf

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

file="/etc/xroad/autologin"

declare -a token_ids
declare -a token_pins
count=0

for var in $(compgen -e | grep '^XROAD_TOKEN_.\+_PIN$' | sort -V); do
token_id="${var#XROAD_TOKEN_}"
token_id="${token_id%_PIN}"
pin_value="${!var}"

if [ -n "$pin_value" ]; then
token_ids+=("$token_id")
token_pins+=("$pin_value")
((count++))
fi
done

if [ -n "$XROAD_TOKEN_PIN" ]; then
echo "${XROAD_TOKEN_PIN}"
exit 0
elif [ "$count" -eq 1 ] && [ "${token_ids[0]}" = "0" ]; then
echo "${token_pins[0]}"
exit 0
elif [ "$count" -eq 1 ] && [ "${token_ids[0]}" != "0" ]; then
>&2 echo "ERROR: Found XROAD_TOKEN_${token_ids[0]}_PIN but no other token PINs. Multiple token PINs are expected when using numbered tokens (other than 0)."
exit 127
elif [ "$count" -gt 1 ]; then
for i in "${!token_ids[@]}"; do
echo "${token_ids[$i]}:${token_pins[$i]}"
done
exit 0
elif [ -f "$file" ]
then
>&2 echo "XROAD_TOKEN_PIN variable is not set, returning PIN code at $file"
cat $file
exit 0
else
>&2 echo "PIN code not available at $file"
exit 127
fi
5 changes: 3 additions & 2 deletions Docker/xrd-dev-stack/compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ services:
ss1:
container_name: ss1
environment:
- XROAD_TOKEN_PIN=Secret1234
- XROAD_TOKEN_0_PIN=Secret1234
- XROAD_TOKEN_31_PIN=Secret1234
ports:
- "4300:4000" # Frontend
- "4310:8080" # Proxy
Expand Down Expand Up @@ -91,4 +92,4 @@ networks:
# Use implicitly named network so that is easier to add container outside the compose
xroad-network:
name: xroad-network
driver: bridge
driver: bridge
6 changes: 6 additions & 0 deletions Docker/xrd-dev-stack/compose.e2e.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# E2E specific hurl execution on boot.
services:
ss0:
environment:
- XROAD_TOKEN_PIN=Secret1234
ss1:
entrypoint: [ "/usr/local/bin/init-token-and-run-entrypoint.sh" ]
volumes:
- ./ss1/init-token-and-run-entrypoint.sh:/usr/local/bin/init-token-and-run-entrypoint.sh:ro
environment:
- XROAD_TOKEN_0_PIN=Secret1234
- XROAD_TOKEN_31_PIN=Secret1234

hurl:
command: >
Expand Down
3 changes: 2 additions & 1 deletion Docker/xrd-dev-stack/ss1/init-token-and-run-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ if ! grep -q "\[softhsm2\]" /etc/xroad/devices.ini 2>/dev/null; then
printf "\n[softhsm2]\n\
library = /usr/lib/softhsm/libsofthsm2.so\n\
slot_ids = %s\n\
token_id_format = 1\n\
os_locking_ok = true\n\
library_cant_create_os_threads = true\n" "$slot_id" >> /etc/xroad/devices.ini
fi

chown -R xroad /var/lib/softhsm/tokens

exec /root/entrypoint.sh
exec /root/entrypoint.sh
31 changes: 30 additions & 1 deletion ansible/roles/xroad-ca/files/home/ca/CA/sign_req.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,36 @@ trap 'status=$?; rm -rf "lock"; exit $status' INT TERM EXIT
set -e
SER=$(cat serial)
openssl req -in $2 -inform $INFORM -out csr/${SER}.csr
openssl ca -batch -config CA.cnf -extensions $EXT -days 7300 -notext -md sha256 -in csr/${SER}.csr

function opensslCA() {
openssl ca -batch -config CA.cnf \
-extensions $EXT \
-days 7300 \
-notext \
-md sha256 \
-in csr/${SER}.csr \
"$@"
}

if [ "$1" == "auth" ]; then
subjectAltName=$(openssl req -in csr/${SER}.csr -text -noout | grep -A1 "Subject Alternative Name" | tail -n1 | sed 's/^[ \t]*//')
if [ ! -z "$subjectAltName" ]; then
extensionsOverride="
[ auth_ext ]
basicConstraints = CA:FALSE
keyUsage = critical, digitalSignature, keyEncipherment, dataEncipherment, keyAgreement
extendedKeyUsage = clientAuth, serverAuth
subjectAltName = ${subjectAltName}
"
fi
fi

if [ ! -z "${extensionsOverride}" ]; then
opensslCA -extfile <(echo "$extensionsOverride")
else
opensslCA
fi

chmod 0664 index.txt
chmod 0664 serial
echo $SER>changed
Expand Down
30 changes: 0 additions & 30 deletions development/hurl/scenarios/setup.hurl
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,6 @@ Content-Type: application/json

HTTP 201

# Log in to the Security Servers token
PUT https://{{ss0_host}}:4000/api/v1/tokens/0/login
X-XSRF-TOKEN: {{ss0_xsrf_token}}
Content-Type: application/json
{
"password": "Secret1234"
}

HTTP *

# Get the CA name
GET https://{{ss0_host}}:4000/api/v1/certificate-authorities
X-XSRF-TOKEN: {{ss0_xsrf_token}}
Expand Down Expand Up @@ -597,16 +587,6 @@ Content-Type: application/json

HTTP 201

# Log in to the Security Servers token
PUT https://{{ss1_host}}:4000/api/v1/tokens/0/login
X-XSRF-TOKEN: {{ss1_xsrf_token}}
Content-Type: application/json
{
"password": "Secret1234"
}

HTTP *

# Add auth key to the Security Server token
POST https://{{ss1_host}}:4000/api/v1/tokens/0/keys-with-csrs
X-XSRF-TOKEN: {{ss1_xsrf_token}}
Expand Down Expand Up @@ -685,16 +665,6 @@ HTTP 200
[Captures]
ss1_token_id: jsonpath "$[?(@.type == 'HARDWARE')].id" nth 0

# Log in to the Security Servers token
PUT https://{{ss1_host}}:4000/api/v1/tokens/{{ss1_token_id}}/login
X-XSRF-TOKEN: {{ss1_xsrf_token}}
Content-Type: application/json
{
"password": "Secret1234"
}

HTTP *

# Add sign key to the Security Server token
POST https://{{ss1_host}}:4000/api/v1/tokens/{{ss1_token_id}}/keys-with-csrs
X-XSRF-TOKEN: {{ss1_xsrf_token}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# X-Road: Autologin User Guide

Version: 1.4
Version: 1.5
Doc. ID: UG-AUTOLOGIN


Expand All @@ -11,6 +11,7 @@ Doc. ID: UG-AUTOLOGIN
| 15.11.2018 | 1.2 | Ubuntu 18.04 updates |
| 11.09.2019 | 1.3 | Remove Ubuntu 14.04 support |
| 26.09.2022 | 1.4 | Remove Ubuntu 18.04 support |
| 14.10.2025 | 1.5 | Add multiple token support documentation |

## Table of Contents

Expand Down Expand Up @@ -44,23 +45,42 @@ See X-Road terms and abbreviations documentation \[[TA-TERMS](#Ref_TERMS)\].
* Ubuntu: apt install xroad-autologin
* RedHat: yum install xroad-autologin

2. If storing the PIN code on the server in plaintext is acceptable, create file `/etc/xroad/autologin` that contains the PIN code.
2. If storing the PIN code on the server in plaintext is acceptable, create file `/etc/xroad/autologin` that contains the PIN code(s).
* File should be readable by user `xroad`
* If `/etc/xroad/autologin` does not exists, and you have not implemented `custom-fetch-pin.sh`, the service will not start
3. If you do not want to store PIN code in plaintext, implement bash script
* For a single token (token ID 0), the file should contain just the PIN code:
```
1234
```
* For multiple tokens, each line should be in the format `token-id:token-pin`:
```
0:1234
1:5678
```
3. If you do not want to store PIN code in plaintext, implement bash script
`/usr/share/xroad/autologin/custom-fetch-pin.sh`
* The script needs to output the PIN code to stdout
* The script needs to output the PIN code(s) to stdout
* Script should be readable and executable by user `xroad`
* Script should exit with exit code
* 0 if it was able to fetch PIN code successfully
* 127 if it was not able to fetch PIN code, but this is not an actual error that should cause the service to fail (default implementation uses this if `/etc/xroad/autologin` does not exist)
* other exit codes in error situations that should cause the service to fail
* Single token example:
```bash
#!/bin/bash
PIN_CODE=$(curl https://some-address)
PIN_CODE=$(curl https://some-address/token-pin)
echo "${PIN_CODE}"
exit 0
```
* Multiple tokens example (output one `token-id:token-pin` per line):
```bash
#!/bin/bash
TOKEN_0_PIN=$(curl https://some-address/token-0-pin)
TOKEN_1_PIN=$(curl https://some-address/token-1-pin)
echo "0:${TOKEN_0_PIN}"
echo "1:${TOKEN_1_PIN}"
exit 0
```

### 2.2 Implementation details

Expand All @@ -70,4 +90,4 @@ See X-Road terms and abbreviations documentation \[[TA-TERMS](#Ref_TERMS)\].
* Wrapper script handles retries in error situations.
* Service tries to enter the PIN code using script `signer-console`
* If the PIN was correct or incorrect, it exits
* If an error occurred (for example because `xroad-signer` has not yet fully started), it keeps retrying indefinitely
* If an error occurred (for example because `xroad-signer` has not yet fully started or been initialised), it keeps retrying indefinitely
Loading
Loading