Skip to content

Commit dd032fa

Browse files
KrisBuytaertlandervdb
authored andcommitted
Fix permissions on sensitive config files
Signed-off-by: Lander Van den Bulcke <[email protected]>
1 parent acd6ad7 commit dd032fa

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

manifests/config.pp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,17 @@
4343

4444
if $manage_storage_config {
4545
thanos::config::storage { $storage_config_file:
46-
* => $storage_config,
46+
user => $thanos::user,
47+
group => $thanos::group,
48+
* => $storage_config,
4749
}
4850
}
4951

5052
if $manage_tracing_config {
5153
thanos::config::tracing { $tracing_config_file:
52-
* => $tracing_config,
54+
user => $thanos::user,
55+
group => $thanos::group,
56+
* => $tracing_config,
5357
}
5458
}
5559

manifests/config/storage.pp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# One of ['S3', 'GCS', 'AZURE', 'SWIFT', 'COS', 'ALIYUNOSS', 'FILESYSTEM']
1010
# @param config
1111
# Configuration to typed storage.
12-
# @param prefix
12+
# @param prefix
1313
# Set the prefix for to be used on the storage
1414
# @example
1515
# thanos::config::storage { '/etc/thanos/storage.yaml':
@@ -23,6 +23,8 @@
2323
Enum['present', 'absent'] $ensure,
2424
Thanos::Storage_type $type,
2525
Hash[String, Data] $config,
26+
String $user,
27+
String $group,
2628
String $prefix = '',
2729
) {
2830
$_ensure = $ensure ? {
@@ -39,5 +41,8 @@
3941
file { $title:
4042
ensure => $_ensure,
4143
content => $configs.to_yaml(),
44+
owner => $user,
45+
group => $group,
46+
mode => '0600',
4247
}
4348
}

manifests/config/tracing.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
Enum['present', 'absent'] $ensure,
2020
Thanos::Tracing_type $type,
2121
Hash[String, Data] $config,
22+
String $user,
23+
String $group,
2224
) {
2325
$_ensure = $ensure ? {
2426
'present' => 'file',
@@ -33,5 +35,8 @@
3335
file { $title:
3436
ensure => $_ensure,
3537
content => $configs.to_yaml(),
38+
owner => $user,
39+
group => $group,
40+
mode => '0600',
3641
}
3742
}

0 commit comments

Comments
 (0)