From 5d1cc381b7fe904d0fd21941607b742d4d071206 Mon Sep 17 00:00:00 2001 From: Marcel Gisselmann Date: Wed, 18 Oct 2017 13:10:56 +0200 Subject: Add ecc support to openssh --- .../user/node.tag/authentication/public-keys/node.tag/type/node.def | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'templates/system') diff --git a/templates/system/login/user/node.tag/authentication/public-keys/node.tag/type/node.def b/templates/system/login/user/node.tag/authentication/public-keys/node.tag/type/node.def index 5ad1c58b..bf789e06 100644 --- a/templates/system/login/user/node.tag/authentication/public-keys/node.tag/type/node.def +++ b/templates/system/login/user/node.tag/authentication/public-keys/node.tag/type/node.def @@ -1,4 +1,4 @@ type: txt help: Public key type -allowed: echo "ssh-dss ssh-rsa" -syntax:expression: $VAR(@) in "ssh-rsa", "ssh-dss" ; "Unknown key type" +allowed: echo "ssh-dss ssh-rsa ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519" +syntax:expression: $VAR(@) in "ssh-rsa", "ssh-dss", "ecdsa-sha2-nistp256", "ecdsa-sha2-nistp384", "ecdsa-sha2-nistp521", "ssh-ed25519"; "Unknown key type" -- cgit v1.2.3 From f7e60e7beb90b193aebd2edf43a5cbd7cc1b475d Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 2 Nov 2017 16:58:39 +0100 Subject: T437: Fixed system option "Ctrl-Alt-Delete action" broken --- debian/vyatta-cfg-system.postinst.in | 2 +- templates/system/options/ctrl-alt-del-action/node.def | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'templates/system') diff --git a/debian/vyatta-cfg-system.postinst.in b/debian/vyatta-cfg-system.postinst.in index 8888aa60..60ed8eeb 100755 --- a/debian/vyatta-cfg-system.postinst.in +++ b/debian/vyatta-cfg-system.postinst.in @@ -188,7 +188,7 @@ if [ -e /etc/default/mdadm ]; then fi # Disable reboot on ctrl-alt-delete -sed -i -e '/^ca/s/\/sbin\/shutdown .*$/\/bin\/echo "Ctrl\-Alt\-Del disabled."/' /etc/inittab +ln -sf /dev/null /lib/systemd/system/ctrl-alt-del.target # remove unnecessary ddclient script in /etc/ppp/ip-up.d/ # this logs unnecessary messages trying to start ddclient diff --git a/templates/system/options/ctrl-alt-del-action/node.def b/templates/system/options/ctrl-alt-del-action/node.def index 3bbf2a81..a853b151 100644 --- a/templates/system/options/ctrl-alt-del-action/node.def +++ b/templates/system/options/ctrl-alt-del-action/node.def @@ -12,15 +12,15 @@ syntax:expression: $VAR(@) in "ignore", "reboot", "poweroff"; "Value must be ign end: if [ $VAR(@) == "ignore" ]; then - sudo sh -c "sed -i -e 's/^ca.*/ca:12345:ctrlaltdel:/' \ - /etc/inittab" + sudo sh -c "ln -sf /dev/null \ + /lib/systemd/system/ctrl-alt-del.target" elif [ $VAR(@) == "reboot" ]; then - sudo sh -c "sed -i -e 's/^ca.*/ca:12345:ctrlaltdel:\/sbin\/reboot/' \ - /etc/inittab" + sudo sh -c "ln -sf /lib/systemd/system/reboot.target \ + /lib/systemd/system/ctrl-alt-del.target" elif [ $VAR(@) == "poweroff" ]; then - sudo sh -c "sed -i -e 's/^ca.*/ca:12345:ctrlaltdel:\/sbin\/shutdown -h now/' \ - /etc/inittab" + sudo sh -c "ln -sf /lib/systemd/system/poweroff.target \ + /lib/systemd/system/ctrl-alt-del.target" fi - # Reload /etc/inittab for change to take effect - sudo /sbin/init q + # Reload systemd daemon for change to take effect + sudo /bin/systemctl daemon-reload -- cgit v1.2.3 From 890dda04895996e19cb579a322c979d410d7757d Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 2 Nov 2017 17:14:39 +0100 Subject: T438: Remove long broken popularity contest --- templates/system/options/enable-popularity-contest/node.def | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 templates/system/options/enable-popularity-contest/node.def (limited to 'templates/system') diff --git a/templates/system/options/enable-popularity-contest/node.def b/templates/system/options/enable-popularity-contest/node.def deleted file mode 100644 index 3f048352..00000000 --- a/templates/system/options/enable-popularity-contest/node.def +++ /dev/null @@ -1,9 +0,0 @@ -help: Send anonymous system statistic to VyOS maintainers - -create: - sudo sh -c 'echo "#!/bin/sh" > /etc/cron.weekly/01vyos-popcon' - sudo sh -c 'echo "/opt/vyatta/bin/vyos-popcon.pl 2>&1 >/var/log/popcon.log" >> /etc/cron.weekly/01vyos-popcon' - sudo sh -c 'chmod +x /etc/cron.weekly/01vyos-popcon' - -delete: - sudo rm -f /etc/cron.weekly/01vyos-popcon -- cgit v1.2.3 From 3f248ff90ecb28ae15dcf8e8191e79ca7889f69d Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 20 Feb 2018 06:36:24 +0100 Subject: Rename the "client" NTP option to "allow-clients" to make it more clear what it does (fixes T553). --- scripts/system/vyatta_update_ntp.pl | 4 ++-- templates/system/ntp/allow-clients/address/node.def | 6 ++++++ templates/system/ntp/allow-clients/node.def | 1 + templates/system/ntp/client/address/node.def | 6 ------ templates/system/ntp/client/node.def | 1 - 5 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 templates/system/ntp/allow-clients/address/node.def create mode 100644 templates/system/ntp/allow-clients/node.def delete mode 100644 templates/system/ntp/client/address/node.def delete mode 100644 templates/system/ntp/client/node.def (limited to 'templates/system') diff --git a/scripts/system/vyatta_update_ntp.pl b/scripts/system/vyatta_update_ntp.pl index eaaae14a..78a617bc 100755 --- a/scripts/system/vyatta_update_ntp.pl +++ b/scripts/system/vyatta_update_ntp.pl @@ -78,10 +78,10 @@ my @clients; if ($dhclient_script == 1) { @servers = $cfg->listOrigNodes("server"); - @clients = $cfg->returnOrigValues("client address"); + @clients = $cfg->returnOrigValues("allow-clients address"); } else { @servers = $cfg->listNodes("server"); - @clients = $cfg->returnValues("client address"); + @clients = $cfg->returnValues("allow-clients address"); } if (scalar(@servers) > 0) { diff --git a/templates/system/ntp/allow-clients/address/node.def b/templates/system/ntp/allow-clients/address/node.def new file mode 100644 index 00000000..a48a2b5a --- /dev/null +++ b/templates/system/ntp/allow-clients/address/node.def @@ -0,0 +1,6 @@ +multi: +type: ipv4net,ipv6net +help: IP address + +val_help: ipv4net; IP address and prefix length +val_help: ipv6net; IPv6 address and prefix length diff --git a/templates/system/ntp/allow-clients/node.def b/templates/system/ntp/allow-clients/node.def new file mode 100644 index 00000000..8228130e --- /dev/null +++ b/templates/system/ntp/allow-clients/node.def @@ -0,0 +1 @@ +help: Network Time Protocol (NTP) server options diff --git a/templates/system/ntp/client/address/node.def b/templates/system/ntp/client/address/node.def deleted file mode 100644 index a48a2b5a..00000000 --- a/templates/system/ntp/client/address/node.def +++ /dev/null @@ -1,6 +0,0 @@ -multi: -type: ipv4net,ipv6net -help: IP address - -val_help: ipv4net; IP address and prefix length -val_help: ipv6net; IPv6 address and prefix length diff --git a/templates/system/ntp/client/node.def b/templates/system/ntp/client/node.def deleted file mode 100644 index dd849f8f..00000000 --- a/templates/system/ntp/client/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Network Time Protocol (NTP) client -- cgit v1.2.3 From 70f95999744fbb6606aebbc87ba9b326cf453728 Mon Sep 17 00:00:00 2001 From: Kim Date: Thu, 5 Apr 2018 14:12:05 +0200 Subject: Add help for baud rate. --- templates/system/console/device/node.tag/speed/node.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/system') diff --git a/templates/system/console/device/node.tag/speed/node.def b/templates/system/console/device/node.tag/speed/node.def index e7515dca..3a117301 100644 --- a/templates/system/console/device/node.tag/speed/node.def +++ b/templates/system/console/device/node.tag/speed/node.def @@ -1,5 +1,5 @@ type: u32 -help: Console baud rate +help: Console baud rate. New rate will take effect on reboot. allowed: echo 1200 2400 4800 9600 19200 38400 57600 115200 syntax:expression: $VAR(@) in 1200, 2400, 4800, 9600, 19200, 38400, \ 57600, 115200 ; "unknown baud rate" -- cgit v1.2.3 From 9f5c33ea3fb6101c7ce49abe3762d4d497c37ce9 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 7 May 2018 22:41:31 +0200 Subject: T623: Rewrite NTP subsystem in new XML style interface definition --- Makefile.am | 1 - scripts/system/vyatta_update_ntp.pl | 115 --------------------- scripts/system/vyatta_update_resolv.pl | 15 --- scripts/vyatta-system-nameservers | 10 -- .../system/ntp/allow-clients/address/node.def | 6 -- templates/system/ntp/allow-clients/node.def | 1 - templates/system/ntp/node.def | 16 --- templates/system/ntp/server/node.def | 3 - .../system/ntp/server/node.tag/dynamic/node.def | 2 - .../system/ntp/server/node.tag/noselect/node.def | 1 - .../system/ntp/server/node.tag/preempt/node.def | 1 - .../system/ntp/server/node.tag/prefer/node.def | 1 - 12 files changed, 172 deletions(-) delete mode 100755 scripts/system/vyatta_update_ntp.pl delete mode 100644 templates/system/ntp/allow-clients/address/node.def delete mode 100644 templates/system/ntp/allow-clients/node.def delete mode 100644 templates/system/ntp/node.def delete mode 100644 templates/system/ntp/server/node.def delete mode 100644 templates/system/ntp/server/node.tag/dynamic/node.def delete mode 100644 templates/system/ntp/server/node.tag/noselect/node.def delete mode 100644 templates/system/ntp/server/node.tag/preempt/node.def delete mode 100644 templates/system/ntp/server/node.tag/prefer/node.def (limited to 'templates/system') diff --git a/Makefile.am b/Makefile.am index 77088eaa..cfddd656 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,7 +54,6 @@ sbin_SCRIPTS += scripts/system/vyatta_update_resolv.pl sbin_SCRIPTS += scripts/system/vyatta_update_sysctl.pl sbin_SCRIPTS += scripts/system/vyatta_update_syslog.pl sbin_SCRIPTS += scripts/system/vyatta_update_console.pl -sbin_SCRIPTS += scripts/system/vyatta_update_ntp.pl sbin_SCRIPTS += scripts/system/irq-affinity.pl sbin_SCRIPTS += scripts/snmp/vyatta-snmp.pl sbin_SCRIPTS += scripts/snmp/vyatta-snmp-v3.pl diff --git a/scripts/system/vyatta_update_ntp.pl b/scripts/system/vyatta_update_ntp.pl deleted file mode 100755 index 78a617bc..00000000 --- a/scripts/system/vyatta_update_ntp.pl +++ /dev/null @@ -1,115 +0,0 @@ -#! /usr/bin/perl - -# **** License **** -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# This code was originally developed by Vyatta, Inc. -# Portions created by Vyatta are Copyright (C) 2007 Vyatta, Inc. -# All Rights Reserved. -# -# **** End License **** - -# Filter ntp.conf - remove old servers and add current ones - -use strict; -use lib "/opt/vyatta/share/perl5"; -use Vyatta::Config; -use NetAddr::IP; -use Getopt::Long; - -my $dhclient_script = 0; - -GetOptions("dhclient-script=i" => \$dhclient_script, -); - -sub ntp_format { - my ($cidr_or_host) = @_; - my $ip = NetAddr::IP->new($cidr_or_host); - if (defined($ip)) { - my $address = $ip->addr(); - my $mask = $ip->mask(); - - if ( - ($ip->version() == 6 && $ip->masklen() == 128) - || ($ip->version() == 4 && $ip->masklen() == 32) - ) { - return "$address"; - } else { - return "$address mask $mask"; - } - } else { - return undef; - } -} - -my @ntp; -if (-e '/etc/ntp.conf') { - open (my $file, '<', '/etc/ntp.conf') - or die("$0: Error! Unable to open '/etc/ntp.conf' for input: $!\n"); - @ntp = <$file>; - close ($file); -} - -open (my $output, '>', '/etc/ntp.conf') - or die("$0: Error! Unable to open '/etc/ntp.conf' for output: $!\n"); - -my $cfg = new Vyatta::Config; -$cfg->setLevel("system ntp"); - -foreach my $line (@ntp) { - if ($line =~ /^# VyOS CLI configuration options/) { - print $output $line; - print $output "\n"; - last; - } else { - print $output $line; - } -} - -my @servers; -my @clients; - -if ($dhclient_script == 1) { - @servers = $cfg->listOrigNodes("server"); - @clients = $cfg->returnOrigValues("allow-clients address"); -} else { - @servers = $cfg->listNodes("server"); - @clients = $cfg->returnValues("allow-clients address"); -} - -if (scalar(@servers) > 0) { - print $output "# Servers\n\n"; - foreach my $server (@servers) { - my $server_addr = ntp_format($server); - if (defined($server_addr)) { - print $output "server $server_addr iburst"; - for my $property (qw(dynamic noselect preempt prefer)) { - if ($dhclient_script == 1) { - print $output " $property" if ($cfg->existsOrig("server $server $property")); - } else { - print $output " $property" if ($cfg->exists("server $server $property")); - } - } - print $output "\nrestrict $server_addr nomodify notrap nopeer noquery\n"; - } - } - print $output "\n"; -} - -if (scalar(@clients) > 0) { - print $output "# Clients\n\n"; - foreach my $client (@clients) { - my $address = ntp_format($client); - print $output "restrict $address nomodify notrap nopeer\n"; - } - print $output "\n"; -} - -exit 0; diff --git a/scripts/system/vyatta_update_resolv.pl b/scripts/system/vyatta_update_resolv.pl index 51617fce..de09a760 100755 --- a/scripts/system/vyatta_update_resolv.pl +++ b/scripts/system/vyatta_update_resolv.pl @@ -30,7 +30,6 @@ use Vyatta::Config; my $dhclient_script = 0; my $config_mode = 0; -my $ntp_config = 0; GetOptions("dhclient-script=i" => \$dhclient_script, "config-mode=i" => \$config_mode, @@ -45,7 +44,6 @@ my $disable_dhcp_nameservers = undef; if ($config_mode == 1) { $disable_dhcp_nameservers = $vc->exists('disable-dhcp-nameservers'); - $ntp_config = $vc->exists('ntp server'); } else { $disable_dhcp_nameservers = $vc->existsOrig('disable-dhcp-nameservers'); } @@ -53,7 +51,6 @@ if ($config_mode == 1) { if ($dhclient_script == 1) { @search_domains = $vc->returnOrigValues('domain-search domain'); $domain_name = $vc->returnOrigValue('domain-name'); - $ntp_config = $vc->existsOrig('ntp server'); } else { @search_domains = $vc->returnValues('domain-search domain'); $domain_name = $vc->returnValue('domain-name'); @@ -132,7 +129,6 @@ if ($domain_name && length($domain_name) > 0) { if (($dhclient_script == 1) || ($config_mode == 1)) { my @current_dhcp_nameservers; - my $restart_ntp = 0; # code below to add new name-servers received from dhcp client, but only if disable-dhcp-nameservers # hasn't been enabled. @@ -168,7 +164,6 @@ if (($dhclient_script == 1) || ($config_mode == 1)) { or die "$! error trying to overwrite"; print $rf "#nameserver written by vyatta_update_resolv.pl (dhcp)\nnameserver\t$ns\n"; close $rf; - $restart_ntp = 1; } } } @@ -206,7 +201,6 @@ if (($dhclient_script == 1) || ($config_mode == 1)) { $cmd = "sed -i -n '/nameserver\t$dhcpnameserver/".'{n;x;d;};x;1d;p;${x;p;}'."' /etc/resolv.conf"; } system($cmd); - $restart_ntp = 1; } } else { for my $dhcpnameserver (@dhcp_nameservers_in_resolvconf) { @@ -225,18 +219,9 @@ if (($dhclient_script == 1) || ($config_mode == 1)) { $cmd = "sed -i -n '/nameserver\t$dhcpnameserver/".'{n;x;d;};x;1d;p;${x;p;}'."' /etc/resolv.conf"; } system($cmd); - $restart_ntp = 1; } } } - if ($restart_ntp == 1) { - # this corresponds to what is done in name-server/node.def as a fix for bug 1300 - if ($ntp_config == 1) { - system("sudo /opt/vyatta/sbin/vyatta_update_ntp.pl --dhclient-script $dhclient_script"); - my $cmd_ntp_restart = "if [ -f /etc/ntp.conf ] && grep -q '^server' /etc/ntp.conf; then /usr/sbin/invoke-rc.d ntp restart >&/dev/null; fi &"; - system($cmd_ntp_restart); - } - } } # The following will re-write '/etc/resolv.conf' line by line, diff --git a/scripts/vyatta-system-nameservers b/scripts/vyatta-system-nameservers index 99019fd1..9c688e80 100755 --- a/scripts/vyatta-system-nameservers +++ b/scripts/vyatta-system-nameservers @@ -36,14 +36,6 @@ restart_dnsmasq () { fi } -restart_ntp () { - # restart ntp if ntp is configured - if [ -f /etc/ntp.conf ] && grep -q "^server" /etc/ntp.conf; then - sudo /opt/vyatta/sbin/vyatta_update_ntp.pl - /usr/sbin/invoke-rc.d ntp restart >&/dev/null - fi -} - update_system_nameservers () { nameserver=$1 touch /etc/resolv.conf @@ -70,7 +62,6 @@ update_system_nameservers () { mv -f /etc/resolv_tmp.conf /etc/resolv.conf fi restart_dnsmasq - restart_ntp } delete_system_nameserver () { @@ -79,7 +70,6 @@ delete_system_nameserver () { # remove specified nameserver sed -i "/$nameserver$/d" /etc/resolv.conf restart_dnsmasq - restart_ntp } # diff --git a/templates/system/ntp/allow-clients/address/node.def b/templates/system/ntp/allow-clients/address/node.def deleted file mode 100644 index a48a2b5a..00000000 --- a/templates/system/ntp/allow-clients/address/node.def +++ /dev/null @@ -1,6 +0,0 @@ -multi: -type: ipv4net,ipv6net -help: IP address - -val_help: ipv4net; IP address and prefix length -val_help: ipv6net; IPv6 address and prefix length diff --git a/templates/system/ntp/allow-clients/node.def b/templates/system/ntp/allow-clients/node.def deleted file mode 100644 index 8228130e..00000000 --- a/templates/system/ntp/allow-clients/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Network Time Protocol (NTP) server options diff --git a/templates/system/ntp/node.def b/templates/system/ntp/node.def deleted file mode 100644 index 38e67e05..00000000 --- a/templates/system/ntp/node.def +++ /dev/null @@ -1,16 +0,0 @@ -priority: 400 -help: Network Time Protocol (NTP) configuration - -end: - sudo /opt/vyatta/sbin/vyatta_update_ntp.pl - if grep -q '^server' /etc/ntp.conf - then - if pgrep -f -u ntp /usr/sbin/ntpd > /dev/null - then - sudo /usr/sbin/invoke-rc.d ntp force-reload - else - sudo /usr/sbin/invoke-rc.d ntp start - fi - else - sudo /usr/sbin/invoke-rc.d ntp stop - fi diff --git a/templates/system/ntp/server/node.def b/templates/system/ntp/server/node.def deleted file mode 100644 index 383bd992..00000000 --- a/templates/system/ntp/server/node.def +++ /dev/null @@ -1,3 +0,0 @@ -tag: -type: txt -help: Network Time Protocol (NTP) server diff --git a/templates/system/ntp/server/node.tag/dynamic/node.def b/templates/system/ntp/server/node.tag/dynamic/node.def deleted file mode 100644 index 2d68de16..00000000 --- a/templates/system/ntp/server/node.tag/dynamic/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Allow server to be configured even if not reachable - diff --git a/templates/system/ntp/server/node.tag/noselect/node.def b/templates/system/ntp/server/node.tag/noselect/node.def deleted file mode 100644 index e2e061b5..00000000 --- a/templates/system/ntp/server/node.tag/noselect/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Marks the server as unused diff --git a/templates/system/ntp/server/node.tag/preempt/node.def b/templates/system/ntp/server/node.tag/preempt/node.def deleted file mode 100644 index ca89efa1..00000000 --- a/templates/system/ntp/server/node.tag/preempt/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Specifies the association as preemptable rather than the default persistent diff --git a/templates/system/ntp/server/node.tag/prefer/node.def b/templates/system/ntp/server/node.tag/prefer/node.def deleted file mode 100644 index 4855fd41..00000000 --- a/templates/system/ntp/server/node.tag/prefer/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Marks the server as preferred -- cgit v1.2.3 From ea256dc7956a3fbe5947c0ad9da9e90dd2320327 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 16 May 2018 06:41:40 +0200 Subject: T574: remove the old system host-name/domain-name commands, moving to vyos-1x. --- scripts/system/vyatta_update_hosts.pl | 114 ---------------------------------- templates/system/domain-name/node.def | 12 ---- templates/system/host-name/node.def | 12 ---- 3 files changed, 138 deletions(-) delete mode 100755 scripts/system/vyatta_update_hosts.pl delete mode 100644 templates/system/domain-name/node.def delete mode 100644 templates/system/host-name/node.def (limited to 'templates/system') diff --git a/scripts/system/vyatta_update_hosts.pl b/scripts/system/vyatta_update_hosts.pl deleted file mode 100755 index 22b141ab..00000000 --- a/scripts/system/vyatta_update_hosts.pl +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/perl -w -# -# Module: vyatta_update_hosts.pl -# -# **** License **** -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# This code was originally developed by Vyatta, Inc. -# Portions created by Vyatta are Copyright (C) 2012-2013 Vyatta, Inc. -# All Rights Reserved. -# -# Description: -# Script to update '/etc/hosts' on commit of 'system host-name' and -# 'system domain-name' config. -# -# **** End License **** -# - -use strict; -use English; -use lib "/opt/vyatta/share/perl5/"; - -use File::Temp qw(tempfile); -use Vyatta::File qw(touch); -use Vyatta::Config; -use Getopt::Long; - -my $HOSTS_CFG = '/etc/hosts'; -my $HOSTS_TMPL = "/tmp/hosts.XXXXXX"; -my $HOSTNAME_CFG = '/etc/hostname'; -my $MAILNAME_CFG = '/etc/mailname'; -my $restart_services = 1; - -sub set_hostname { - my ( $hostname ) = @_; - system("hostname $hostname"); - open (my $f, '>', $HOSTNAME_CFG) - or die("$0: Error! Unable to open $HOSTNAME_CFG for output: $!\n"); - print $f "$hostname\n"; - close ($f); -} - -sub set_mailname { - my ( $mailname ) = @_; - open (my $f, '>', $MAILNAME_CFG) - or die("$0: Error! Unable to open $MAILNAME_CFG for output: $!\n"); - print $f "$mailname\n"; - close ($f); -} - -if ($EUID != 0) { - printf("This program must be run by root.\n"); - exit 1; -} - -GetOptions("restart-services!" => \$restart_services); - -my $vc = new Vyatta::Config(); - -$vc->setLevel('system'); -my $host_name = $vc->returnValue('host-name'); -my $domain_name = $vc->returnValue('domain-name'); -my $mail_name; -my $hosts_line = "127.0.1.1\t "; - -if (! defined $host_name) { - $host_name = 'vyatta'; -} -$mail_name = $host_name; - -if (defined $domain_name) { - $mail_name .= '.' . $domain_name; - $hosts_line .= $host_name . '.' . $domain_name; -} -$hosts_line .= " $host_name\t #vyatta entry\n"; - -my ($out, $tempname) = tempfile($HOSTS_TMPL, UNLINK => 1) - or die "Can't create temp file: $!"; - -if (! -e $HOSTS_CFG) { - touch $HOSTS_CFG; -} -open (my $in, '<', $HOSTS_CFG) - or die("$0: Error! Unable to open '$HOSTS_CFG' for input: $!\n"); - -while (my $line = <$in>) { - if ($line =~ m:^127.0.1.1:) { - next; - } - print $out $line; -} -print $out $hosts_line; - -close ($in); -close ($out); - -system("cp $tempname $HOSTS_CFG") == 0 - or die "Can't copy $tempname to $HOSTS_CFG: $!"; - -set_hostname $host_name; -set_mailname $mail_name; - -# Restart services that use the system hostname; -# add more ase needed. -if ($restart_services) { - system("invoke-rc.d rsyslog restart"); -} diff --git a/templates/system/domain-name/node.def b/templates/system/domain-name/node.def deleted file mode 100644 index 4866ddf8..00000000 --- a/templates/system/domain-name/node.def +++ /dev/null @@ -1,12 +0,0 @@ -priority: 400 -type: txt -help: System domain name - -# Allow letter-number-hyphen in label (but can not start or end with hyphen) -syntax:expression: exec "/opt/vyatta/sbin/vyatta_check_domainname.pl $VAR(../host-name).$VAR(@)" - -update: sudo /opt/vyatta/sbin/vyatta_update_resolv.pl - sudo /opt/vyatta/sbin/vyatta_update_hosts.pl --no-restart-services - -delete: sudo /opt/vyatta/sbin/vyatta_update_resolv.pl - sudo /opt/vyatta/sbin/vyatta_update_hosts.pl --no-restart-services diff --git a/templates/system/host-name/node.def b/templates/system/host-name/node.def deleted file mode 100644 index 00798bef..00000000 --- a/templates/system/host-name/node.def +++ /dev/null @@ -1,12 +0,0 @@ -priority: 100 -type: txt -help: System host name (default: vyos) -default: "vyos" -syntax:expression: pattern $VAR(@) "^[[:alnum:]][-.[:alnum:]]*[[:alnum:]]$" - ; "invalid host name $VAR(@)" - -syntax:expression: pattern $VAR(@) "^.{1,63}$" ; "invalid host-name length" - -update: sudo /opt/vyatta/sbin/vyatta_update_hosts.pl - -delete: sudo /opt/vyatta/sbin/vyatta_update_hosts.pl -- cgit v1.2.3 From e26ce5c3908a5db1643d6fc455f473bef0113b56 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 10 Jun 2018 11:00:25 +0200 Subject: T313: Typo fix in 'set system sysctl custom' --- templates/system/sysctl/custom/node.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/system') diff --git a/templates/system/sysctl/custom/node.def b/templates/system/sysctl/custom/node.def index f03a3e13..a072b2ba 100644 --- a/templates/system/sysctl/custom/node.def +++ b/templates/system/sysctl/custom/node.def @@ -2,4 +2,4 @@ tag: priority: 318 type: txt help: Define specific sysctl options to modify -val_help: ; Name of sysctl option you want to modufy +val_help: ; Name of sysctl option you want to modify -- cgit v1.2.3 From e7ccdd3f38d11616916a17fbdb90243d40df50e1 Mon Sep 17 00:00:00 2001 From: Shafer Stockton Date: Wed, 13 Jun 2018 20:13:08 -0700 Subject: dnsmasq is gone, restart the correct process also prevents additions from failing at commit --- templates/system/static-host-mapping/host-name/node.def | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'templates/system') diff --git a/templates/system/static-host-mapping/host-name/node.def b/templates/system/static-host-mapping/host-name/node.def index 09bc9dbe..9d815965 100644 --- a/templates/system/static-host-mapping/host-name/node.def +++ b/templates/system/static-host-mapping/host-name/node.def @@ -12,10 +12,10 @@ end: sudo sh -c " touch /etc/hosts sed -i '/ $VAR(@) .*#vyatta entry/d' /etc/hosts if [ -z \"$VAR(./inet/@)\" ]; then - if cli-shell-api existsActive service dns forwarding; then /etc/init.d/dnsmasq restart >&/dev/null; fi + if cli-shell-api existsActive service dns forwarding; then /etc/init.d/pdns-recursor restart >&/dev/null; fi exit 0 fi declare -a aliases=( $VAR(alias/@@) ) echo -e \"$VAR(inet/@)\\t $VAR(@) \${aliases[*]} \\t #vyatta entry\" >> /etc/hosts - if cli-shell-api existsActive service dns forwarding; then /etc/init.d/dnsmasq restart >&/dev/null; fi" + if cli-shell-api existsActive service dns forwarding; then /etc/init.d/pdns-recursor restart >&/dev/null; fi" -- cgit v1.2.3