initial commit of file from CVS for smeserver-ddclient on Sat Sep 7 19:50:30 AEST 2024
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
{
|
||||
my $deamonupdate = ${ddclient}{DeamonUpdate} || '360';
|
||||
if ($deamonupdate <= 360) {$deamonupdate = 360;} # Confuses ddclient runs if less than 5 minutes
|
||||
my $ssl = ${ddclient}{SSL} || 'yes';
|
||||
$OUT .= qq(
|
||||
daemon=$deamonupdate # check every $deamonupdate seconds
|
||||
syslog=yes # log update msgs to syslog
|
||||
pid=/var/run/ddclient.pid # record PID in file.
|
||||
ssl=$ssl # Set SSL
|
||||
);
|
||||
|
||||
|
||||
my $mailSuccess = $ddclient{'mailSuccess'}||'admin';
|
||||
|
||||
if (($mailSuccess eq 'none') || ($mailSuccess eq '' )) {
|
||||
$mailSuccess = "";
|
||||
}
|
||||
|
||||
my $mailFailure = $ddclient{'mailFailure'}||'admin';
|
||||
|
||||
if (($mailFailure eq 'none') || ($mailFailure eq '')) {
|
||||
$mailFailure = "";
|
||||
}
|
||||
|
||||
$OUT .= "\n";
|
||||
$OUT .= "mail=$mailSuccess\n"; # mail update msgs to admin
|
||||
$OUT .= "mail-failure=$mailFailure\n";
|
||||
|
||||
my $method = $ddclient{'method'}||'web';
|
||||
|
||||
# my $webskip = $ddclient{'webskip'}||'IP Address:'; #No longer supported for v3.11.1
|
||||
# my $cmdskip = $ddclient{'cmdskip'}||''; #No longer supported for v3.11.1
|
||||
# my $ifskip = $ddclient{'ifskip'}||''; #No longer supported for v3.11.1
|
||||
|
||||
my $Extinterface = $ddclient{'Extinterface'}|| $ExternalInterface{'Name'}|| '';
|
||||
my $cmd = $ddclient{'cmd'} || '/sbin/e-smith/db configuration getprop ExternalInterface IPAddress';
|
||||
my $ForceIP = $ddclient{'ForceIP'} || $ExternalInterface{'IPAddress'} || $ExternalIP || '';
|
||||
$OUT .= "\n";
|
||||
if ( $method eq 'smeIF' ) {
|
||||
# we use SME db to get the external interface NAME : ppp0, eth1, tap0...
|
||||
$Extinterface = $ExternalInterface{'Name'} ||$Extinterface;
|
||||
$OUT .="usev4=ifv4, ifv4=$Extinterface\n";
|
||||
} elsif ( $method eq 'smeCMD') {
|
||||
# we choose to just get the value from configuration DB
|
||||
$OUT .="usev4=cmdv4, cmdv4='/sbin/e-smith/db configuration getprop ExternalInterface IPAddress'\n";
|
||||
} elsif ( $method eq 'web') {
|
||||
# old good way, we get the value from an external web page. best if we are not gateway
|
||||
$OUT .="usev4=webv4, webv4=$ddclient{'urlcheckip'} \n"; #Do not add / as may be web service id, not url
|
||||
} elsif ( $method eq 'if') {
|
||||
# we have a specific configuration and can not trust sme to get the interface correctly
|
||||
$OUT .="usev4=ifv4, ifv4=$Extinterface\n"; #if-skip no longer required / deprecated
|
||||
} elsif ( $method eq 'ip') {
|
||||
# we want to force manually
|
||||
$OUT.="usev4=ipv4, ipv4=$ForceIP \n";
|
||||
} elsif ( $method eq 'cmdv4') {
|
||||
$OUT .="usev4=cmdv4, cmdv4='$cmd'\n";
|
||||
} else {
|
||||
# fw method
|
||||
my $fwaddress = $ddclient{'fwaddress'}||'';
|
||||
my $fwdevice = $ddclient{'Extinterface'}||'';
|
||||
my $fwlogin = $ddclient{'fwlogin'}||'';
|
||||
my $fwpassword = $ddclient{'fwpassword'}||'';
|
||||
my $fwskip = $ddclient{'fwskip'}||'';
|
||||
$OUT .= "usev4=$fwdevice, fwv4=$fwaddress";
|
||||
$OUT .= ", fw-login=$fwlogin " if ( $fwlogin ne '' );
|
||||
$OUT .= ", fw-password=$fwpassword " if ( $fwpassword ne '' );
|
||||
$OUT .= ", fwv4-skip='$fwskip' " if ( $fwskip ne '' );
|
||||
$OUT .= "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,124 @@
|
||||
{
|
||||
use esmith::DomainsDB;
|
||||
|
||||
$OUT='';
|
||||
|
||||
my $ddb = esmith::DomainsDB->open_ro();
|
||||
|
||||
my $edb;
|
||||
|
||||
$edb = esmith::ConfigDB->open('/home/e-smith/db/ddclient')
|
||||
or $edb = esmith::ConfigDB->create('/home/e-smith/db/ddclient');
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Look up domains and domain descriptions
|
||||
#------------------------------------------------------------
|
||||
|
||||
|
||||
my %DDNS = (
|
||||
DYNDNS1=> dyndns2,
|
||||
DYNDNS2=>dyndns2,
|
||||
DYNDNS3=>dyndns2,
|
||||
ZONEDIT=>zoneedit1,
|
||||
EASYDNS=>easydns,
|
||||
HAMMER=>hammernode1,
|
||||
DSLREPORTS=>dslreports1,
|
||||
EURODYNDNS=>namecheap,
|
||||
DTDNS=>dtdns,
|
||||
LOOPIA=>dyndns2,
|
||||
DNSPARK=>dyndns2,
|
||||
DYNHOST=>dyndns2,
|
||||
NOIP=>noip,
|
||||
CHANGEIP=>dyndns2,
|
||||
NAMECHEAP=>namecheap,
|
||||
SPDNS=>dyndns2,
|
||||
);
|
||||
my %DDSERV= (
|
||||
DYNDNS1=> 'members.dyndns.org',
|
||||
DYNDNS2=>'members.dyndns.org',
|
||||
DYNDNS3=>'members.dyndns.org',
|
||||
ZONEDIT=>'dynamic.zoneedit.com',
|
||||
EASYDNS=>'members.easydns.com',
|
||||
HAMMER=>'dup.hn.org',
|
||||
DSLREPORTS=>'members.dslreports.com',
|
||||
EURODYNDNS=>'eurodyndns.org',
|
||||
DTDNS=>'www.dtdns.com',
|
||||
LOOPIA=>'dns.loopia.se',
|
||||
DNSPARK=>'www.dnspark.com',
|
||||
DYNHOST=>'www.ovh.com',
|
||||
NOIP=>'dynupdate.no-ip.com',
|
||||
CHANGEIP=>'nic.changeip.com',
|
||||
NAMECHEAP=>'dynamicdns.park-your-domain.com',
|
||||
SPDNS=>'update.spdyn.de',
|
||||
);
|
||||
|
||||
for my $edom ( $ddb->domains , $edb->get_all_by_prop(type=>'ddhost') )
|
||||
{
|
||||
{
|
||||
|
||||
my $dns = $edom->prop('dns') || '';
|
||||
next if ($dns eq '');
|
||||
|
||||
$dns =~ tr/a-z/A-Z/;
|
||||
my $login = $edom->prop('login');
|
||||
my $password = $edom->prop('password');
|
||||
my $customdns = $edom->prop('customdns') || '';
|
||||
my $customprotocol = $edom->prop('customprotocol') || '';
|
||||
|
||||
my $pubserv="";
|
||||
$pubserv= $DDSERV{$dns} if exists $DDSERV{$dns}; #not needed for v3.11.1 => yes it is
|
||||
$pubserv= $customdns if( $dns eq 'CUSTOMDNS' );
|
||||
# Not sure if wee need these either!
|
||||
my $static=$edom->prop('static') || '';
|
||||
my $custom=$edom->prop('custom') || '';
|
||||
my $wildcard=$edom->prop('wildcard') || '';
|
||||
my $backupmx=$edom->prop('backupmx') || '';
|
||||
|
||||
my $mx=$edom->prop('mx') || '';
|
||||
my $protocol=$dns;
|
||||
$protocol = $DDNS{$dns} if exists $DDNS{$dns};
|
||||
my $explain='## '.$edom->prop('dns').' dynamic address';
|
||||
|
||||
if($dns ne '')
|
||||
{
|
||||
$OUT .="##\n";
|
||||
$OUT .=$explain."\n";
|
||||
$OUT .="##\n";
|
||||
$OUT .="server=".$pubserv.", \\\n"; # not needed for v3.11.1; is needed
|
||||
$OUT .="protocol=".$protocol.", \\\n";
|
||||
#if( $dns eq 'DTDNS' ) {
|
||||
#$OUT .="client=ddclient, \\\n";
|
||||
#}
|
||||
#if( $dns eq 'LOOPIA' ) {
|
||||
#$OUT .="use=web, \\\n";
|
||||
#$OUT .="web=loopia, \\\n";
|
||||
#$OUT .="script=/XDynDNSServer/XDynDNS.php, \\\n";
|
||||
#}
|
||||
if($static ne '') {
|
||||
$OUT .="static=".$static.", \\\n";
|
||||
}
|
||||
|
||||
if($wildcard ne '') {
|
||||
$OUT .="wildcard=".$wildcard.", \\\n";
|
||||
}
|
||||
|
||||
if($custom ne '') {
|
||||
$OUT .="custom=".$custom.", \\\n";
|
||||
}
|
||||
|
||||
if ($mx ne '') {
|
||||
$OUT .="mx=".$mx.", \\\n";
|
||||
}
|
||||
|
||||
$OUT .="login=".$login.", \\\n";
|
||||
$OUT .="password=".$password." \\\n";
|
||||
$OUT .= ( $dns ne 'NAMECHEAP' )? $edom->key."\n" : "@.".$edom->key()."\n";
|
||||
$OUT .="##\n";
|
||||
$OUT .="##\n";
|
||||
$OUT .="\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
13
root/etc/e-smith/templates/etc/ppp/ip-up.local/45ddclient
Normal file
13
root/etc/e-smith/templates/etc/ppp/ip-up.local/45ddclient
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
# [ -x /etc/ppp/ddclient_ip-up.local ] && /etc/ppp/ddclient_ip-up.local "$@"
|
||||
# [ -x /etc/rc.d/init.d/ddclient ] && /etc/rc.d/init.d/ddclient restart
|
||||
{
|
||||
#$debug = (($ddclient{'debug'} eq 'enabled') ? "debug" : "nodebug");
|
||||
#$verbose = (($ddclient{'verbose'} eq 'enabled') ? "verbose" : "noverbose");
|
||||
#$quiet = (($ddclient{'quiet'} eq 'enabled') ? "quiet" : "noquiet");
|
||||
#$syslog = (($ddclient{'syslog'} eq "enabled") ? "syslog" : "nosyslog");
|
||||
$OUT= "/usr/bin/systemctl reload-or-restart ddclient" if ( ($ddclient{status}||"disabled") eq "enabled" );
|
||||
#$OUT .= "\/usr\/sbin\/ddclient -file \/etc\/ddclient\/ddclient.conf -$debug -$verbose -$quiet -$syslog -pid \/var\/run\/ddclient\/ddclient.pid";
|
||||
$OUT .= "\n";
|
||||
}
|
||||
|
@@ -0,0 +1,18 @@
|
||||
{
|
||||
$debug = (($ddclient{'debug'} eq 'enabled') ? "debug" : "nodebug");
|
||||
$verbose = (($ddclient{'verbose'} eq 'enabled') ? "verbose" : "noverbose");
|
||||
$quiet = (($ddclient{'quiet'} eq 'disabled') ? "noquiet" : "quiet");
|
||||
$syslog = (($ddclient{'syslog'} eq "enabled") ? "syslog" : "nosyslog");
|
||||
$OUT .= "\n";
|
||||
$OUT .= "[Service]\n";
|
||||
$OUT .= "User=ddclient\n";
|
||||
$OUT .= "Group=ddclient\n";
|
||||
$OUT .= "Type=forking\n";
|
||||
$OUT .= "EnvironmentFile=-\/etc\/sysconfig\/ddclient\n";
|
||||
$OUT .= "ExecReload=/usr/bin/kill -HUP \$MAINPID\n";
|
||||
$OUT .= "ExecStartPre=\n";
|
||||
$OUT .= "ExecStartPre=\/bin\/touch \/var\/cache\/ddclient\/ddclient.cache\n";
|
||||
$OUT .= "ExecStart=\n";
|
||||
$OUT .= "ExecStart=\/usr\/sbin\/ddclient -file \/etc\/ddclient\/ddclient.conf -$debug -$verbose -$quiet -$syslog -pid \/var\/run\/ddclient\/ddclient.pid";
|
||||
$OUT .= "\n";
|
||||
}
|
@@ -0,0 +1,2 @@
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
Reference in New Issue
Block a user