-
Notifications
You must be signed in to change notification settings - Fork 19
Open slurmdbd.conf to full customization; Enable slurmdbd purge by default #214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,9 @@ | ||
| {{ ansible_managed | comment }} | ||
| # | ||
| # Example slurmdbd.conf file. | ||
| # | ||
| # Set openhpc_default_slurmdbd_config and openhpc_slurmdb_config to modify it. | ||
| # See the slurmdbd.conf man page for more information. | ||
| # | ||
| # Archive info | ||
| #ArchiveJobs=yes | ||
| #ArchiveDir="/tmp" | ||
| #ArchiveSteps=yes | ||
| #ArchiveScript= | ||
| #JobPurge=12 | ||
| #StepPurge=1 | ||
| # | ||
| # Authentication info | ||
| AuthType=auth/munge | ||
| #AuthInfo=/var/run/munge/munge.socket.2 | ||
| # | ||
| # slurmDBD info | ||
| DbdHost={{ openhpc_slurmdbd_host }} | ||
| DbdAddr={{ openhpc_slurmdbd_host }} | ||
| DbdPort={{ openhpc_slurmdbd_port }} | ||
| SlurmUser=slurm | ||
| #MessageTimeout=300 | ||
| DebugLevel=4 | ||
| #DefaultQOS=normal,standby | ||
| # NOTE: By default, slurmdbd will log to syslog | ||
| #LogFile=/var/log/slurm/slurmdbd.log | ||
| PidFile=/var/run/slurmdbd.pid | ||
| #PluginDir=/usr/lib/slurm | ||
| #PrivateData=accounts,users,usage,jobs | ||
| #TrackWCKey=yes | ||
| # | ||
| # Database info | ||
| StorageType=accounting_storage/mysql | ||
| StorageHost={{ openhpc_slurmdbd_mysql_host }} | ||
| StorageUser={{ openhpc_slurmdbd_mysql_username }} | ||
| StoragePass={{ openhpc_slurmdbd_mysql_password | mandatory('You must set openhpc_slurmdbd_mysql_password') }} | ||
| StorageLoc={{ openhpc_slurmdbd_mysql_database }} | ||
|
|
||
| {% for key, val in openhpc_slurmdbd_merged_config.items() | sort %} | ||
| {% if val is not none and val != 'omit' %} | ||
| {{ key }}={{ 'yes' if val is sameas true else ('no' if val is sameas false else val|string) }} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,4 +19,27 @@ ohpc_slurm_packages: | |
| - "slurm-slurmdbd-ohpc" | ||
|
|
||
| openhpc_merged_config: "{{ openhpc_default_config | combine(openhpc_config) }}" | ||
|
|
||
| ohpc_nodegroups_computed: > | ||
| { | ||
| {% for nodegroup in openhpc_nodegroups %} | ||
| {% set inventory_group_name = openhpc_cluster_name ~ '_' ~ nodegroup.name %} | ||
| {% set inventory_group_hosts = groups.get(inventory_group_name, []) %} | ||
| {% if inventory_group_hosts | length > 0 %} | ||
| {% set play_group_hosts = inventory_group_hosts | intersect (play_hosts) %} | ||
| {% set first_host = play_group_hosts | first | mandatory('Inventory group "' ~ inventory_group_name ~ '" contains no hosts in this play - was --limit used?') %} | ||
| {% set first_host_hv = hostvars[first_host] %} | ||
| {% set ram_mb = (first_host_hv['ansible_memory_mb']['real']['total'] * (nodegroup.ram_multiplier | default(openhpc_ram_multiplier))) | int %} | ||
| {{ nodegroup.name | to_json }}: { | ||
| "inventory_group_name": {{ inventory_group_name | to_json }}, | ||
| "first_host": {{ first_host | to_json }}, | ||
| "ram_mb": {{ ram_mb }}, | ||
| "def_mem_per_cpu": {{ (ram_mb / first_host_hv['ansible_processor_vcpus']) | int }}, | ||
| }, | ||
| {% endif %} | ||
| {% endfor %} | ||
| } | ||
|
Comment on lines
+23
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current implementation for constructing ohpc_nodegroups_computed: >
{
{% set items = [] %}
{% for nodegroup in openhpc_nodegroups %}
{% set inventory_group_name = openhpc_cluster_name ~ '_' ~ nodegroup.name %}
{% set inventory_group_hosts = groups.get(inventory_group_name, []) %}
{% if inventory_group_hosts | length > 0 %}
{% set play_group_hosts = inventory_group_hosts | intersect (play_hosts) %}
{% set first_host = play_group_hosts | first | mandatory('Inventory group "' ~ inventory_group_name ~ '" contains no hosts in this play - was --limit used?') %}
{% set first_host_hv = hostvars[first_host] %}
{% set ram_mb = (first_host_hv['ansible_memory_mb']['real']['total'] * (nodegroup.ram_multiplier | default(openhpc_ram_multiplier))) | int %}
{% capture item_str %}
{{ nodegroup.name | to_json }}: {
"inventory_group_name": {{ inventory_group_name | to_json }},
"first_host": {{ first_host | to_json }},
"ram_mb": {{ ram_mb }},
"def_mem_per_cpu": {{ (ram_mb / first_host_hv['ansible_processor_vcpus']) | int }}
}
{% endcapture %}
{% set _ = items.append(item_str) %}
{% endif %}
{% endfor %}
{{ items | join(',\n') }}
} |
||
|
|
||
| openhpc_slurmdbd_merged_config: "{{ openhpc_slurmdbd_default_config | combine(openhpc_slurmdbd_config) }}" | ||
|
|
||
| ... | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loop used to generate
slurmdbd.confis vulnerable to configuration injection. If any of the keys or values inopenhpc_slurmdbd_merged_configcontain newline characters, an attacker who can control these variables can inject arbitrary configuration directives into theslurmdbd.conffile. This could lead to unauthorized configuration changes, such as modifying authentication settings or log file locations. Additionally, values containing special characters like#or spaces are not properly quoted, which can lead to parsing errors or truncated values (e.g., in passwords).