Skip to content

Commit 3346538

Browse files
authored
Merge pull request #179 from Turgon37/feature/178
#178 Add single quote around all domains names in shell commands
2 parents 1d39b2b + 66fc5ec commit 3346538

File tree

2 files changed

+38
-37
lines changed

2 files changed

+38
-37
lines changed

manifests/certonly.pp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,30 +99,31 @@
9999
'webroot': {
100100
$_plugin_args = zip($domains, $webroot_paths).map |$domain| {
101101
if $domain[1] {
102-
"--webroot-path ${domain[1]} -d ${domain[0]}"
102+
"--webroot-path ${domain[1]} -d '${domain[0]}'"
103103
} else {
104-
"-d ${domain[0]}"
104+
"-d '${domain[0]}'"
105105
}
106106
}
107-
$plugin_args = ["--cert-name ${title}"] + $_plugin_args
107+
$plugin_args = ["--cert-name '${title}'"] + $_plugin_args
108108
}
109109

110110
'dns-rfc2136': {
111111
require letsencrypt::plugin::dns_rfc2136
112+
$_domains = join($domains, '\' -d \'')
112113
$plugin_args = [
113-
"--cert-name ${title} -d",
114-
join($domains, ' -d '),
114+
"--cert-name '${title}' -d",
115+
"'${_domains}'",
115116
"--dns-rfc2136-credentials ${letsencrypt::plugin::dns_rfc2136::config_dir}/dns-rfc2136.ini",
116117
"--dns-rfc2136-propagation-seconds ${letsencrypt::plugin::dns_rfc2136::propagation_seconds}",
117118
]
118119
}
119120

120121
default: {
121122
if $ensure == 'present' {
122-
$_plugin_args = join($domains, ' -d ')
123-
$plugin_args = "--cert-name ${title} -d ${_plugin_args}"
123+
$_domains = join($domains, '\' -d \'')
124+
$plugin_args = "--cert-name '${title}' -d '${_domains}'"
124125
} else {
125-
$plugin_args = "--cert-name ${title}"
126+
$plugin_args = "--cert-name '${title}'"
126127
}
127128
}
128129
}
@@ -158,12 +159,12 @@
158159
$command = join($_command, ' ')
159160

160161
$execution_environment = [ "VENV_PATH=${letsencrypt::venv_path}", ] + $environment
161-
$verify_domains = join(unique($domains), ' ')
162+
$verify_domains = join(unique($domains), '\' \'')
162163

163164
if $ensure == 'present' {
164-
$exec_ensure = { 'unless' => "/usr/local/sbin/letsencrypt-domain-validation ${live_path} ${verify_domains}" }
165+
$exec_ensure = { 'unless' => "/usr/local/sbin/letsencrypt-domain-validation ${live_path} '${verify_domains}'" }
165166
} else {
166-
$exec_ensure = { 'onlyif' => "/usr/local/sbin/letsencrypt-domain-validation ${live_path} ${verify_domains}" }
167+
$exec_ensure = { 'onlyif' => "/usr/local/sbin/letsencrypt-domain-validation ${live_path} '${verify_domains}'" }
167168
}
168169

169170
exec { "letsencrypt certonly ${title}":

0 commit comments

Comments
 (0)