Server IP : 195.201.23.43 / Your IP : 13.59.203.127 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/virtual-server/ |
Upload File : |
#!/usr/bin/perl # Update the configured dynamic DNS service package virtual_server; $main::no_acl_check++; $no_virtualmin_plugins = 1; require './virtual-server-lib.pl'; &foreign_require("mailboxes"); exit(1) if (!$config{'dynip_service'}); $h = &get_system_hostname(); ($svc) = grep { $_->{'name'} eq $config{'dynip_service'} } &list_dynip_services(); $from = &get_global_from_address(); # Check if we need to update ($oldip, $oldwhen) = &get_last_dynip_update($config{'dynip_service'}); $newip = $config{'dynip_auto'} ? &get_external_ip_address() : &get_default_ip(); if (!$newip) { # Failed to get current IP address .. so do nothing print STDERR "Failed to get current IP address\n"; exit(0); } if ($oldip ne $newip || $oldwhen < time()-28*24*60*60) { # Talk to the dynamic IP service, as our IP has changed or we # haven't reported in for a month ($ip, $err) = &update_dynip_service($newip, $oldip); if (!$err && $ip && !&check_ipaddress($ip)) { # Got an response, but it's not a valid IP $err = "Invalid response : $ip"; } if ($err) { # Failed .. tell the user if ($config{'dynip_email'}) { &mailboxes::send_text_mail( $from, $config{'dynip_email'}, undef, "Virtualmin dynamic IP update FAILED", join("\n", &mailboxes::wrap_lines( "An attempt to update the dynamic IP ". "for $h to $newip with ". "$svc->{'desc'} failed: $err\n", 75)). "Sent by Virtualmin at: ". &get_virtualmin_url()."\n" ); } exit(1); } } # Save and tell the user if ($ip) { &set_last_dynip_update($config{'dynip_service'}, $ip); } if ($ip && $ip ne $oldip) { # Fix up any virtual servers using the old IP if ($oldip) { &set_all_null_print(); $dc = &update_all_domain_ip_addresses($ip, $oldip); # Also change shared IP @shared = &list_shared_ips(); $idx = &indexof($oldip, @shared); if ($idx >= 0) { $shared[$idx] = $ip; &save_shared_ips(@shared); } # Update any DNS slaves that were replicating from this IP &update_dns_slave_ip_addresses($ip, $oldip); &run_post_actions(); } if ($config{'dynip_email'}) { # Email the user $dc ||= "No"; &mailboxes::send_text_mail( $from, $config{'dynip_email'}, undef, "Virtualmin dynamic IP update", join("\n", &mailboxes::wrap_lines( "The IP address of $h has been successfully ". "updated to $ip with $svc->{'desc'}. $dc ". "virtual servers have been configured to use ". "the new IP address\n", 75))."\n". "Sent by Virtualmin at: ".&get_virtualmin_url()."\n" ); } }Private