Skip to content

Commit e70e7fd

Browse files
authored
Merge pull request #1487 from puppetlabs/maint-harden_config_class
Harden config class
2 parents 6f531ad + 1c1291d commit e70e7fd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

manifests/server/config.pp

+8-3
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,19 @@
3939
if $managed_dirs {
4040
$managed_dirs.each | $entry | {
4141
$dir = $options['mysqld']["${entry}"]
42+
4243
if ( $dir and $dir != '/usr' and $dir != '/tmp' ) {
44+
$clean_dir = shell_escape($dir)
45+
$clean_package_name = shell_escape($mysql::server::package_name)
46+
4347
exec { "${entry}-managed_dir-mkdir":
44-
command => "/bin/mkdir -p ${dir}",
45-
unless => "/usr/bin/dpkg -s ${mysql::server::package_name}",
48+
command => ['/bin/mkdir', '-p', $clean_dir],
49+
unless => [['/usr/bin/dpkg', '-s', $clean_package_name]],
4650
notify => Exec["${entry}-managed_dir-chmod"],
4751
}
52+
4853
exec { "${entry}-managed_dir-chmod":
49-
command => "/bin/chmod 777 ${dir}",
54+
command => ['/bin/chmod', '777', $clean_dir],
5055
refreshonly => true,
5156
}
5257
}

0 commit comments

Comments
 (0)