@@ -2401,19 +2401,23 @@ public function make_ispconfig_ssl_cert() {
24012401 global $ conf , $ autoinstall ;
24022402
24032403 // Get hostname from user entry or shell command
2404- if ($ conf ['hostname ' ] !== ('localhost ' || '' ) ) $ hostname = $ conf ['hostname ' ];
2404+ if ($ conf ['hostname ' ] !== ('localhost ' || '' )) $ hostname = $ conf ['hostname ' ];
24052405 else $ hostname = exec ('hostname -f ' );
24062406
24072407 // Check dns a record exist and its ip equal to server public ip
24082408 $ svr_ip = file_get_contents ('http://dynamicdns.park-your-domain.com/getip ' );
24092409 if (checkdnsrr (idn_to_ascii ($ hostname , IDNA_NONTRANSITIONAL_TO_ASCII , INTL_IDNA_VARIANT_UTS46 ), 'A ' )) {
2410- $ dnsa =dns_get_record ($ hostname , DNS_A ); $ dns_ip =$ dnsa [0 ]['ip ' ];
2410+ $ dnsa =dns_get_record ($ hostname , DNS_A );
2411+ $ dns_ips = array ();
2412+ foreach ($ dnsa as $ rec ) {
2413+ $ dns_ips [] = $ rec ['ip ' ];
2414+ }
24112415 }
24122416
24132417 // Check if LE SSL folder for the hostname existed
24142418 // Then create standalone LE SSL certs for this server
24152419 $ le_live_dir = '/etc/letsencrypt/live/ ' . $ hostname ;
2416- if (!@is_dir ($ le_live_dir ) && ( $ svr_ip = $ dns_ip )) {
2420+ if (!@is_dir ($ le_live_dir ) && in_array ( $ srv_ip , $ dns_ips )) {
24172421
24182422 // If it is nginx webserver
24192423 if ($ conf ['nginx ' ]['installed ' ] == true )
@@ -2441,7 +2445,7 @@ public function make_ispconfig_ssl_cert() {
24412445 if (!@is_dir ($ install_dir .'/interface/ssl ' )) mkdir ($ install_dir .'/interface/ssl ' , 0755 , true );
24422446
24432447 // If the LE SSL certs for this hostname exists
2444- if (is_dir ($ le_live_dir ) && ( $ svr_ip = $ dns_ip )) {
2448+ if (is_dir ($ le_live_dir ) && in_array ( $ srv_ip , $ dns_ips )) {
24452449
24462450 // Backup existing ispserver ssl files
24472451 $ date = new DateTime ();
0 commit comments