1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
5 {%- set ssl_key_encrypted = pillar.get('ssl_key_encrypted', {'enabled': False}) %}
7 {%- if ssl_key_encrypted.enabled %}
9 extra_ssl_key_encrypted_required_pkgs:
14 extra_ssl_key_encrypted_password_retrieval_script:
16 - name: {{ ssl_key_encrypted.privkey_password_script }}
21 - pkg: extra_ssl_key_encrypted_required_pkgs
25 # RUNTIME_DIRECTORY is provided by systemd.
26 # NOTE: We assume systemd's set up in a way that there's just one
27 # runtime dir for this particular unit, otherwise this variable could
28 # contain multiple paths separated by a colon.
29 PASSWORD_FILE="${RUNTIME_DIRECTORY}/{{ ssl_key_encrypted.privkey_password_filename }}"
32 # AWS_SHARED_CREDENTIALS_FILE is set to /dev/null to avoid AWS's CLI
33 # loading invalid credentials on nodes who use ~/.aws/credentials for other
34 # purposes (e.g.: the dispatcher credentials)
35 # Access to the secrets manager is given by using an instance profile.
36 AWS_SHARED_CREDENTIALS_FILE=/dev/null aws secretsmanager get-secret-value --secret-id '{{ ssl_key_encrypted.aws_secret_name }}' --region '{{ ssl_key_encrypted.aws_region }}' | jq -r .SecretString > "${PASSWORD_FILE}"
40 extra_ssl_key_encrypted_password_retrieval_service_unit:
42 - name: /etc/systemd/system/password_secret_connector.service
47 - file: extra_ssl_key_encrypted_password_retrieval_script
50 Description=Arvados SSL private key password retrieval service
53 # WARNING: the script below assumes that RuntimeDirectory only holds one
54 # path value, won't work with multiple paths.
55 RuntimeDirectory=arvados
56 ExecStartPre=/usr/bin/mkfifo --mode=0600 {{ ('%t/arvados/' ~ ssl_key_encrypted.privkey_password_filename) | yaml_dquote }}
57 ExecStart=/bin/bash {{ ssl_key_encrypted.privkey_password_script | yaml_dquote }}
59 WantedBy=multi-user.target
61 extra_ssl_key_encrypted_password_retrieval_service:
63 - name: password_secret_connector
66 - file: extra_ssl_key_encrypted_password_retrieval_service_unit
68 - file: extra_ssl_key_encrypted_password_retrieval_service_unit
69 - file: extra_ssl_key_encrypted_password_retrieval_script