mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-10-24 15:08:10 +02:00
These accounts existed only for container UID mapping and filesystem ownership, but user.present omitted shell:, so Salt fell through to the platform useradd default and every one of them got /bin/bash. Pin them to /sbin/nologin so none can be used as an interactive login or `su -` target. socore keeps /bin/bash: `su socore -c '/usr/sbin/so-repo-sync'` in soup and so-kernel-upgrade execs the account's passwd shell, and operator docs tell users to su to socore. soqemussh keeps /bin/bash as an SSH login account. elastic-agent, elastic-agent-pr and kafka are included alongside the accounts named in the issue, being the same class with the same unset shell, so the default is uniform. Cron is unaffected: cronie runs jobs via the crontab SHELL (default /bin/sh), not the passwd shell. suricata is the only account changed here that owns a crontab, and somon has shipped as nologin with a working cron job already. The zeek `runuser -l zeek` calls all run inside so-zeek via docker.run/exec, so they resolve the shell from the image, not the host. Verified on a 3.4.0 managersearch + sensor grid: highstate converges with the shell as the only change and no failures, is idempotent on a second run, all containers stay up, SOC still issues a Kratos login flow, and the suricata surilogcompress cron job runs post-change ((suricata) CMD/CMDEND in /var/log/cron) while `su - suricata` is now refused. Closes #16256
90 lines
1.9 KiB
YAML+Jinja
90 lines
1.9 KiB
YAML+Jinja
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
|
|
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
|
|
# https://securityonion.net/license; you may not use this file except in compliance with the
|
|
# Elastic License 2.0.
|
|
|
|
{% from 'allowed_states.map.jinja' import allowed_states %}
|
|
{% if sls.split('.')[0] in allowed_states %}
|
|
{% from "kratos/map.jinja" import KRATOSMERGED %}
|
|
|
|
# Add Kratos Group
|
|
kratosgroup:
|
|
group.present:
|
|
- name: kratos
|
|
- gid: 928
|
|
|
|
kratoshome:
|
|
file.directory:
|
|
- name: /opt/so/conf/kratos
|
|
- user: 928
|
|
- group: 928
|
|
- mode: 700
|
|
- makedirs: True
|
|
|
|
# Add Kratos user
|
|
kratos:
|
|
user.present:
|
|
- uid: 928
|
|
- gid: 928
|
|
- home: /opt/so/conf/kratos
|
|
- shell: /sbin/nologin
|
|
|
|
kratosdir:
|
|
file.directory:
|
|
- name: /nsm/kratos
|
|
- user: 928
|
|
- group: 928
|
|
- mode: 700
|
|
- makedirs: True
|
|
|
|
kratosdbdir:
|
|
file.directory:
|
|
- name: /nsm/kratos/db
|
|
- user: 928
|
|
- group: 928
|
|
- mode: 700
|
|
- makedirs: True
|
|
|
|
kratoslogdir:
|
|
file.directory:
|
|
- name: /opt/so/log/kratos
|
|
- user: 928
|
|
- group: 928
|
|
- makedirs: True
|
|
|
|
kratosschema:
|
|
file.managed:
|
|
- name: /opt/so/conf/kratos/schema.json
|
|
- source: salt://kratos/files/schema.json
|
|
- user: 928
|
|
- group: 928
|
|
- mode: 600
|
|
|
|
kratosoidc:
|
|
file.managed:
|
|
- name: /opt/so/conf/kratos/oidc.jsonnet
|
|
- source: salt://kratos/files/oidc.jsonnet
|
|
- user: 928
|
|
- group: 928
|
|
- mode: 600
|
|
|
|
kratosconfig:
|
|
file.managed:
|
|
- name: /opt/so/conf/kratos/kratos.yaml
|
|
- source: salt://kratos/files/kratos.yaml.jinja
|
|
- user: 928
|
|
- group: 928
|
|
- mode: 600
|
|
- template: jinja
|
|
- show_changes: False
|
|
- defaults:
|
|
KRATOSMERGED: {{ KRATOSMERGED }}
|
|
|
|
{% else %}
|
|
|
|
{{sls}}_state_not_allowed:
|
|
test.fail_without_changes:
|
|
- name: {{sls}}_state_not_allowed
|
|
|
|
{% endif %}
|