221 cm.index_certs(dir, files_by_name); |
221 cm.index_certs(dir, files_by_name); |
222 end |
222 end |
223 local imported = {}; |
223 local imported = {}; |
224 for _, host in ipairs(hostnames) do |
224 for _, host in ipairs(hostnames) do |
225 local paths = cm.find_cert_in_index(files_by_name, host); |
225 local paths = cm.find_cert_in_index(files_by_name, host); |
226 if paths and not imported[paths.certificate] then |
226 if paths and imported[paths.certificate] then |
227 -- One certificate, many mames! |
227 -- One certificate, many mames! |
228 table.insert(imported, host); |
228 table.insert(imported, host); |
229 elseif paths then |
229 elseif paths then |
230 copy(paths.certificate, cert_basedir .. "/" .. host .. ".crt", nil, owner, group); |
230 copy(paths.certificate, cert_basedir .. "/" .. host .. ".crt", nil, owner, group); |
231 copy(paths.key, cert_basedir .. "/" .. host .. ".key", "0377", owner, group); |
231 copy(paths.key, cert_basedir .. "/" .. host .. ".key", "0377", owner, group); |