res << "; certfile #{certfile} did not exist to create TLSA record for #{hostname}:#{port}."
end
- certfile += ".new"
- if File.exist?(certfile)
+ if certfile.gsub!(/\.crt$/, '-new.crt') and File.exist?(certfile)
cmd = ['swede', 'create', '--usage=3', '--selector=1', '--mtype=1', '--certificate', certfile, '--port', port.to_s, hostname]
new_entry = ''
IO.popen(cmd, "r") {|i| new_entry = i.read }
--- /dev/null
+-----BEGIN CERTIFICATE-----
+MIIDHzCCAgegAwIBAgIJALpdQlHYJDSyMA0GCSqGSIb3DQEBBQUAMCYxJDAiBgNV
+BAMMG3NlY3VyaXR5LXRyYWNrZXIuZGViaWFuLm9yZzAeFw0xMzA3MjkxOTM5MjJa
+Fw0xNDA3MjkxOTM5MjJaMCYxJDAiBgNVBAMMG3NlY3VyaXR5LXRyYWNrZXIuZGVi
+aWFuLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOOkzy1q8KVH
+U3AxO8oLqHYGYMCy+wQgVJ8ufrgKk7yzbIQ9TdYDM9ER4xaPRL7Cwzv5PxV6N8Kq
+cZP+2YwHBZEyVj2yzvkjitZ8JsXR3ahghjCtAwIPTy2ff81cDp4EAMA2nJv8rAM0
+Uk7ewnXLol6W8+K82sL3MpFca6lpj0jY9GzSowro0zJsaEx2T0Q7cViPiBX6DQsR
+vss5dOfuFpPoVpLOdL8P5B4Y2Uk0PdLiGo/tw1OoyXGZBWAGHAHAWulJDVke9I6b
+Vmk3gf8WLgnitkofKGqsmrU5WBCMErczplLhKFYvKJJO9mMYDOtxoNrGedc749r9
+dO+uK2uo72UCAwEAAaNQME4wHQYDVR0OBBYEFGoncsaDaPkWQv423sHyxzZmsOgR
+MB8GA1UdIwQYMBaAFGoncsaDaPkWQv423sHyxzZmsOgRMAwGA1UdEwQFMAMBAf8w
+DQYJKoZIhvcNAQEFBQADggEBALcwUS4dab8l5/EgkFPo8B2G/KYuhA5c8UXyozsT
+PTdxl1FHl7NHKhXn3AvWZEdGb0RBd4iHCHYDw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