From 62c18e56f77bd8c44a3e214817067f5dd752ff01 Mon Sep 17 00:00:00 2001 From: Alex Harpin Date: Sat, 7 Mar 2015 16:30:40 +0000 Subject: vyatta-cfg-system: add additional services and check for protocols Add the additional services that are supported by ddclient to the list of service defaults. Also add a function to use this list to check for the allowed protocols, and update the protocol node to use this. Bug #507 http://bugzilla.vyos.net/show_bug.cgi?id=507 --- scripts/dynamic-dns/vyatta-dynamic-dns.pl | 37 +++++++++++++++------- .../dynamic/interface/node.tag/service/node.def | 2 +- .../node.tag/service/node.tag/protocol/node.def | 3 ++ 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/scripts/dynamic-dns/vyatta-dynamic-dns.pl b/scripts/dynamic-dns/vyatta-dynamic-dns.pl index de66c8ed..283c8159 100755 --- a/scripts/dynamic-dns/vyatta-dynamic-dns.pl +++ b/scripts/dynamic-dns/vyatta-dynamic-dns.pl @@ -40,36 +40,42 @@ my $ddclient_config_dir = '/etc/ddclient'; # my %_services_defaults = ( - dyndns => { - protocol => "dyndns2", - }, afraid => { protocol => "freedns" }, + changeip => { + protocol => "changeip" + }, + cloudflare => { + protocol => "cloudflare" + }, dnspark => { protocol => "dnspark" }, dslreports => { protocol => "dslreports1" }, + dyndns => { + protocol => "dyndns2" + }, easydns => { protocol => "easydns" }, namecheap => { protocol => "namecheap" }, - zoneedit => { - protocol => "zoneedit1" - }, - changeip => { - protocol => "changeip" - }, noip => { protocol => "noip" + }, + sitelutions => { + protocol => "sitelutions" + }, + zoneedit => { + protocol => "zoneedit1" } ); -my ($update_dynamicdns, $op_mode_update_dynamicdns, $stop_dynamicdns, $interface, $get_services, $get_default_services, $check_nodes); +my ($update_dynamicdns, $op_mode_update_dynamicdns, $stop_dynamicdns, $interface, $get_services, $get_default_services, $get_protocols, $check_nodes); GetOptions( "update-dynamicdns!" => \$update_dynamicdns, @@ -78,6 +84,7 @@ GetOptions( "interface=s" => \$interface, "get-services!" => \$get_services, "get-default-services!" => \$get_default_services, + "get-protocols!" => \$get_protocols, "check-nodes!" => \$check_nodes ); @@ -94,7 +101,7 @@ dynamicdns_stop() if (defined $stop_dynamicdns); dynamicdns_get_services() if (defined $get_services); dynamicdns_get_default_services() if (defined $get_default_services); - +dynamicdns_get_protocols() if (defined $get_protocols); dynamicdns_check_nodes() if (defined $check_nodes); exit 0; @@ -166,6 +173,14 @@ sub dynamicdns_get_default_services { print "\n"; } +# Return a list of supported protocols +sub dynamicdns_get_protocols { + for my $service (keys %_services_defaults) { + print " $_services_defaults{$service}{'protocol'}"; + } + print "\n"; +} + # Will return a string with default services and set services, useful for CLI completion sub dynamicdns_get_services { my @o_services = keys %_services_defaults; diff --git a/templates/service/dns/dynamic/interface/node.tag/service/node.def b/templates/service/dns/dynamic/interface/node.tag/service/node.def index 85208d2e..32802065 100644 --- a/templates/service/dns/dynamic/interface/node.tag/service/node.def +++ b/templates/service/dns/dynamic/interface/node.tag/service/node.def @@ -4,6 +4,6 @@ type: txt val_help: txt; Custom or predefined service -allowed:/opt/vyatta/sbin/vyatta-dynamic-dns.pl --interface $VAR(../@) --get-services +allowed: /opt/vyatta/sbin/vyatta-dynamic-dns.pl --interface $VAR(../@) --get-services commit:expression: exec "/opt/vyatta/sbin/vyatta-dynamic-dns.pl --interface $VAR(../@) --check-nodes" diff --git a/templates/service/dns/dynamic/interface/node.tag/service/node.tag/protocol/node.def b/templates/service/dns/dynamic/interface/node.tag/service/node.tag/protocol/node.def index 0c216d8d..55fbff5b 100644 --- a/templates/service/dns/dynamic/interface/node.tag/service/node.tag/protocol/node.def +++ b/templates/service/dns/dynamic/interface/node.tag/service/node.tag/protocol/node.def @@ -1,3 +1,6 @@ help: ddclient protocol to be used for dynamic dns service [REQUIRED FOR CUSTOM SERVICES] type: txt val_help: ; ddclient protocol (see ddclient manual) + +allowed: /opt/vyatta/sbin/vyatta-dynamic-dns.pl --interface $VAR(../@) --get-protocols + \ No newline at end of file -- cgit v1.2.3