From 97219ae83258061d524a110e5bd9d70d2aa70733 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sat, 19 Dec 2015 04:35:30 +0100 Subject: Remove referenced to Vyatta from 'show version' completion help. --- templates/show/version/added/node.def | 2 +- templates/show/version/all/node.def | 2 +- templates/show/version/deleted/node.def | 2 +- templates/show/version/downgraded/node.def | 2 +- templates/show/version/node.def | 2 +- templates/show/version/upgraded/node.def | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'templates') diff --git a/templates/show/version/added/node.def b/templates/show/version/added/node.def index b17ca68..2381b74 100644 --- a/templates/show/version/added/node.def +++ b/templates/show/version/added/node.def @@ -1,2 +1,2 @@ -help: Show Vyatta version information plus added packages +help: Show VyOS version information plus added packages run: ${vyatta_bindir}/vyatta-show-version added diff --git a/templates/show/version/all/node.def b/templates/show/version/all/node.def index 76fff72..5b60609 100644 --- a/templates/show/version/all/node.def +++ b/templates/show/version/all/node.def @@ -1,2 +1,2 @@ -help: Show Vyatta version information plus all packages changes +help: Show VyOS version information plus all packages changes run: ${vyatta_bindir}/vyatta-show-version all diff --git a/templates/show/version/deleted/node.def b/templates/show/version/deleted/node.def index 4567031..d328cf6 100644 --- a/templates/show/version/deleted/node.def +++ b/templates/show/version/deleted/node.def @@ -1,2 +1,2 @@ -help: Show Vyatta version information plus deleted packages +help: Show VyOS version information plus deleted packages run: ${vyatta_bindir}/vyatta-show-version deleted diff --git a/templates/show/version/downgraded/node.def b/templates/show/version/downgraded/node.def index 4948f1b..250b048 100644 --- a/templates/show/version/downgraded/node.def +++ b/templates/show/version/downgraded/node.def @@ -1,2 +1,2 @@ -help: Show Vyatta version information plus downgraded packages +help: Show VyOS version information plus downgraded packages run: ${vyatta_bindir}/vyatta-show-version downgraded diff --git a/templates/show/version/node.def b/templates/show/version/node.def index 272589e..4237e5d 100644 --- a/templates/show/version/node.def +++ b/templates/show/version/node.def @@ -1,2 +1,2 @@ -help: Show Vyatta version information +help: Show VyOS version information run: ${vyatta_bindir}/vyatta-show-version diff --git a/templates/show/version/upgraded/node.def b/templates/show/version/upgraded/node.def index 1826ceb..b693c23 100644 --- a/templates/show/version/upgraded/node.def +++ b/templates/show/version/upgraded/node.def @@ -1,2 +1,2 @@ -help: Show Vyatta version information plus upgraded packages +help: Show VyOS version information plus upgraded packages run: ${vyatta_bindir}/vyatta-show-version upgraded -- cgit v1.2.3 From 5b1bec7ba23c02c9e63b25c63b638bacc239ce56 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sat, 19 Dec 2015 04:59:19 +0100 Subject: Easter egg: 'show version funny' command that displays limericks after version information. --- Makefile.am | 1 + scripts/limericks.py | 51 +++++++++++++++++++++++++++++++++++ templates/show/version/funny/node.def | 5 ++++ 3 files changed, 57 insertions(+) create mode 100644 scripts/limericks.py create mode 100644 templates/show/version/funny/node.def (limited to 'templates') diff --git a/Makefile.am b/Makefile.am index 410c419..e736419 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,6 +52,7 @@ bin_SCRIPTS += scripts/vyatta-monitor-check-rule-log bin_SCRIPTS += scripts/vyos-show-ram.sh bin_SCRIPTS += scripts/vyos-strip-config.pl bin_SCRIPTS += scripts/maya-date.py +bin_SCRIPTS += scripts/limericks.py sbin_SCRIPTS = scripts/dhcpv6-client-show-leases.pl sbin_SCRIPTS += scripts/vyatta-image-tools.pl diff --git a/scripts/limericks.py b/scripts/limericks.py new file mode 100644 index 0000000..acb1a74 --- /dev/null +++ b/scripts/limericks.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +import random + +limericks = [ + +""" +A programmer who's name was Searle +Once wrote a long program in Perl. +Despite very few quirks +No one got how it works, +Not even the interpreter. +""", + +""" +There was a young lady of Maine +Who set up IPsec VPN. +Problems didn't arise +'til other vendors' device +had to add she to that VPN. +""", + +""" +One day a programmer from York +started his own Vyatta fork. +Though he was a huge geek, +it still took him a week +to get the damn build scripts to work. +""", + +""" +A network admin from Hong Kong +knew MPPE cipher's not strong. +But he was behind NAT, +so he put up we that, +sad network admin from Hong Kong. +""", + +""" +A network admin named Drake +greeted friends with a three-way handshake +and refused to proceed +if they didn't complete it, +that standards-compliant guy Drake. +""" + +] + +l = limericks[random.randint(0, len(limericks) - 1)] + +print(l) diff --git a/templates/show/version/funny/node.def b/templates/show/version/funny/node.def new file mode 100644 index 0000000..cb62c96 --- /dev/null +++ b/templates/show/version/funny/node.def @@ -0,0 +1,5 @@ +help: Show VyOS version information plus a funny poem +run: + ${vyatta_bindir}/vyatta-show-version + ${vyatta_bindir}/limericks.py + -- cgit v1.2.3 From e5066ccdc30034fc83a6f69bcdc1cd1996008264 Mon Sep 17 00:00:00 2001 From: Thomas Jepp Date: Wed, 3 Feb 2016 16:54:51 +0000 Subject: Correct the path to poff for jessie. --- templates/disconnect/interface/node.tag/node.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates') diff --git a/templates/disconnect/interface/node.tag/node.def b/templates/disconnect/interface/node.tag/node.def index a3b3cf3..4a937b9 100644 --- a/templates/disconnect/interface/node.tag/node.def +++ b/templates/disconnect/interface/node.tag/node.def @@ -29,6 +29,6 @@ run: echo "Bringing interface $IFNAME down..." echo "`date`: User $USER stopping PPP daemon for $IFNAME by disconnect command" >> $LOGFILE - sudo /sbin/poff $IFNAME + sudo /usr/bin/poff $IFNAME fi -- cgit v1.2.3 From 59240c87059fd207b3ec38238851f6fe6982e48c Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Mon, 8 Feb 2016 12:27:08 -0500 Subject: Update debian live mountpoint directories. --- scripts/rename-image.pl | 6 +++--- scripts/show-image-storage.pl | 8 ++++---- scripts/vyatta-boot-image.pl | 2 +- scripts/vyatta-image-tools.pl | 10 +++++----- templates/add/raid/node.tag/member/node.tag/node.def | 2 +- templates/clone/system/config/node.tag/from/node.tag/node.def | 6 +++--- templates/clone/system/config/node.tag/node.def | 4 ++-- templates/show/log/image/node.tag/all/node.def | 2 +- templates/show/log/image/node.tag/authorization/node.def | 2 +- templates/show/log/image/node.tag/directory/node.def | 4 ++-- templates/show/log/image/node.tag/file/node.tag/node.def | 4 ++-- templates/show/log/image/node.tag/node.def | 6 +++--- templates/show/log/image/node.tag/tail/node.def | 2 +- templates/show/log/image/node.tag/tail/node.tag/node.def | 2 +- 14 files changed, 30 insertions(+), 30 deletions(-) (limited to 'templates') diff --git a/scripts/rename-image.pl b/scripts/rename-image.pl index 2c77d70..591c29d 100644 --- a/scripts/rename-image.pl +++ b/scripts/rename-image.pl @@ -27,7 +27,7 @@ use File::Temp qw/ tempfile tempdir /; use File::Copy; use Sys::Syslog qw/:standard :macros/; -my $UNION_BOOT = '/live/image/boot'; +my $UNION_BOOT = '/lib/live/mount/persistence/boot'; my $XEN_DEFAULT_IMAGE = "$UNION_BOOT/%%default_image"; my $old_name; @@ -43,7 +43,7 @@ if (!defined($old_name) || !defined($new_name)) { exit 1; } -my $image_path = "/live/image/boot"; +my $image_path = "/lib/live/mount/persistence/boot"; if (! -e "$image_path") { # must be running on old non-image installed system @@ -80,7 +80,7 @@ if ($cur_name =~ s/BOOT_IMAGE=\/boot\///) { # On Xen/pygrub systems, we figure out the running version by # looking at the bind mount of /boot. $cur_name = `mount | awk '/on \\/boot / { print \$1 }'`; - $cur_name =~ s/\/live\/image\/boot\///; + $cur_name =~ s/\/lib\/live\/mount\/persistence\/boot\///; chomp($cur_name); } } diff --git a/scripts/show-image-storage.pl b/scripts/show-image-storage.pl index f8de35e..863b913 100644 --- a/scripts/show-image-storage.pl +++ b/scripts/show-image-storage.pl @@ -40,8 +40,8 @@ sub better_units { # # Figure out where the images live... -my $imagedir = "/live/image/boot"; -my $livecd = "/live/image/live"; +my $imagedir = "/lib/live/mount/persistence/boot"; +my $livecd = "/lib/live/mount/persistence/live"; if (! -e $imagedir) { if (-d $livecd) { die "System running on Live-CD\n"; @@ -73,11 +73,11 @@ foreach my $image (@bootlist_arr) { ($total, $garbage) = split(' ', $string); $total = better_units($total); - $string = `du -s -h $imagedir/$image --exclude live-rw`; + $string = `du -s -h $imagedir/$image --exclude rw`; ($read_only, $garbage) = split(' ', $string); $read_only = better_units($read_only); - $string = `du -s -h $imagedir/$image/live-rw`; + $string = `du -s -h $imagedir/$image/rw`; ($read_write, $garbage) = split(' ', $string); $read_write = better_units($read_write); diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl index e1d4a8c..52b4769 100755 --- a/scripts/vyatta-boot-image.pl +++ b/scripts/vyatta-boot-image.pl @@ -409,7 +409,7 @@ sub curVer { # On Xen/pygrub systems, we figure out the running version by # looking at the bind mount of /boot. $vers = `mount | awk '/on \\/boot / { print \$1 }'`; - $vers =~ s/\/live\/image\/boot\///; + $vers =~ s/\/lib\/live\/mount\/persistence\/boot\///; chomp($vers); } diff --git a/scripts/vyatta-image-tools.pl b/scripts/vyatta-image-tools.pl index 6bcfd7d..2dd95df 100755 --- a/scripts/vyatta-image-tools.pl +++ b/scripts/vyatta-image-tools.pl @@ -50,7 +50,7 @@ sub conv_file { if ($topdir eq "running") { $file = "/$file"; } elsif (lc($topdir) eq 'disk-install') { - $file = "/live/image/$file"; + $file = "/lib/live/mount/persistence/$file"; } elsif (lc($topdir) eq 'tftp') { $file = $filein; $topdir = 'url'; @@ -64,11 +64,11 @@ sub conv_file { $file = $filein; $topdir = 'url'; } else { - if (!-d "/live/image/boot/$topdir/live-rw"){ + if (!-d "/lib/live/mount/persistence/boot/$topdir/rw"){ print "Image $topdir not found!\n"; exit 1; } - $file = "/live/image/boot/$topdir/live-rw/$file"; + $file = "/lib/live/mount/persistence/boot/$topdir/rw/$file"; } return ($topdir, $file); } @@ -78,9 +78,9 @@ sub conv_file_to_rel { if ($topdir eq "running"){ $filename =~ s?/?$topdir://?; } elsif ($topdir eq "disk-install") { - $filename =~ s?/live/image/?$topdir://?; + $filename =~ s?/lib/live/mount/persistence/?$topdir://?; } else { - $filename =~ s?/live/image/boot/$topdir/live-rw/?$topdir://?; + $filename =~ s?/lib/live/mount/persistence/boot/$topdir/rw/?$topdir://?; } return $filename; } diff --git a/templates/add/raid/node.tag/member/node.tag/node.def b/templates/add/raid/node.tag/member/node.tag/node.def index b526e1e..14ac911 100644 --- a/templates/add/raid/node.tag/member/node.tag/node.def +++ b/templates/add/raid/node.tag/member/node.tag/node.def @@ -40,7 +40,7 @@ run: mounted_on_root=0 mounted_on=`mount | grep "^/dev/${raid_set}" | awk '{ print $3 }'` for dir in $mounted_on ; do - if [ "$dir" = "/" -o "$dir" = "/live/image" ]; then + if [ "$dir" = "/" -o "$dir" = "/lib/live/mount/persistence" ]; then mounted_on_root=1 fi done diff --git a/templates/clone/system/config/node.tag/from/node.tag/node.def b/templates/clone/system/config/node.tag/from/node.tag/node.def index c244559..d883c8c 100644 --- a/templates/clone/system/config/node.tag/from/node.tag/node.def +++ b/templates/clone/system/config/node.tag/from/node.tag/node.def @@ -1,11 +1,11 @@ help: Image to update from -allowed: reply=( $(compgen -d /live/image/boot/ | grep -v grub) ) +allowed: reply=( $(compgen -d /lib/live/mount/persistence/boot/ | grep -v grub) ) for i in `seq 0 $[${#reply[@]}-1]`; do file=${reply[$i]} - reply[$i]=${file/#\/live\/image\/boot\//} + reply[$i]=${file/#\/lib\/live\/mount\/persistence\/boot\//} done reply+=( "running" ) - if [[ -d /live/image/config ]];then + if [[ -d /lib/live/mount/persistence/config ]];then reply+=( "disk-install" ) fi echo "${reply[*]}" diff --git a/templates/clone/system/config/node.tag/node.def b/templates/clone/system/config/node.tag/node.def index 6e6e340..ec82322 100644 --- a/templates/clone/system/config/node.tag/node.def +++ b/templates/clone/system/config/node.tag/node.def @@ -1,8 +1,8 @@ help: Image to update -allowed: reply=( $(compgen -d /live/image/boot/ | grep -v grub) ) +allowed: reply=( $(compgen -d /lib/live/mount/persistence/boot/ | grep -v grub) ) for i in `seq 0 $[${#reply[@]}-1]`; do file=${reply[$i]} - reply[$i]=${file/#\/live\/image\/boot\//} + reply[$i]=${file/#\/lib\/live\/mount\/persistence\/boot\//} done echo "${reply[*]}" run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; diff --git a/templates/show/log/image/node.tag/all/node.def b/templates/show/log/image/node.tag/all/node.def index eb3c87c..fd15df0 100644 --- a/templates/show/log/image/node.tag/all/node.def +++ b/templates/show/log/image/node.tag/all/node.def @@ -2,4 +2,4 @@ help: Show contents of all master log files for image run: eval $(lesspipe) less $_vyatta_less_options \ --prompt=".log?m, file %i of %m., page %dt of %D" \ - -- `printf "%s\n" /live/image/boot/$4/live-rw/var/log/messages* | sort -nr` + -- `printf "%s\n" /lib/live/mount/persistence/boot/$4/rw/var/log/messages* | sort -nr` diff --git a/templates/show/log/image/node.tag/authorization/node.def b/templates/show/log/image/node.tag/authorization/node.def index aec45cc..e7e3330 100644 --- a/templates/show/log/image/node.tag/authorization/node.def +++ b/templates/show/log/image/node.tag/authorization/node.def @@ -1,4 +1,4 @@ help: Show listing of authorization attempts for image run: less $_vyatta_less_options \ --prompt=".log, page %dt of %D" \ - -- /live/image/boot/$4/live-rw/var/log/auth.log + -- /lib/live/mount/persistence/boot/$4/rw/var/log/auth.log diff --git a/templates/show/log/image/node.tag/directory/node.def b/templates/show/log/image/node.tag/directory/node.def index d9cb9cb..6d813cf 100644 --- a/templates/show/log/image/node.tag/directory/node.def +++ b/templates/show/log/image/node.tag/directory/node.def @@ -1,4 +1,4 @@ help: Show listing of user-defined log files for image -run: if [ -d /live/image/boot/$4/live-rw/var/log/user ] - then ls /live/image/boot/$4/live-rw/var/log/user +run: if [ -d /lib/live/mount/persistence/boot/$4/rw/var/log/user ] + then ls /lib/live/mount/persistence/boot/$4/rw/var/log/user fi diff --git a/templates/show/log/image/node.tag/file/node.tag/node.def b/templates/show/log/image/node.tag/file/node.tag/node.def index f347a86..5f6bb18 100644 --- a/templates/show/log/image/node.tag/file/node.tag/node.def +++ b/templates/show/log/image/node.tag/file/node.tag/node.def @@ -1,7 +1,7 @@ help: Show contents of specified user-defined log file for image allowed: local -a array ; - array=( /live/image/boot/${COMP_WORDS[3]}/live-rw/var/log/user/* ) ; + array=( /lib/live/mount/persistence/boot/${COMP_WORDS[3]}/rw/var/log/user/* ) ; [ ${#array[@]} -gt 0 ] && echo -n ${array[@]##*/} || echo -n none run: less $_vyatta_less_options \ --prompt=".$4 log, page %dt of %D" \ - -- /live/image/boot/$4/live-rw/var/log/user/$6 + -- /lib/live/mount/persistence/boot/$4/rw/var/log/user/$6 diff --git a/templates/show/log/image/node.tag/node.def b/templates/show/log/image/node.tag/node.def index daeb44e..05e7d01 100644 --- a/templates/show/log/image/node.tag/node.def +++ b/templates/show/log/image/node.tag/node.def @@ -1,11 +1,11 @@ help: Show contents of master log file for image -allowed: reply=( $(compgen -f /live/image/boot/ | grep -v grub) ) +allowed: reply=( $(compgen -f /lib/live/mount/persistence/boot/ | grep -v grub) ) for i in `seq 0 $[${#reply[@]}-1]`; do file=${reply[$i]} - reply[$i]=${file/#\/live\/image\/boot\//} + reply[$i]=${file/#\/lib\/live\/mount\/persistence\/boot\//} done echo "${reply[*]}" run: less $_vyatta_less_options \ --prompt=".log, page %dt of %D" \ - -- /live/image/boot/$4/live-rw/var/log/messages + -- /lib/live/mount/persistence/boot/$4/rw/var/log/messages diff --git a/templates/show/log/image/node.tag/tail/node.def b/templates/show/log/image/node.tag/tail/node.def index c7f0190..090eae4 100644 --- a/templates/show/log/image/node.tag/tail/node.def +++ b/templates/show/log/image/node.tag/tail/node.def @@ -1,2 +1,2 @@ help: Show last lines of messages file -run: tail /live/image/boot/$4/live-rw/var/log/messages +run: tail /lib/live/mount/persistence/boot/$4/rw/var/log/messages diff --git a/templates/show/log/image/node.tag/tail/node.tag/node.def b/templates/show/log/image/node.tag/tail/node.tag/node.def index f0af559..2c3eb14 100644 --- a/templates/show/log/image/node.tag/tail/node.tag/node.def +++ b/templates/show/log/image/node.tag/tail/node.tag/node.def @@ -1,3 +1,3 @@ help: Show last changes to messages allowed: echo -n '' -run: tail -n "$6" /live/image/boot/$4/live-rw/var/log/messages | ${VYATTA_PAGER:-cat} +run: tail -n "$6" /lib/live/mount/persistence/boot/$4/rw/var/log/messages | ${VYATTA_PAGER:-cat} -- cgit v1.2.3 From 918b53841364a016eec0e2996640c471f738e93b Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Tue, 9 Feb 2016 04:17:49 -0500 Subject: Use dhcp instead of dhcp3. --- scripts/dhcpv6-client-show-leases.pl | 4 ++-- scripts/show-dhcp-leases.pl | 2 +- scripts/vyatta-show-dhclient.pl | 2 +- templates/release/dhcpv6/interface/node.tag/node.def | 4 ++-- templates/renew/dhcpv6/interface/node.tag/node.def | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'templates') diff --git a/scripts/dhcpv6-client-show-leases.pl b/scripts/dhcpv6-client-show-leases.pl index 44be689..761a3e6 100644 --- a/scripts/dhcpv6-client-show-leases.pl +++ b/scripts/dhcpv6-client-show-leases.pl @@ -55,7 +55,7 @@ sub log_msg { # Main section. # -opendir (my $dir, "/var/lib/dhcp3"); +opendir (my $dir, "/var/lib/dhcp"); my @lease_files; while (my $f = readdir $dir) { if ($f =~ /^dhclient_v6_(\w+).leases$/) { @@ -74,7 +74,7 @@ my %ghash = (); foreach my $lease_filename (@lease_files) { my @lines=(); - open(my $f, '<', "/var/lib/dhcp3/$lease_filename") + open(my $f, '<', "/var/lib/dhcp/$lease_filename") or die "Can't open lease file for reading: $lease_filename\n"; @lines = <$f>; diff --git a/scripts/show-dhcp-leases.pl b/scripts/show-dhcp-leases.pl index a7a918a..431a13c 100755 --- a/scripts/show-dhcp-leases.pl +++ b/scripts/show-dhcp-leases.pl @@ -22,7 +22,7 @@ use strict; -opendir (my $dir, "/var/lib/dhcp3"); +opendir (my $dir, "/var/lib/dhcp"); my @leases; while (my $f = readdir $dir) { ($f =~ /^dhclient_([\w.]+)_lease$/) && push @leases, $1; diff --git a/scripts/vyatta-show-dhclient.pl b/scripts/vyatta-show-dhclient.pl index 5064c1c..40e284b 100755 --- a/scripts/vyatta-show-dhclient.pl +++ b/scripts/vyatta-show-dhclient.pl @@ -28,7 +28,7 @@ use POSIX; use strict; use warnings; -my $lease_dir = '/var/lib/dhcp3'; +my $lease_dir = '/var/lib/dhcp'; sub dhclient_get_lease_files { my ($intf) = @_; diff --git a/templates/release/dhcpv6/interface/node.tag/node.def b/templates/release/dhcpv6/interface/node.tag/node.def index 05f45c8..a8faa6c 100644 --- a/templates/release/dhcpv6/interface/node.tag/node.def +++ b/templates/release/dhcpv6/interface/node.tag/node.def @@ -2,8 +2,8 @@ help: Release DHCPv6 lease for interface allowed: local -a array - array=( /var/lib/dhcp3/dhclient_v6_*.conf ) - tail=${array[@]#/var/lib/dhcp3/dhclient_v6_} + array=( /var/lib/dhcp/dhclient_v6_*.conf ) + tail=${array[@]#/var/lib/dhcp/dhclient_v6_} ifnames=${tail[@]%.conf} echo -n ${ifnames[@]} diff --git a/templates/renew/dhcpv6/interface/node.tag/node.def b/templates/renew/dhcpv6/interface/node.tag/node.def index 2ef676d..9b5c191 100644 --- a/templates/renew/dhcpv6/interface/node.tag/node.def +++ b/templates/renew/dhcpv6/interface/node.tag/node.def @@ -2,8 +2,8 @@ help: Renew a DHCPv6 lease on an interface allowed: local -a array - array=( /var/lib/dhcp3/dhclient_v6_*.conf ) - tail=${array[@]#/var/lib/dhcp3/dhclient_v6_} + array=( /var/lib/dhcp/dhclient_v6_*.conf ) + tail=${array[@]#/var/lib/dhcp/dhclient_v6_} ifnames=${tail[@]%.conf} echo -n ${ifnames[@]} -- cgit v1.2.3 From c18b9618f4577fb80b07a0471f19a11ed2b3dfcb Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 3 Mar 2016 10:23:03 -0500 Subject: New implementation of the version display command (ref T6). --- Makefile.am | 2 +- debian/changelog | 6 + debian/control | 3 +- scripts/vyatta-show-version | 255 ----------------------------- scripts/vyos-show-version | 106 ++++++++++++ templates/show/version/added/node.def | 2 - templates/show/version/all/node.def | 5 +- templates/show/version/deleted/node.def | 2 - templates/show/version/downgraded/node.def | 2 - templates/show/version/funny/node.def | 2 +- templates/show/version/node.def | 2 +- templates/show/version/upgraded/node.def | 2 - 12 files changed, 121 insertions(+), 268 deletions(-) delete mode 100755 scripts/vyatta-show-version create mode 100644 scripts/vyos-show-version delete mode 100644 templates/show/version/added/node.def delete mode 100644 templates/show/version/deleted/node.def delete mode 100644 templates/show/version/downgraded/node.def delete mode 100644 templates/show/version/upgraded/node.def (limited to 'templates') diff --git a/Makefile.am b/Makefile.am index e736419..8212b02 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,7 +19,7 @@ interp_DATA += functions/interpreter/vyatta-image-complete bin_SCRIPTS = scripts/vyatta-show-interfaces bin_SCRIPTS += scripts/vyatta-show-interfaces.pl -bin_SCRIPTS += scripts/vyatta-show-version +bin_SCRIPTS += scripts/vyos-show-version bin_SCRIPTS += scripts/vyatta-show-dhclient.pl bin_SCRIPTS += scripts/vyatta-show-dmi bin_SCRIPTS += scripts/vyatta-tshark-interface-port.pl diff --git a/debian/changelog b/debian/changelog index 5a896d3..8744266 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-op (0.14.0+vyos2+current2) unstable; urgency=medium + + * New implementation of "run show version" + + -- Thu, 03 Mar 2016 09:57:48 -0500 + vyatta-op (0.14.0+vyos2+current1) unstable; urgency=medium [ Thomas Jepp ] diff --git a/debian/control b/debian/control index 1046c54..6062453 100644 --- a/debian/control +++ b/debian/control @@ -32,7 +32,8 @@ Depends: sed (>= 4.1.5), libtimedate-perl, usbutils, lsscsi, - hvinfo + hvinfo, + python-pystache Suggests: util-linux (>= 2.13-5), ncurses-bin (>= 5.5-5), dialog diff --git a/scripts/vyatta-show-version b/scripts/vyatta-show-version deleted file mode 100755 index dd4f7bc..0000000 --- a/scripts/vyatta-show-version +++ /dev/null @@ -1,255 +0,0 @@ -#!/usr/bin/perl -w -# -# Module: show_version -# -# **** 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) 2005-2013 Vyatta, Inc. -# All Rights Reserved. -# -# Author: Rick Balocca -# Date: 2007 -# Description: -# -# **** End License **** -# -use strict; -use warnings; - -# -# Global hash of debians in the base install and now. -# -my $rHoH_base_debs; -my $rHoH_now_debs; - -my $base = '/opt/vyatta/etc'; -my $versionfile = "$base/version"; -my $buildfile = "$base/build.txt"; -my $debsfile = "$base/deb-versions.txt"; - -sub echo_file { - my ($file) = @_; - - my @lines = (); - if (!(-e $file)) { - return @lines; - } - - open(my $FH, '<', $file) or die "Unable to open [$file]\n"; - @lines=<$FH>; - close($FH); - return @lines; -} - -# This follows the chain from /boot/grub/menu.cfg which -# boots /boot/vmlinuz to find the version of kernel running -sub get_image_type { - my $kernel = readlink('/boot/vmlinuz'); - my $version; - - unless (defined($kernel)) { - warn "Can not read link /boot/vmlinuz: $!\n"; - return; - } - - unless ($kernel =~ /^vmlinuz-.*-([^-]*)-(vyatta|vyos)(.*)$/) { - warn "Unknown kernel version: $kernel\n"; - return; - } - - # XXX: Maybe just check 'uname -m' ? - if ($1 eq '586') { - $version = "x86 32-bit"; - } elsif ($1 eq "amd64") { - $version = "x86 64-bit"; - } else { - $version = $1; - } - - if ($3 eq '-virt') { - $version .= " Virtual" - } - - return $version; -} - -# -# convert the "dpkg -l" output have same format as deb-versions.txt -# -sub get_pkg_version { - my @lines = @_; - - my @new_lines = (); - foreach my $line (@lines) { - if ($line =~ /^[D\|\+]/) { - next; # skip header - } - my ($status, $pkg, $version) = split(/[ \t\n]+/, $line, 4); - if ($status =~ /^i/) { - push(@new_lines, "$pkg $version"); - } - } - return @new_lines; -} - -sub read_pkg_file { - my @pkgs_list = @_; - - my %HoH = (); - my ($name, $version); - foreach my $line (@pkgs_list) { - ($name, $version) = split(/[ \t\n]+/, $line, 3); - $HoH{$name}{'version'} = $version; - } - return \%HoH; -} - -sub show_added { - for my $name (sort keys %$rHoH_now_debs) { - if (!$rHoH_base_debs->{$name}) { - printf("Aii %-25s %-25s\n", - $name, $rHoH_now_debs->{$name}->{'version'}); - } - } -} - -sub show_deleted { - for my $name (sort keys %$rHoH_base_debs) { - if (!$rHoH_now_debs->{$name}) { - printf("X %-25s %-25s\n", - $name, $rHoH_base_debs->{$name}->{'version'}); - } - } -} - -sub show_upgraded_downgraded { - my ($up_down) = @_; - - my ($symbol, $op, $ver_base, $ver_now, $cmd); - if ($up_down eq "upgraded") { - $symbol = "U"; - $op = "lt"; - } else { - $symbol = "D"; - $op = "gt"; - } - for my $name (sort keys %$rHoH_base_debs) { - if ($rHoH_now_debs->{$name}) { - $ver_base = $rHoH_base_debs->{$name}{'version'}; - $ver_now = $rHoH_now_debs->{$name}{'version'}; - if ($ver_base ne $ver_now) { - $cmd = "dpkg --compare-versions \"$ver_base\" $op \"$ver_now\""; - if (!system($cmd)) { - printf("%sii %-25s %-20s (baseline: %s)\n", - $symbol, $name, $ver_now, $ver_base); - } - } - } - } -} - -sub show_upgraded { - show_upgraded_downgraded("upgraded"); -} - -sub show_downgraded { - show_upgraded_downgraded("downgraded"); -} - -sub show_all { - show_added(); - show_deleted(); - show_upgraded(); - show_downgraded(); -} - -my %options = ( - "added" => \&show_added, - "deleted", => \&show_deleted, - "upgraded" => \&show_upgraded, - "downgraded" => \&show_downgraded, - "all" => \&show_all, -); - -# -# main -# -my $hv = `hvinfo`; -if (defined($hv) && $hv ne "") { - $versionfile .= "-virt"; -} -print(&echo_file($versionfile)); -print(&echo_file($buildfile)); - -my $type = get_image_type(); -if ($type) { - print "System type: $type\n"; -} - -my $booted = `grep -e '^overlayfs.*/filesystem.squashfs' /proc/mounts`; -if (defined($booted) && $booted ne "") { - $booted="livecd"; -} else { - my $image_boot = `grep -e '^overlayfs /' /proc/mounts`; - if ($image_boot ne "") { - $booted="image"; - } else { - $booted="disk"; - } -} -print "Boot via: $booted\n"; - -if (defined($hv) && $hv ne "") { - chomp $hv; - print "Hypervisor: $hv\n"; -} - - -my $plat_model = `sudo /usr/sbin/dmidecode -s system-product-name`; -chomp $plat_model; -my $plat_sn = `sudo /usr/sbin/dmidecode -s system-serial-number`; -chomp $plat_sn; -my $plat_uuid = `sudo /usr/sbin/dmidecode -s system-uuid`; -chomp $plat_uuid; - -if (defined $plat_model && $plat_model ne "" && $plat_model ne " ") { - print "HW model: $plat_model\n" -} - -if (defined $plat_sn && $plat_sn ne "" && $plat_sn ne " ") { - print "HW S/N: $plat_sn\n" -} - -if (defined $plat_uuid && $plat_uuid ne "" && $plat_uuid ne " ") { - print "HW UUID: $plat_uuid\n" -} - -my $uptime = `uptime`; -if (defined $uptime && $uptime ne "") { - print "Uptime: $uptime\n"; -} - -if (!(-e $debsfile)) { - exit 0; -} -print "\n"; -$rHoH_base_debs = read_pkg_file(&echo_file($debsfile)); -$rHoH_now_debs = read_pkg_file(get_pkg_version(`dpkg -l 2> /dev/null`)); - -if ($#ARGV == 0) { - if ($options{$ARGV[0]}) { - $options{$ARGV[0]}->(); - } else { - print "Usage: showversion [added|deleted|upgraded|downgraded|all]\n"; - exit 1; - } -} diff --git a/scripts/vyos-show-version b/scripts/vyos-show-version new file mode 100644 index 0000000..a701b84 --- /dev/null +++ b/scripts/vyos-show-version @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 VyOS maintainers and contributors +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or later 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# File: vyos-show-version +# Purpose: +# Displays image version and system information. +# Used by the "run show version" command. + + +import sys +import subprocess +import json + +import pystache + + +def read_file(name): + with open (name, "r") as f: + data = f.read() + return data.strip() + +version_file = '/opt/vyatta/etc/version.json' +version_data = None + +version_output_tmpl = """ +Version: VyOS {{version}} +Built by: {{built_by}} +Built on: {{built_on}} +Build ID: {{build_id}} + +Architecture: {{system_arch}} +Boot via: {{boot_via}} +System type: {{system_type}} + +Hardware vendor: {{hardware_vendor}} +Hardware model: {{hardware_model}} +Hardware S/N: {{hardware_serial}} +Hardware UUID: {{hardware_uuid}} + +Copyright: VyOS maintainers and contributors + +""" + +# Get and display image version data from the built-in version file +# This gives us image version, built on, build by, and build UUID +try: + with open(version_file, 'r') as f: + version_data = json.load(f) +except: + print("Unable to get VyOS version data") + sys.exit(1) + + +# Get system architecture (well, kernel architecture rather) +version_data['system_arch'] = subprocess.check_output('uname -m', shell=True).strip() + + +# Get hypervisor name, if any +system_type = "physical" +try: + hypervisor = subprocess.check_output('hvinfo', shell=True).strip() + system_type = "{0} guest".format(hypervisor) +except CalledProcessError: + # hvinfo returns 1 if it cannot detect any hypervisor + pass +version_data['system_type'] = system_type + + +# Get boot type, it can be livecd, installed image, or, possible, a system installed +# via legacy "install system" mechanism +# In installed images, the squashfs image file is named after its image version, +# while on livecd it's just "filesystem.squashfs", that's how we tell a livecd boot +# from an installed image +boot_via = "installed image" +if subprocess.call(""" grep -e '^overlay.*/filesystem.squashfs' /proc/mounts >/dev/null""", shell=True) == 0: + boot_via = "livecd" +elif subprocess.call(""" grep '^overlay /' /proc/mounts >/dev/null """, shell=True) != 0: + boot_via = "legacy non-image installation" +version_data['boot_via'] = boot_via + + +# Get hardware details from DMI +version_data['hardware_vendor'] = read_file('/sys/class/dmi/id/sys_vendor') +version_data['hardware_model'] = read_file('/sys/class/dmi/id/product_name') +# XXX: serial and uuid files are only readable for root, so we cannot just read them +# when script is ran by a normal user, hence this ugly fixup +version_data['hardware_serial'] = subprocess.check_output('sudo cat /sys/class/dmi/id/subsystem/id/product_serial', shell=True).strip() +version_data['hardware_uuid'] = subprocess.check_output('sudo cat /sys/class/dmi/id/subsystem/id/product_uuid', shell=True).strip() + + +output = pystache.render(version_output_tmpl, version_data).strip() +print(output) + diff --git a/templates/show/version/added/node.def b/templates/show/version/added/node.def deleted file mode 100644 index 2381b74..0000000 --- a/templates/show/version/added/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show VyOS version information plus added packages -run: ${vyatta_bindir}/vyatta-show-version added diff --git a/templates/show/version/all/node.def b/templates/show/version/all/node.def index 5b60609..8344124 100644 --- a/templates/show/version/all/node.def +++ b/templates/show/version/all/node.def @@ -1,2 +1,5 @@ help: Show VyOS version information plus all packages changes -run: ${vyatta_bindir}/vyatta-show-version all +run: ${vyatta_bindir}/vyos-show-version + echo "" + echo "Package versions:" + dpkg -l diff --git a/templates/show/version/deleted/node.def b/templates/show/version/deleted/node.def deleted file mode 100644 index d328cf6..0000000 --- a/templates/show/version/deleted/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show VyOS version information plus deleted packages -run: ${vyatta_bindir}/vyatta-show-version deleted diff --git a/templates/show/version/downgraded/node.def b/templates/show/version/downgraded/node.def deleted file mode 100644 index 250b048..0000000 --- a/templates/show/version/downgraded/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show VyOS version information plus downgraded packages -run: ${vyatta_bindir}/vyatta-show-version downgraded diff --git a/templates/show/version/funny/node.def b/templates/show/version/funny/node.def index cb62c96..e6544f9 100644 --- a/templates/show/version/funny/node.def +++ b/templates/show/version/funny/node.def @@ -1,5 +1,5 @@ help: Show VyOS version information plus a funny poem run: - ${vyatta_bindir}/vyatta-show-version + ${vyatta_bindir}/vyos-show-version ${vyatta_bindir}/limericks.py diff --git a/templates/show/version/node.def b/templates/show/version/node.def index 4237e5d..e2bfc1f 100644 --- a/templates/show/version/node.def +++ b/templates/show/version/node.def @@ -1,2 +1,2 @@ help: Show VyOS version information -run: ${vyatta_bindir}/vyatta-show-version +run: ${vyatta_bindir}/vyos-show-version diff --git a/templates/show/version/upgraded/node.def b/templates/show/version/upgraded/node.def deleted file mode 100644 index b693c23..0000000 --- a/templates/show/version/upgraded/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show VyOS version information plus upgraded packages -run: ${vyatta_bindir}/vyatta-show-version upgraded -- cgit v1.2.3 From a04d085faa6baf3a021b8d795e1a8487f4317d1c Mon Sep 17 00:00:00 2001 From: Ewald van Geffen Date: Sun, 26 Jun 2016 20:40:13 +0200 Subject: T58 "monitor firewall name " does not monitor any firewall-log-entry related to set firewall name enable-default-log --- templates/monitor/firewall/name/node.tag/node.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates') diff --git a/templates/monitor/firewall/name/node.tag/node.def b/templates/monitor/firewall/name/node.tag/node.def index 16b9244..9593cb8 100644 --- a/templates/monitor/firewall/name/node.tag/node.def +++ b/templates/monitor/firewall/name/node.tag/node.def @@ -3,4 +3,4 @@ allowed: local -a ARR eval "ARR=($(cli-shell-api -- listEffectiveNodes firewall name))" echo ${ARR[@]} run: echo "Notice: monitoring information is displayed only for rules with enabled logging"; \ - ${vyatta_bindir}/vyatta-monitor Firewall-$4 "\[$4-[0-9]*-[A,D,R]\]" + ${vyatta_bindir}/vyatta-monitor Firewall-$4 "\[$4-([0-9]*|default)-[A,D,R]\]" -- cgit v1.2.3 From 5bcdfaec5070a3eac32dca289167dc995db75b6b Mon Sep 17 00:00:00 2001 From: Ewald van Geffen Date: Sun, 11 Dec 2016 22:52:35 +0100 Subject: T207: modified brctl location --- functions/tech-support | 6 +++--- templates/show/bridge/node.def | 2 +- templates/show/bridge/node.tag/macs/node.def | 2 +- templates/show/bridge/node.tag/node.def | 2 +- templates/show/bridge/node.tag/spanning-tree/node.def | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'templates') diff --git a/functions/tech-support b/functions/tech-support index 680dc09..e4602d2 100755 --- a/functions/tech-support +++ b/functions/tech-support @@ -122,11 +122,11 @@ header Number of incomplete entries in ARP table show arp | grep incomplete | wc -l header Bridge -/usr/sbin/brctl show +/sbin/brctl show for br in $(/opt/vyatta/sbin/vyatta-interfaces.pl --show=bridge) do header "Bridge Information for $br" - /usr/sbin/brctl showstp $br - /usr/sbin/brctl showmacs $br + /sbin/brctl showstp $br + /sbin/brctl showmacs $br done header Serial diff --git a/templates/show/bridge/node.def b/templates/show/bridge/node.def index a1ed782..86d0193 100644 --- a/templates/show/bridge/node.def +++ b/templates/show/bridge/node.def @@ -1,2 +1,2 @@ help: Show bridging information -run: /usr/sbin/brctl show +run: /sbin/brctl show diff --git a/templates/show/bridge/node.tag/macs/node.def b/templates/show/bridge/node.tag/macs/node.def index d07958c..e985437 100644 --- a/templates/show/bridge/node.tag/macs/node.def +++ b/templates/show/bridge/node.tag/macs/node.def @@ -1,2 +1,2 @@ help: Show bridge Media Access Control (MAC) address table -run: /usr/sbin/brctl showmacs "$3" +run: /sbin/brctl showmacs "$3" diff --git a/templates/show/bridge/node.tag/node.def b/templates/show/bridge/node.tag/node.def index d20611f..0ae82f1 100644 --- a/templates/show/bridge/node.tag/node.def +++ b/templates/show/bridge/node.tag/node.def @@ -2,4 +2,4 @@ help: Show bridge information for a given bridge interface allowed: local -a array ; array=( /sys/class/net/br* ) ; echo -n '' ${array[@]##*/} -run: /usr/sbin/brctl show "$3" +run: /sbin/brctl show "$3" diff --git a/templates/show/bridge/node.tag/spanning-tree/node.def b/templates/show/bridge/node.tag/spanning-tree/node.def index 3921867..360d15a 100644 --- a/templates/show/bridge/node.tag/spanning-tree/node.def +++ b/templates/show/bridge/node.tag/spanning-tree/node.def @@ -1,2 +1,2 @@ help: Show bridge spanning tree information -run: /usr/sbin/brctl showstp "$3" +run: /sbin/brctl showstp "$3" -- cgit v1.2.3 From ece88fcafb45dd683a0cad3801c79537cd411d44 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 21 Dec 2016 23:08:44 +0100 Subject: T156: return "Unknown" for /sys/class/dmi/* files that don't exist. --- scripts/vyos-show-version | 19 ++++++++++++------- templates/show/version/all/node.def | 2 +- templates/show/version/funny/node.def | 2 +- templates/show/version/node.def | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) (limited to 'templates') diff --git a/scripts/vyos-show-version b/scripts/vyos-show-version index c0609ca..438f365 100644 --- a/scripts/vyos-show-version +++ b/scripts/vyos-show-version @@ -28,9 +28,14 @@ import pystache def read_file(name): - with open (name, "r") as f: - data = f.read() - return data.strip() + try: + with open (name, "r") as f: + data = f.read() + return data.strip() + except: + # This works since we only read /sys/class/* stuff + # with this function + return "Unknown" version_file = '/opt/vyatta/etc/version.json' version_data = None @@ -95,10 +100,10 @@ version_data['boot_via'] = boot_via # Get hardware details from DMI version_data['hardware_vendor'] = read_file('/sys/class/dmi/id/sys_vendor') version_data['hardware_model'] = read_file('/sys/class/dmi/id/product_name') -# XXX: serial and uuid files are only readable for root, so we cannot just read them -# when script is ran by a normal user, hence this ugly fixup -version_data['hardware_serial'] = subprocess.check_output('sudo cat /sys/class/dmi/id/subsystem/id/product_serial', shell=True).strip() -version_data['hardware_uuid'] = subprocess.check_output('sudo cat /sys/class/dmi/id/subsystem/id/product_uuid', shell=True).strip() + +# These two assume script is run as root, normal users can't access those files +version_data['hardware_serial'] = read_file('/sys/class/dmi/id/subsystem/id/product_serial') +version_data['hardware_uuid'] = read_file('/sys/class/dmi/id/subsystem/id/product_uuid') output = pystache.render(version_output_tmpl, version_data).strip() diff --git a/templates/show/version/all/node.def b/templates/show/version/all/node.def index 8344124..e98a16d 100644 --- a/templates/show/version/all/node.def +++ b/templates/show/version/all/node.def @@ -1,5 +1,5 @@ help: Show VyOS version information plus all packages changes -run: ${vyatta_bindir}/vyos-show-version +run: sudo ${vyatta_bindir}/vyos-show-version echo "" echo "Package versions:" dpkg -l diff --git a/templates/show/version/funny/node.def b/templates/show/version/funny/node.def index e6544f9..cb1b6b0 100644 --- a/templates/show/version/funny/node.def +++ b/templates/show/version/funny/node.def @@ -1,5 +1,5 @@ help: Show VyOS version information plus a funny poem run: - ${vyatta_bindir}/vyos-show-version + sudo ${vyatta_bindir}/vyos-show-version ${vyatta_bindir}/limericks.py diff --git a/templates/show/version/node.def b/templates/show/version/node.def index e2bfc1f..a3fd8af 100644 --- a/templates/show/version/node.def +++ b/templates/show/version/node.def @@ -1,2 +1,2 @@ help: Show VyOS version information -run: ${vyatta_bindir}/vyos-show-version +run: sudo ${vyatta_bindir}/vyos-show-version -- cgit v1.2.3 From 40d5341bd0f4e5ceb10c82ab8e6794c08f509f62 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Fri, 17 Feb 2017 03:39:07 -0500 Subject: T272: Add scripts and templates for generating remote side OpenVPN configs (just for VyOS for now, raw openvpn config support will come later). --- Makefile.am | 1 + scripts/vyos-openvpn-remoteconfig.pl | 122 +++++++++++++++++++++ templates/show/remote-config/node.def | 1 + templates/show/remote-config/openvpn/node.def | 1 + .../show/remote-config/openvpn/node.tag/node.def | 5 + .../openvpn/node.tag/remote-platform/node.def | 1 + .../node.tag/remote-platform/node.tag/node.def | 9 ++ 7 files changed, 140 insertions(+) create mode 100644 scripts/vyos-openvpn-remoteconfig.pl create mode 100644 templates/show/remote-config/node.def create mode 100644 templates/show/remote-config/openvpn/node.def create mode 100644 templates/show/remote-config/openvpn/node.tag/node.def create mode 100644 templates/show/remote-config/openvpn/node.tag/remote-platform/node.def create mode 100644 templates/show/remote-config/openvpn/node.tag/remote-platform/node.tag/node.def (limited to 'templates') diff --git a/Makefile.am b/Makefile.am index 8212b02..2554bb3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,6 +57,7 @@ bin_SCRIPTS += scripts/limericks.py sbin_SCRIPTS = scripts/dhcpv6-client-show-leases.pl sbin_SCRIPTS += scripts/vyatta-image-tools.pl sbin_SCRIPTS += scripts/vyatta-regen-unpriv-commands.sh +sbin_SCRIPTS += scripts/vyos-openvpn-remoteconfig.pl bin_sudo_users_SCRIPTS = scripts/vyatta-identify-interface.pl bin_sudo_users_SCRIPTS += scripts/vyatta-delete-log-file.sh diff --git a/scripts/vyos-openvpn-remoteconfig.pl b/scripts/vyos-openvpn-remoteconfig.pl new file mode 100644 index 0000000..1777d08 --- /dev/null +++ b/scripts/vyos-openvpn-remoteconfig.pl @@ -0,0 +1,122 @@ +#!/usr/bin/perl +# +# Copyright (C) 2017 VyOS maintainers and contributors +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or later 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +use lib "/opt/vyatta/share/perl5/"; +use Vyatta::Config; + +use warnings; +use strict; + +sub auth_warning +{ + print("NOTE: authentication options are deliberately left out,\n"); + print("since we cannot know file paths on a remote system\n\n"); +} + +my $config = new Vyatta::Config; + +my $intf = $ARGV[0]; +if(!defined($intf)) +{ + print("OpenVPN interface is not specified!\n"); + exit(1); +} + +my $remote = $ARGV[1]; +if(!defined($remote)) +{ + print("Remote side platform is not specified!\n"); + exit(1); +} + +if(!$config->exists("interfaces openvpn $intf")) +{ + print("OpenVPN interface $intf does not exist!\n"); + exit(1); +} + +$config->setLevel("interfaces openvpn $intf"); + +my $mode = $config->returnValue('mode'); + +my $localhost = $config->returnValue("local-host"); +my $localport = $config->returnValue("local-port"); +my $remotehost = $config->returnValue("remote-host"); +my $remoteaddr = $config->returnValue("remote-address"); +my $remoteport = $config->returnValue("remote-port"); +my $cipher = $config->returnValue("encryption"); +my $hash = $config->returnValue("hash"); +my $protocol = $config->returnValue("protocol"); +my $persist = $config->exists("persistent-tunnel"); +my $tlsrole = $config->returnValue("tls role"); +my $devtype = $config->returnValue("device-type"); +my @options = $config->returnValues("openvpn-option"); + +# local-addr is a tag node... +# Let's limit it to only the first address for now, +# since remote-address is limited to only one address anyway! +my @localaddrs = $config->listNodes('local-address'); +my $localaddr = undef; +if(@localaddrs) { + $localaddr = $localaddrs[0]; +} + +if($mode eq 'client') +{ + print("It is impossible to produce a complete server config from a client config!\n"); + exit(1); +} +elsif($mode eq 'site-to-site') +{ + if($remote eq 'vyos') + { + auth_warning; + + print("edit interfaces openvpn $intf\n"); + print("set mode site-to-site\n"); + print("set device-type $devtype\n") if defined($devtype); + print("set remote-host $localhost\n") if defined($localhost); + print("set remote-address $localaddr\n") if defined($localaddr); + print("set remote-port $localport\n") if defined($localport); + print("set local-host $remotehost\n") if defined($remotehost); + print("set local-address $remoteaddr\n") if defined($remoteaddr); + print("set local-port $remoteport\n") if defined($remoteport); + print("set protocol $protocol\n") if defined($protocol); + print("set encryption $cipher\n") if defined($cipher); + print("set hash $hash\n") if defined($hash); + + for my $o (@options) { print("set openvpn-option \"$o\"\n"); } + + print "tls role passive\n" if (defined($tlsrole) && ($tlsrole eq 'active')); + print "tls role active\n" if (defined($tlsrole) && ($tlsrole eq 'passive')); + print("top\n"); + } +} +elsif($mode eq 'server') +{ + if($remote eq 'vyos') + { + auth_warning; + + print("edit interfaces openvpn $intf\n"); + print("set mode client"); + print("set device-type $devtype\n") if defined($devtype); + print("set remote-host $localhost\n") if defined($localhost); + print("set remote-port $localport\n") if defined($localport); + print("set protocol $protocol\n") if defined($protocol); + print("top\n"); + } +} diff --git a/templates/show/remote-config/node.def b/templates/show/remote-config/node.def new file mode 100644 index 0000000..1675abd --- /dev/null +++ b/templates/show/remote-config/node.def @@ -0,0 +1 @@ +help: Show remote side config diff --git a/templates/show/remote-config/openvpn/node.def b/templates/show/remote-config/openvpn/node.def new file mode 100644 index 0000000..d417cb6 --- /dev/null +++ b/templates/show/remote-config/openvpn/node.def @@ -0,0 +1 @@ +help: Show remote side config for OpenVPN diff --git a/templates/show/remote-config/openvpn/node.tag/node.def b/templates/show/remote-config/openvpn/node.tag/node.def new file mode 100644 index 0000000..afb8cfb --- /dev/null +++ b/templates/show/remote-config/openvpn/node.tag/node.def @@ -0,0 +1,5 @@ +help: Show remote side OpenVPN config + +allowed: local -a array ; + eval "array=( $(cli-shell-api listEffectiveNodes interfaces openvpn) )" ; + echo -n '' ${array[@]##*/} diff --git a/templates/show/remote-config/openvpn/node.tag/remote-platform/node.def b/templates/show/remote-config/openvpn/node.tag/remote-platform/node.def new file mode 100644 index 0000000..15502c9 --- /dev/null +++ b/templates/show/remote-config/openvpn/node.tag/remote-platform/node.def @@ -0,0 +1 @@ +help: Show remote side OpenVPN config for specified platform diff --git a/templates/show/remote-config/openvpn/node.tag/remote-platform/node.tag/node.def b/templates/show/remote-config/openvpn/node.tag/remote-platform/node.tag/node.def new file mode 100644 index 0000000..66f334c --- /dev/null +++ b/templates/show/remote-config/openvpn/node.tag/remote-platform/node.tag/node.def @@ -0,0 +1,9 @@ +help: Show remote side OpenVPN config for specified platform +allowed: echo -n "vyos openvpn" + +run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; + then + sudo ${vyatta_sbindir}/vyos-openvpn-remoteconfig.pl $4 $6 + else + echo Must be an admin user to run this command. + fi -- cgit v1.2.3 From 59a22f722a98a66f94ee5ff65f10a8e20d79181c Mon Sep 17 00:00:00 2001 From: Chris Freas Date: Fri, 3 Mar 2017 10:51:30 -0500 Subject: T283: add CLI command to regenerate SSH server host keys --- scripts/ssh-server-key | 15 +++++++++++++++ templates/generate/ssh-server-key/node.def | 2 ++ 2 files changed, 17 insertions(+) create mode 100755 scripts/ssh-server-key create mode 100644 templates/generate/ssh-server-key/node.def (limited to 'templates') diff --git a/scripts/ssh-server-key b/scripts/ssh-server-key new file mode 100755 index 0000000..9712393 --- /dev/null +++ b/scripts/ssh-server-key @@ -0,0 +1,15 @@ +regen_host_keys () +{ + sudo /bin/rm -v /etc/ssh/ssh_host_* + sudo dpkg-reconfigure openssh-server + sudo /etc/init.d/ssh restart +} + +while true; do + read -p "Do you really want to remove the existing SSH host keys? " yn + case $yn in + [Yy]* ) regen_host_keys; break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac +done diff --git a/templates/generate/ssh-server-key/node.def b/templates/generate/ssh-server-key/node.def new file mode 100644 index 0000000..a31a734 --- /dev/null +++ b/templates/generate/ssh-server-key/node.def @@ -0,0 +1,2 @@ +help: Regenerate the host SSH keys and restart the SSH server +run: ${vyatta_bindir}/ssh-server-key -- cgit v1.2.3 From 009a4536a3d43d1a7166aef5ad2829cf068f0aa9 Mon Sep 17 00:00:00 2001 From: Thore Date: Sun, 19 Mar 2017 22:22:29 +0100 Subject: Exchange vyatta with vyos When typing "show system" and pressing tab the autosuggestion still said the installation was based on a vyatta image. --- templates/show/system/image/node.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates') diff --git a/templates/show/system/image/node.def b/templates/show/system/image/node.def index 08caab7..0766094 100644 --- a/templates/show/system/image/node.def +++ b/templates/show/system/image/node.def @@ -1,2 +1,2 @@ -help: Show installed Vyatta images +help: Show installed VyOS images run: /opt/vyatta/bin/vyatta-boot-image.pl --show -- cgit v1.2.3 From 1e094d77022ad49f29f05718913b4c5b23203012 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Tue, 25 Jul 2017 19:19:13 +0200 Subject: The command "show log firewall name " does not show the expected log entries --- templates/show/log/firewall/ipv6-name/node.tag/node.def | 2 +- templates/show/log/firewall/name/node.tag/node.def | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/templates/show/log/firewall/ipv6-name/node.tag/node.def b/templates/show/log/firewall/ipv6-name/node.tag/node.def index 072e210..629e237 100644 --- a/templates/show/log/firewall/ipv6-name/node.tag/node.def +++ b/templates/show/log/firewall/ipv6-name/node.tag/node.def @@ -1,5 +1,5 @@ help: Show log for a specified firewall allowed: local -a ARR=$(cli-shell-api -- listEffectiveNodes firewall ipv6-name) echo "${ARR[@]//\'/}" -run: cat $(printf "%s\n" /var/log/messages* | sort -nr) | egrep "\[$5-[0-9]+|default-[ADR]\]" +run: cat $(printf "%s\n" /var/log/messages* | sort -nr ) | egrep "\[$5-([0-9]+|default)-[ADR]\]" diff --git a/templates/show/log/firewall/name/node.tag/node.def b/templates/show/log/firewall/name/node.tag/node.def index 4e71fa0..7431f8a 100644 --- a/templates/show/log/firewall/name/node.tag/node.def +++ b/templates/show/log/firewall/name/node.tag/node.def @@ -1,5 +1,5 @@ help: Show log for a specified firewall allowed: local -a ARR=$(cli-shell-api -- listEffectiveNodes firewall name) echo "${ARR[@]//\'/}" -run: cat $(printf "%s\n" /var/log/messages* | sort -nr ) | egrep "\[$5-[0-9]+|default-[ADR]\]" +run: cat $(printf "%s\n" /var/log/messages* | sort -nr ) | egrep "\[$5-([0-9]+|default)-[ADR]\]" -- cgit v1.2.3 From f24ba92387996bf91051830ad8fd074e33497fac Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 28 Aug 2017 17:16:16 +0200 Subject: Remove "install system" command Related to "T157: Remove "install system" command". --- templates/install/system/node.def | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 templates/install/system/node.def (limited to 'templates') diff --git a/templates/install/system/node.def b/templates/install/system/node.def deleted file mode 100644 index c200404..0000000 --- a/templates/install/system/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Install system to hard drive -run: sudo /opt/vyatta/sbin/install-system -- cgit v1.2.3 From 699a9c48a9ac866ada70206dd1f3b1e1dd23a69c Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 29 Oct 2017 15:36:45 +0100 Subject: Change 'show tech-support' behavior to always strip-private Using "show tech-support" cmd will produce the tech-support output without any private information. Using "show tech-support private" cmd will produce the tech-support output with private information included. Note: ===== The Perl script (vyos-strip-config.pl) used to remove any sensible information will in addition remove version numbers if they match the regexp below: # Strip IPv4 addresses $input =~ s/\d+\.\d+\.(\d+)\.(\d+)/xxx.xxx.$1.$2/g if $stripIP; Example: ======== i apt xxx.xxx.9.8.4 amd64 commandline package manager ii apt-transport-https xxx.xxx.9.8.4 amd64 https download transport for APT i apt 1.0.9.8.4 amd64 commandline package manager ii apt-transport-https 1.0.9.8.4 amd64 https download transport for APT This behavior is present in the current implementation and should be addressed during the move to the new Python scripts. --- debian/changelog | 8 ++++++++ templates/show/tech-support/brief/node.def | 4 ++-- templates/show/tech-support/brief/save-uncompressed/node.def | 4 ++-- .../show/tech-support/brief/save-uncompressed/node.tag/node.def | 4 ++-- templates/show/tech-support/brief/save/node.def | 4 ++-- templates/show/tech-support/brief/save/node.tag/node.def | 4 ++-- templates/show/tech-support/node.def | 4 ++-- templates/show/tech-support/private/brief/node.def | 7 +++++++ .../show/tech-support/private/brief/save-uncompressed/node.def | 7 +++++++ .../private/brief/save-uncompressed/node.tag/node.def | 8 ++++++++ templates/show/tech-support/private/brief/save/node.def | 7 +++++++ templates/show/tech-support/private/brief/save/node.tag/node.def | 8 ++++++++ templates/show/tech-support/private/node.def | 7 +++++++ templates/show/tech-support/private/save-uncompressed/node.def | 7 +++++++ .../show/tech-support/private/save-uncompressed/node.tag/node.def | 8 ++++++++ templates/show/tech-support/private/save/node.def | 7 +++++++ templates/show/tech-support/private/save/node.tag/node.def | 8 ++++++++ templates/show/tech-support/save-uncompressed/node.def | 4 ++-- templates/show/tech-support/save-uncompressed/node.tag/node.def | 4 ++-- templates/show/tech-support/save/node.def | 4 ++-- templates/show/tech-support/save/node.tag/node.def | 6 +++--- 21 files changed, 103 insertions(+), 21 deletions(-) create mode 100644 templates/show/tech-support/private/brief/node.def create mode 100644 templates/show/tech-support/private/brief/save-uncompressed/node.def create mode 100644 templates/show/tech-support/private/brief/save-uncompressed/node.tag/node.def create mode 100644 templates/show/tech-support/private/brief/save/node.def create mode 100644 templates/show/tech-support/private/brief/save/node.tag/node.def create mode 100644 templates/show/tech-support/private/node.def create mode 100644 templates/show/tech-support/private/save-uncompressed/node.def create mode 100644 templates/show/tech-support/private/save-uncompressed/node.tag/node.def create mode 100644 templates/show/tech-support/private/save/node.def create mode 100644 templates/show/tech-support/private/save/node.tag/node.def (limited to 'templates') diff --git a/debian/changelog b/debian/changelog index 8744266..8faac25 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +vyatta-op (0.14.0+vyos2+current3) unstable; urgency=medium + + * Changed 'show tech-support' implementation to a redacted output, private + information is removed. + * Added 'show tech-support private' which contains non redacted output + + -- Christian Poessinger Sun Oct 29 15:36:45 2017 +0100 + vyatta-op (0.14.0+vyos2+current2) unstable; urgency=medium * New implementation of "run show version" diff --git a/templates/show/tech-support/brief/node.def b/templates/show/tech-support/brief/node.def index 23f588e..9a4a624 100644 --- a/templates/show/tech-support/brief/node.def +++ b/templates/show/tech-support/brief/node.def @@ -1,7 +1,7 @@ -help: Show brief tech-support report +help: Show brief tech-support report (private information removed) run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; then - source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief + source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief | strip-private else echo Must be an admin user to run this command fi diff --git a/templates/show/tech-support/brief/save-uncompressed/node.def b/templates/show/tech-support/brief/save-uncompressed/node.def index 7d36614..84b4ed0 100644 --- a/templates/show/tech-support/brief/save-uncompressed/node.def +++ b/templates/show/tech-support/brief/save-uncompressed/node.def @@ -1,7 +1,7 @@ -help: Save uncompressed brief tech-support report +help: Save uncompressed brief tech-support report (private information removed) run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; then - source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief save-uncompressed + source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief save-uncompressed | strip-private else echo Must be an admin user to run this command fi diff --git a/templates/show/tech-support/brief/save-uncompressed/node.tag/node.def b/templates/show/tech-support/brief/save-uncompressed/node.tag/node.def index f1a94c3..dad3949 100644 --- a/templates/show/tech-support/brief/save-uncompressed/node.tag/node.def +++ b/templates/show/tech-support/brief/save-uncompressed/node.tag/node.def @@ -1,8 +1,8 @@ -help: Save uncompressed brief tech-support report to specified path/file +help: Save uncompressed brief tech-support report to specified path/file (private information removed) allowed: echo -n ' :@/> :@/>' run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; then - source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief save-uncompressed $5 + source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief save-uncompressed $5 | strip-private else echo Must be an admin user to run this command fi diff --git a/templates/show/tech-support/brief/save/node.def b/templates/show/tech-support/brief/save/node.def index 966a984..2f8a561 100644 --- a/templates/show/tech-support/brief/save/node.def +++ b/templates/show/tech-support/brief/save/node.def @@ -1,7 +1,7 @@ -help: Save brief tech-support report +help: Save brief tech-support report (private information removed) run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; then - source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief save + source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief save | strip-private else echo Must be an admin user to run this command fi diff --git a/templates/show/tech-support/brief/save/node.tag/node.def b/templates/show/tech-support/brief/save/node.tag/node.def index bf6d45f..f0cfe4a 100644 --- a/templates/show/tech-support/brief/save/node.tag/node.def +++ b/templates/show/tech-support/brief/save/node.tag/node.def @@ -1,8 +1,8 @@ -help: Save compressed brief tech-support report to specified path/file +help: Save compressed brief tech-support report to specified path/file (private information removed) allowed: echo -n ' :@/> :@/>' run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; then - source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief save $5 + source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief save $5 | strip-private else echo Must be an admin user to run this command fi diff --git a/templates/show/tech-support/node.def b/templates/show/tech-support/node.def index 34d8e22..c211e90 100644 --- a/templates/show/tech-support/node.def +++ b/templates/show/tech-support/node.def @@ -1,7 +1,7 @@ -help: Show consolidated tech-support report +help: Show consolidated tech-support report (private information removed) run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; then - source ${vyatta_datadir}/vyatta-op/functions/tech-support + source ${vyatta_datadir}/vyatta-op/functions/tech-support | strip-private else echo Must be an admin user to run this command fi diff --git a/templates/show/tech-support/private/brief/node.def b/templates/show/tech-support/private/brief/node.def new file mode 100644 index 0000000..cc06ccf --- /dev/null +++ b/templates/show/tech-support/private/brief/node.def @@ -0,0 +1,7 @@ +help: Show brief tech-support report (contains private information) +run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; + then + source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief + else + echo Must be an admin user to run this command + fi diff --git a/templates/show/tech-support/private/brief/save-uncompressed/node.def b/templates/show/tech-support/private/brief/save-uncompressed/node.def new file mode 100644 index 0000000..9292428 --- /dev/null +++ b/templates/show/tech-support/private/brief/save-uncompressed/node.def @@ -0,0 +1,7 @@ +help: Save uncompressed brief tech-support report (contains private information) +run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; + then + source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief save-uncompressed + else + echo Must be an admin user to run this command + fi diff --git a/templates/show/tech-support/private/brief/save-uncompressed/node.tag/node.def b/templates/show/tech-support/private/brief/save-uncompressed/node.tag/node.def new file mode 100644 index 0000000..0976413 --- /dev/null +++ b/templates/show/tech-support/private/brief/save-uncompressed/node.tag/node.def @@ -0,0 +1,8 @@ +help: Save uncompressed brief tech-support report to specified path/file (contains private information) +allowed: echo -n ' :@/> :@/>' +run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; + then + source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief save-uncompressed $5 + else + echo Must be an admin user to run this command + fi diff --git a/templates/show/tech-support/private/brief/save/node.def b/templates/show/tech-support/private/brief/save/node.def new file mode 100644 index 0000000..d069ec2 --- /dev/null +++ b/templates/show/tech-support/private/brief/save/node.def @@ -0,0 +1,7 @@ +help: Save brief tech-support report (contains private information) +run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; + then + source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief save + else + echo Must be an admin user to run this command + fi diff --git a/templates/show/tech-support/private/brief/save/node.tag/node.def b/templates/show/tech-support/private/brief/save/node.tag/node.def new file mode 100644 index 0000000..f56d02e --- /dev/null +++ b/templates/show/tech-support/private/brief/save/node.tag/node.def @@ -0,0 +1,8 @@ +help: Save compressed brief tech-support report to specified path/file (contains private information) +allowed: echo -n ' :@/> :@/>' +run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; + then + source ${vyatta_datadir}/vyatta-op/functions/tech-support-brief save $5 + else + echo Must be an admin user to run this command + fi diff --git a/templates/show/tech-support/private/node.def b/templates/show/tech-support/private/node.def new file mode 100644 index 0000000..32b4c15 --- /dev/null +++ b/templates/show/tech-support/private/node.def @@ -0,0 +1,7 @@ +help: Show consolidated tech-support report (contains private information) +run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; + then + source ${vyatta_datadir}/vyatta-op/functions/tech-support + else + echo Must be an admin user to run this command + fi diff --git a/templates/show/tech-support/private/save-uncompressed/node.def b/templates/show/tech-support/private/save-uncompressed/node.def new file mode 100644 index 0000000..424e78a --- /dev/null +++ b/templates/show/tech-support/private/save-uncompressed/node.def @@ -0,0 +1,7 @@ +help: Save consolidated tech-support report uncompressed (contains private information) +run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; + then + source ${vyatta_datadir}/vyatta-op/functions/tech-support save-uncompressed + else + echo Must be an admin user to run this command. + fi diff --git a/templates/show/tech-support/private/save-uncompressed/node.tag/node.def b/templates/show/tech-support/private/save-uncompressed/node.tag/node.def new file mode 100644 index 0000000..f2f7572 --- /dev/null +++ b/templates/show/tech-support/private/save-uncompressed/node.tag/node.def @@ -0,0 +1,8 @@ +help: Save uncompressed tech-support report to specified path/file (contains private information) +allowed: echo -n ' :@/> :@/>' +run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; + then + source ${vyatta_datadir}/vyatta-op/functions/tech-support save-uncompressed $4 + else + echo Must be an admin user to run this command + fi diff --git a/templates/show/tech-support/private/save/node.def b/templates/show/tech-support/private/save/node.def new file mode 100644 index 0000000..87819f6 --- /dev/null +++ b/templates/show/tech-support/private/save/node.def @@ -0,0 +1,7 @@ +help: Save consolidated tech-support report (contains private information) +run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; + then + source ${vyatta_datadir}/vyatta-op/functions/tech-support save + else + echo Must be an admin user to run this command + fi diff --git a/templates/show/tech-support/private/save/node.tag/node.def b/templates/show/tech-support/private/save/node.tag/node.def new file mode 100644 index 0000000..5a7b500 --- /dev/null +++ b/templates/show/tech-support/private/save/node.tag/node.def @@ -0,0 +1,8 @@ +help: Save compressed tech-support report to the specified path/file (contains private information) +allowed: echo -n ' :@/> :@/>' +run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; + then + source ${vyatta_datadir}/vyatta-op/functions/tech-support save $4 + else + echo Must be an admin user to run this command + fi diff --git a/templates/show/tech-support/save-uncompressed/node.def b/templates/show/tech-support/save-uncompressed/node.def index 4036eaf..4d828f1 100644 --- a/templates/show/tech-support/save-uncompressed/node.def +++ b/templates/show/tech-support/save-uncompressed/node.def @@ -1,7 +1,7 @@ -help: Save consolidated tech-support report uncompressed +help: Save consolidated tech-support report uncompressed (private information removed) run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; then - source ${vyatta_datadir}/vyatta-op/functions/tech-support save-uncompressed + source ${vyatta_datadir}/vyatta-op/functions/tech-support save-uncompressed | strip-private else echo Must be an admin user to run this command. fi diff --git a/templates/show/tech-support/save-uncompressed/node.tag/node.def b/templates/show/tech-support/save-uncompressed/node.tag/node.def index 8a637c6..4006afe 100644 --- a/templates/show/tech-support/save-uncompressed/node.tag/node.def +++ b/templates/show/tech-support/save-uncompressed/node.tag/node.def @@ -1,8 +1,8 @@ -help: Save uncompressed tech-support report to specified path/file +help: Save uncompressed tech-support report to specified path/file (private information removed) allowed: echo -n ' :@/> :@/>' run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; then - source ${vyatta_datadir}/vyatta-op/functions/tech-support save-uncompressed $4 + source ${vyatta_datadir}/vyatta-op/functions/tech-support save-uncompressed $4 | strip-private else echo Must be an admin user to run this command fi diff --git a/templates/show/tech-support/save/node.def b/templates/show/tech-support/save/node.def index 54635d6..ee1a2f1 100644 --- a/templates/show/tech-support/save/node.def +++ b/templates/show/tech-support/save/node.def @@ -1,7 +1,7 @@ -help: Save consolidated tech-support report +help: Save consolidated tech-support report (private information removed) run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; then - source ${vyatta_datadir}/vyatta-op/functions/tech-support save + source ${vyatta_datadir}/vyatta-op/functions/tech-support save | strip-private else echo Must be an admin user to run this command fi diff --git a/templates/show/tech-support/save/node.tag/node.def b/templates/show/tech-support/save/node.tag/node.def index 26e91a0..675418b 100644 --- a/templates/show/tech-support/save/node.tag/node.def +++ b/templates/show/tech-support/save/node.tag/node.def @@ -1,8 +1,8 @@ -help: Save compressed tech-support report to the specified path/file -allowed: echo -n ' :@/> :@/>' +help: Save compressed tech-support report to the specified path/file (private information removed) +allowed: echo -n ' :@/> :@/>' run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; then - source ${vyatta_datadir}/vyatta-op/functions/tech-support save $4 + source ${vyatta_datadir}/vyatta-op/functions/tech-support save $4 | strip-private else echo Must be an admin user to run this command fi -- cgit v1.2.3 From f4d9d3d9511300b1c309826aeee9b35ec282b327 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 15 Apr 2018 18:15:38 +0200 Subject: T588: Remove DNS forwarder restart command in favor if XML interface definition --- debian/changelog | 12 ++++++++++++ templates/restart/dns/forwarding/node.def | 9 --------- templates/restart/dns/node.def | 1 - 3 files changed, 12 insertions(+), 10 deletions(-) delete mode 100644 templates/restart/dns/forwarding/node.def delete mode 100644 templates/restart/dns/node.def (limited to 'templates') diff --git a/debian/changelog b/debian/changelog index 14f8078..2e0fd2e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +vyatta-op (0.14.0+vyos2+current6) unstable; urgency=medium + + * T588: Remove DNS forwarder restart command in favor if XML interface definition + + -- Christian Poessinger Wed, 11 Apr 2018 20:33:53 +0200 + +vyatta-op (0.14.0+vyos2+current5) unstable; urgency=medium + + * T157: Remove "install system" command + + -- Christian Poessinger Sat, 10 Mar 2018 18:29:30 +0100 + vyatta-op (0.14.0+vyos2+current4) unstable; urgency=medium * T523: Use new location for dnsmasq config files diff --git a/templates/restart/dns/forwarding/node.def b/templates/restart/dns/forwarding/node.def deleted file mode 100644 index b66ab3c..0000000 --- a/templates/restart/dns/forwarding/node.def +++ /dev/null @@ -1,9 +0,0 @@ -help: Restart DNS forwarding - -run: - echo "Restarting DNS forwarding..." - sudo /opt/vyatta/sbin/vyatta-dns-forwarding.pl --restart-dnsforwarding; - if [[ $? -eq 0 ]]; then - echo "Success!" - fi - diff --git a/templates/restart/dns/node.def b/templates/restart/dns/node.def deleted file mode 100644 index 3118853..0000000 --- a/templates/restart/dns/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Restart DNS services -- cgit v1.2.3 From 9e37894920aa9ee8f31220eea81ddbc534e7dec7 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Mon, 14 May 2018 05:19:20 +0200 Subject: Remove the show version command from this package: moving to vyos-1x. --- Makefile.am | 2 - scripts/limericks.py | 51 ---------------- scripts/vyos-show-version | 111 ---------------------------------- templates/show/version/all/node.def | 5 -- templates/show/version/funny/node.def | 5 -- templates/show/version/node.def | 2 - 6 files changed, 176 deletions(-) delete mode 100644 scripts/limericks.py delete mode 100644 scripts/vyos-show-version delete mode 100644 templates/show/version/all/node.def delete mode 100644 templates/show/version/funny/node.def delete mode 100644 templates/show/version/node.def (limited to 'templates') diff --git a/Makefile.am b/Makefile.am index c79a629..ea115cf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,7 +19,6 @@ interp_DATA += functions/interpreter/vyatta-image-complete bin_SCRIPTS = scripts/vyatta-show-interfaces bin_SCRIPTS += scripts/vyatta-show-interfaces.pl -bin_SCRIPTS += scripts/vyos-show-version bin_SCRIPTS += scripts/vyatta-show-dhclient.pl bin_SCRIPTS += scripts/vyatta-show-dmi bin_SCRIPTS += scripts/vyatta-tshark-interface-port.pl @@ -52,7 +51,6 @@ bin_SCRIPTS += scripts/vyatta-monitor-check-rule-log bin_SCRIPTS += scripts/vyos-show-ram.sh bin_SCRIPTS += scripts/vyos-strip-config.pl bin_SCRIPTS += scripts/maya-date.py -bin_SCRIPTS += scripts/limericks.py bin_SCRIPTS += scripts/ssh-server-key sbin_SCRIPTS = scripts/dhcpv6-client-show-leases.pl diff --git a/scripts/limericks.py b/scripts/limericks.py deleted file mode 100644 index acb1a74..0000000 --- a/scripts/limericks.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python - -import random - -limericks = [ - -""" -A programmer who's name was Searle -Once wrote a long program in Perl. -Despite very few quirks -No one got how it works, -Not even the interpreter. -""", - -""" -There was a young lady of Maine -Who set up IPsec VPN. -Problems didn't arise -'til other vendors' device -had to add she to that VPN. -""", - -""" -One day a programmer from York -started his own Vyatta fork. -Though he was a huge geek, -it still took him a week -to get the damn build scripts to work. -""", - -""" -A network admin from Hong Kong -knew MPPE cipher's not strong. -But he was behind NAT, -so he put up we that, -sad network admin from Hong Kong. -""", - -""" -A network admin named Drake -greeted friends with a three-way handshake -and refused to proceed -if they didn't complete it, -that standards-compliant guy Drake. -""" - -] - -l = limericks[random.randint(0, len(limericks) - 1)] - -print(l) diff --git a/scripts/vyos-show-version b/scripts/vyos-show-version deleted file mode 100644 index be86b73..0000000 --- a/scripts/vyos-show-version +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 VyOS maintainers and contributors -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 or later 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. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# File: vyos-show-version -# Purpose: -# Displays image version and system information. -# Used by the "run show version" command. - - -import sys -import subprocess -import json - -import pystache - - -def read_file(name): - try: - with open (name, "r") as f: - data = f.read() - return data.strip() - except: - # This works since we only read /sys/class/* stuff - # with this function - return "Unknown" - -version_file = '/opt/vyatta/etc/version.json' -version_data = None - -version_output_tmpl = """ -Version: VyOS {{version}} -Built by: {{built_by}} -Built on: {{built_on}} -Build ID: {{build_id}} - -Architecture: {{system_arch}} -Boot via: {{boot_via}} -System type: {{system_type}} - -Hardware vendor: {{hardware_vendor}} -Hardware model: {{hardware_model}} -Hardware S/N: {{hardware_serial}} -Hardware UUID: {{hardware_uuid}} - -Copyright: VyOS maintainers and contributors - -""" - -# Get and display image version data from the built-in version file -# This gives us image version, built on, build by, and build UUID -try: - with open(version_file, 'r') as f: - version_data = json.load(f) -except: - print("Unable to get VyOS version data") - sys.exit(1) - - -# Get system architecture (well, kernel architecture rather) -version_data['system_arch'] = subprocess.check_output('uname -m', shell=True).strip() - - -# Get hypervisor name, if any -system_type = "bare metal" -try: - hypervisor = subprocess.check_output('hvinfo 2>/dev/null', shell=True).decode().strip() - system_type = "{0} guest".format(hypervisor) -except subprocess.CalledProcessError: - # hvinfo returns 1 if it cannot detect any hypervisor - pass -version_data['system_type'] = system_type - - -# Get boot type, it can be livecd, installed image, or, possible, a system installed -# via legacy "install system" mechanism -# In installed images, the squashfs image file is named after its image version, -# while on livecd it's just "filesystem.squashfs", that's how we tell a livecd boot -# from an installed image -boot_via = "installed image" -if subprocess.call(""" grep -e '^overlay.*/filesystem.squashfs' /proc/mounts >/dev/null""", shell=True) == 0: - boot_via = "livecd" -elif subprocess.call(""" grep '^overlay /' /proc/mounts >/dev/null """, shell=True) != 0: - boot_via = "legacy non-image installation" -version_data['boot_via'] = boot_via - - -# Get hardware details from DMI -version_data['hardware_vendor'] = read_file('/sys/class/dmi/id/sys_vendor') -version_data['hardware_model'] = read_file('/sys/class/dmi/id/product_name') - -# These two assume script is run as root, normal users can't access those files -version_data['hardware_serial'] = read_file('/sys/class/dmi/id/subsystem/id/product_serial') -version_data['hardware_uuid'] = read_file('/sys/class/dmi/id/subsystem/id/product_uuid') - - -output = pystache.render(version_output_tmpl, version_data).strip() -print(output) - diff --git a/templates/show/version/all/node.def b/templates/show/version/all/node.def deleted file mode 100644 index e98a16d..0000000 --- a/templates/show/version/all/node.def +++ /dev/null @@ -1,5 +0,0 @@ -help: Show VyOS version information plus all packages changes -run: sudo ${vyatta_bindir}/vyos-show-version - echo "" - echo "Package versions:" - dpkg -l diff --git a/templates/show/version/funny/node.def b/templates/show/version/funny/node.def deleted file mode 100644 index cb1b6b0..0000000 --- a/templates/show/version/funny/node.def +++ /dev/null @@ -1,5 +0,0 @@ -help: Show VyOS version information plus a funny poem -run: - sudo ${vyatta_bindir}/vyos-show-version - ${vyatta_bindir}/limericks.py - diff --git a/templates/show/version/node.def b/templates/show/version/node.def deleted file mode 100644 index a3fd8af..0000000 --- a/templates/show/version/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show VyOS version information -run: sudo ${vyatta_bindir}/vyos-show-version -- cgit v1.2.3 From 7f035c001e94b34e22f2d6b4d0ad8a20d06b2f76 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Mon, 14 May 2018 05:53:53 +0200 Subject: T564: remove DNS forwarding commands that are moving to vyos-1x. --- templates/reset/dns/forwarding/all/node.def | 8 -------- templates/reset/dns/forwarding/cache/node.def | 8 -------- templates/reset/dns/forwarding/node.def | 1 - templates/reset/dns/node.def | 1 - templates/show/dns/forwarding/nameservers/node.def | 2 -- templates/show/dns/forwarding/node.def | 1 - templates/show/dns/forwarding/statistics/node.def | 8 -------- 7 files changed, 29 deletions(-) delete mode 100644 templates/reset/dns/forwarding/all/node.def delete mode 100644 templates/reset/dns/forwarding/cache/node.def delete mode 100644 templates/reset/dns/forwarding/node.def delete mode 100644 templates/reset/dns/node.def delete mode 100644 templates/show/dns/forwarding/nameservers/node.def delete mode 100644 templates/show/dns/forwarding/node.def delete mode 100644 templates/show/dns/forwarding/statistics/node.def (limited to 'templates') diff --git a/templates/reset/dns/forwarding/all/node.def b/templates/reset/dns/forwarding/all/node.def deleted file mode 100644 index b90aafb..0000000 --- a/templates/reset/dns/forwarding/all/node.def +++ /dev/null @@ -1,8 +0,0 @@ -help: Reset DNS forwarding cache and counters -run: - if ps ax | grep dnsmasq | grep -v grep > /dev/null - then - sudo /opt/vyatta/bin/sudo-users/vyatta-op-dns-forwarding.pl --clear-all - else - echo "DNS forwarding not configured" - fi diff --git a/templates/reset/dns/forwarding/cache/node.def b/templates/reset/dns/forwarding/cache/node.def deleted file mode 100644 index 9e1a610..0000000 --- a/templates/reset/dns/forwarding/cache/node.def +++ /dev/null @@ -1,8 +0,0 @@ -help: Reset DNS forwarding cache -run: - if ps ax | grep dnsmasq | grep -v grep > /dev/null - then - sudo /opt/vyatta/bin/sudo-users/vyatta-op-dns-forwarding.pl --clear-cache - else - echo "DNS forwarding not configured" - fi diff --git a/templates/reset/dns/forwarding/node.def b/templates/reset/dns/forwarding/node.def deleted file mode 100644 index a1bcb10..0000000 --- a/templates/reset/dns/forwarding/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Reset DNS forwarding variables diff --git a/templates/reset/dns/node.def b/templates/reset/dns/node.def deleted file mode 100644 index 5f8ef26..0000000 --- a/templates/reset/dns/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Reset Domain Name Server (DNS) variables diff --git a/templates/show/dns/forwarding/nameservers/node.def b/templates/show/dns/forwarding/nameservers/node.def deleted file mode 100644 index 0609f6a..0000000 --- a/templates/show/dns/forwarding/nameservers/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show DNS forwarding nameservers information -run: sudo /opt/vyatta/bin/sudo-users/vyatta-op-dns-forwarding.pl --show-nameservers diff --git a/templates/show/dns/forwarding/node.def b/templates/show/dns/forwarding/node.def deleted file mode 100644 index eb9ce4b..0000000 --- a/templates/show/dns/forwarding/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Show DNS forwarding information diff --git a/templates/show/dns/forwarding/statistics/node.def b/templates/show/dns/forwarding/statistics/node.def deleted file mode 100644 index a73b49d..0000000 --- a/templates/show/dns/forwarding/statistics/node.def +++ /dev/null @@ -1,8 +0,0 @@ -help: Show DNS forwarding statistics -run: - if ps ax | grep dnsmasq | grep -v grep > /dev/null - then - sudo /opt/vyatta/bin/sudo-users/vyatta-op-dns-forwarding.pl --show-statistics - else - echo "DNS forwarding not configured" - fi -- cgit v1.2.3 From e08a8546936fe6801d718c85e3723d2ea6d33cc9 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 15 May 2018 03:14:12 +0200 Subject: T638: remove the old handwritten templates for bmon commands. Turns out they were there, just overwriten by the gen-monitor-* so no one noticed. --- templates/monitor/interfaces/bonding/node.def | 2 -- templates/monitor/interfaces/bonding/node.tag/vif/node.def | 2 -- templates/monitor/interfaces/bridge/node.def | 2 -- templates/monitor/interfaces/ethernet/node.def | 2 -- templates/monitor/interfaces/ethernet/node.tag/vif/node.def | 2 -- templates/monitor/interfaces/loopback/node.def | 2 -- templates/monitor/interfaces/node.def | 2 -- templates/monitor/interfaces/pseudo-ethernet/node.def | 2 -- templates/monitor/interfaces/tunnel/node.def | 2 -- templates/monitor/interfaces/vrrp/node.def | 2 -- templates/monitor/interfaces/vti/node.def | 2 -- 11 files changed, 22 deletions(-) delete mode 100644 templates/monitor/interfaces/bonding/node.def delete mode 100644 templates/monitor/interfaces/bonding/node.tag/vif/node.def delete mode 100644 templates/monitor/interfaces/bridge/node.def delete mode 100644 templates/monitor/interfaces/ethernet/node.def delete mode 100644 templates/monitor/interfaces/ethernet/node.tag/vif/node.def delete mode 100644 templates/monitor/interfaces/loopback/node.def delete mode 100644 templates/monitor/interfaces/node.def delete mode 100644 templates/monitor/interfaces/pseudo-ethernet/node.def delete mode 100644 templates/monitor/interfaces/tunnel/node.def delete mode 100644 templates/monitor/interfaces/vrrp/node.def delete mode 100644 templates/monitor/interfaces/vti/node.def (limited to 'templates') diff --git a/templates/monitor/interfaces/bonding/node.def b/templates/monitor/interfaces/bonding/node.def deleted file mode 100644 index b7e8bce..0000000 --- a/templates/monitor/interfaces/bonding/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Monitor a bonding interface -run: bmon -p bond*,!bond*v*,!bond*.* diff --git a/templates/monitor/interfaces/bonding/node.tag/vif/node.def b/templates/monitor/interfaces/bonding/node.tag/vif/node.def deleted file mode 100644 index 4241bc8..0000000 --- a/templates/monitor/interfaces/bonding/node.tag/vif/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Monitor a vif -run: bmon -p $4.* diff --git a/templates/monitor/interfaces/bridge/node.def b/templates/monitor/interfaces/bridge/node.def deleted file mode 100644 index 5b2a395..0000000 --- a/templates/monitor/interfaces/bridge/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Monitor a bridge interface -run: bmon -p br* diff --git a/templates/monitor/interfaces/ethernet/node.def b/templates/monitor/interfaces/ethernet/node.def deleted file mode 100644 index 60c4970..0000000 --- a/templates/monitor/interfaces/ethernet/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Monitor a ethernet interface -run: bmon -p eth*,!eth*v*,!eth*.* diff --git a/templates/monitor/interfaces/ethernet/node.tag/vif/node.def b/templates/monitor/interfaces/ethernet/node.tag/vif/node.def deleted file mode 100644 index 4241bc8..0000000 --- a/templates/monitor/interfaces/ethernet/node.tag/vif/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Monitor a vif -run: bmon -p $4.* diff --git a/templates/monitor/interfaces/loopback/node.def b/templates/monitor/interfaces/loopback/node.def deleted file mode 100644 index 9d3a8a5..0000000 --- a/templates/monitor/interfaces/loopback/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Monitor a loopback interface -run: bmon -p lo diff --git a/templates/monitor/interfaces/node.def b/templates/monitor/interfaces/node.def deleted file mode 100644 index ef09ad0..0000000 --- a/templates/monitor/interfaces/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Monitor interfaces -run: bmon -p !gre0,!sit0,!tunl0,!ip6tnl0; diff --git a/templates/monitor/interfaces/pseudo-ethernet/node.def b/templates/monitor/interfaces/pseudo-ethernet/node.def deleted file mode 100644 index 8cd18c9..0000000 --- a/templates/monitor/interfaces/pseudo-ethernet/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Monitor a pseudo-ethernet interface -run: bmon -p peth* diff --git a/templates/monitor/interfaces/tunnel/node.def b/templates/monitor/interfaces/tunnel/node.def deleted file mode 100644 index a41faa2..0000000 --- a/templates/monitor/interfaces/tunnel/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Monitor a tunnel interface -run: bmon -p tun* diff --git a/templates/monitor/interfaces/vrrp/node.def b/templates/monitor/interfaces/vrrp/node.def deleted file mode 100644 index 64c6684..0000000 --- a/templates/monitor/interfaces/vrrp/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Monitor a vrrp interface -run: bmon -p eth*v*,bond*v* diff --git a/templates/monitor/interfaces/vti/node.def b/templates/monitor/interfaces/vti/node.def deleted file mode 100644 index b7429bd..0000000 --- a/templates/monitor/interfaces/vti/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Monitor a vti interface -run: bmon -p vti* -- cgit v1.2.3 From b9c3925b1f68534b51f4d2f2b239ae7cdd2ef030 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 5 Jun 2018 20:48:32 +0200 Subject: T684: make the 'run show configuration commands' and the |commands pipe use the new implementation. --- etc/bash_completion.d/vyatta-op | 2 +- templates/show/configuration/commands/node.def | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op index 47092a2..d917806 100644 --- a/etc/bash_completion.d/vyatta-op +++ b/etc/bash_completion.d/vyatta-op @@ -500,7 +500,7 @@ strip-private () commands () { if [ "$_OFR_CONFIGURE" != "" ]; then - ${vyatta_sbindir}/vyatta-config-gen-sets.pl - + ${vyos_libexec_dir}/commands-pipe.py else echo "commands pipe is not supported in operational mode" fi diff --git a/templates/show/configuration/commands/node.def b/templates/show/configuration/commands/node.def index a2d55cf..f2e047e 100644 --- a/templates/show/configuration/commands/node.def +++ b/templates/show/configuration/commands/node.def @@ -1,7 +1,7 @@ help: Show running configuration as set commands run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; then - ${vyatta_sbindir}/vyatta-config-gen-sets.pl + cli-shell-api showCfg --show-active-only | vyos-config-to-commands else echo Must be an admin user to run this command. fi -- cgit v1.2.3 From e711d30377c4681e75d91f7e7202497b9ba18132 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 13 Jun 2018 13:01:53 +0200 Subject: T689: remove files no longer needed after merging PR#14 into vyos-1x. --- Makefile.am | 2 - scripts/maya-date.py | 214 --------------------- templates/poweroff/at/node.def | 1 - templates/poweroff/at/node.tag/node.def | 3 - templates/poweroff/cancel/node.def | 2 - templates/poweroff/node.def | 2 - templates/poweroff/now/node.def | 2 - templates/reboot/at/node.def | 1 - templates/reboot/at/node.tag/node.def | 3 - templates/reboot/cancel/node.def | 2 - templates/reboot/node.def | 2 - templates/reboot/now/node.def | 2 - templates/show/arp/node.def | 2 - templates/show/arp/node.tag/node.def | 7 - templates/show/bridge/node.def | 2 - templates/show/bridge/node.tag/macs/node.def | 2 - templates/show/bridge/node.tag/node.def | 5 - .../show/bridge/node.tag/spanning-tree/node.def | 2 - templates/show/configuration/all/node.def | 8 - templates/show/configuration/commands/node.def | 7 - templates/show/configuration/files/node.def | 11 -- templates/show/configuration/node.def | 7 - templates/show/date/node.def | 2 - templates/show/date/utc/maya/node.def | 2 - templates/show/date/utc/node.def | 2 - templates/show/disk/node.def | 1 - templates/show/disk/node.tag/format/node.def | 7 - templates/show/disk/node.tag/node.def | 4 - templates/show/hardware/cpu/detail/node.def | 4 - templates/show/hardware/cpu/node.def | 2 - templates/show/hardware/cpu/summary/node.def | 2 - templates/show/hardware/dmi/node.def | 2 - templates/show/hardware/mem/node.def | 4 - templates/show/hardware/node.def | 1 - templates/show/hardware/pci/detailed/node.def | 2 - templates/show/hardware/pci/node.def | 2 - templates/show/hardware/scsi/detail/node.def | 2 - templates/show/hardware/scsi/node.def | 2 - templates/show/hardware/usb/detail/node.def | 3 - templates/show/hardware/usb/node.def | 2 - templates/show/raid/node.def | 2 - templates/show/raid/node.tag/node.def | 23 --- templates/show/users/node.def | 2 - templates/show/users/recent/node.def | 2 - templates/show/users/recent/node.tag/node.def | 3 - 45 files changed, 367 deletions(-) delete mode 100644 scripts/maya-date.py delete mode 100644 templates/poweroff/at/node.def delete mode 100644 templates/poweroff/at/node.tag/node.def delete mode 100644 templates/poweroff/cancel/node.def delete mode 100644 templates/poweroff/node.def delete mode 100644 templates/poweroff/now/node.def delete mode 100644 templates/reboot/at/node.def delete mode 100644 templates/reboot/at/node.tag/node.def delete mode 100644 templates/reboot/cancel/node.def delete mode 100644 templates/reboot/node.def delete mode 100644 templates/reboot/now/node.def delete mode 100644 templates/show/arp/node.def delete mode 100644 templates/show/arp/node.tag/node.def delete mode 100644 templates/show/bridge/node.def delete mode 100644 templates/show/bridge/node.tag/macs/node.def delete mode 100644 templates/show/bridge/node.tag/node.def delete mode 100644 templates/show/bridge/node.tag/spanning-tree/node.def delete mode 100644 templates/show/configuration/all/node.def delete mode 100644 templates/show/configuration/commands/node.def delete mode 100644 templates/show/configuration/files/node.def delete mode 100644 templates/show/configuration/node.def delete mode 100644 templates/show/date/node.def delete mode 100644 templates/show/date/utc/maya/node.def delete mode 100644 templates/show/date/utc/node.def delete mode 100644 templates/show/disk/node.def delete mode 100644 templates/show/disk/node.tag/format/node.def delete mode 100644 templates/show/disk/node.tag/node.def delete mode 100644 templates/show/hardware/cpu/detail/node.def delete mode 100644 templates/show/hardware/cpu/node.def delete mode 100644 templates/show/hardware/cpu/summary/node.def delete mode 100644 templates/show/hardware/dmi/node.def delete mode 100644 templates/show/hardware/mem/node.def delete mode 100644 templates/show/hardware/node.def delete mode 100644 templates/show/hardware/pci/detailed/node.def delete mode 100644 templates/show/hardware/pci/node.def delete mode 100644 templates/show/hardware/scsi/detail/node.def delete mode 100644 templates/show/hardware/scsi/node.def delete mode 100644 templates/show/hardware/usb/detail/node.def delete mode 100644 templates/show/hardware/usb/node.def delete mode 100644 templates/show/raid/node.def delete mode 100644 templates/show/raid/node.tag/node.def delete mode 100644 templates/show/users/node.def delete mode 100644 templates/show/users/recent/node.def delete mode 100644 templates/show/users/recent/node.tag/node.def (limited to 'templates') diff --git a/Makefile.am b/Makefile.am index 2ecd735..ad9c01a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,7 +48,6 @@ bin_SCRIPTS += scripts/vyatta-monitor-background-stop bin_SCRIPTS += scripts/vyatta-monitor-check-rule-log bin_SCRIPTS += scripts/vyos-show-ram.sh bin_SCRIPTS += scripts/vyos-strip-config.pl -bin_SCRIPTS += scripts/maya-date.py bin_SCRIPTS += scripts/ssh-server-key sbin_SCRIPTS = scripts/dhcpv6-client-show-leases.pl @@ -60,7 +59,6 @@ bin_sudo_users_SCRIPTS = scripts/vyatta-identify-interface.pl bin_sudo_users_SCRIPTS += scripts/vyatta-delete-log-file.sh bin_sudo_users_SCRIPTS += scripts/vyatta-reboot.pl bin_sudo_users_SCRIPTS += scripts/vyatta-poweroff.pl -bin_sudo_users_SCRIPTS += scripts/vyatta-op-dns-forwarding.pl bin_sudo_users_SCRIPTS += scripts/vyatta-op-dynamic-dns.pl bin_sudo_users_SCRIPTS += scripts/vyatta-clear-conntrack diff --git a/scripts/maya-date.py b/scripts/maya-date.py deleted file mode 100644 index 6f0918c..0000000 --- a/scripts/maya-date.py +++ /dev/null @@ -1,214 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (c) 2013 Daniil Baturin -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -import sys - -class MayaDate(object): - """ Converts number of days since UNIX epoch - to the Maya calendar date. - - Ancient Maya people used three independent calendars for - different purposes. - - Long count calendar is for recording historical events. - It and represents the number of days passed - since some date in the past the Maya believed is the day - our world was created. - - Tzolkin calendar is for religious purposes, it has - two independent cycles of 13 and 20 days, where 13 day - cycle days are numbered, and 20 day cycle days are named. - - Haab calendar is for agriculture and daily life, it's a - 365 day calendar with 18 months 20 days each, and 5 - nameless days. - - The smallest unit of long count calendar is one day (kin) - - """ - - """ The long count calendar uses five different base 18 or base 20 - cycles. Long-count date is writtin in dot separated format - from longest to shortest cycle, - .... - for example, "13.0.0.9.2". - - Classic version actually used by the ancient Maya wraps around - every 13th baktun, but modern researchers often use longer cycles - such as piktun = 20 baktun. - - """ - kin = 1 - winal = 20 # 20 kin - tun = 360 # 18 winal - katun = 7200 # 20 tun - baktun = 144000 # 20 katun - - """ Tzolk'in date is composed of two independent cycles. - Dates repeat every 260 days, 13 Ajaw is considered the end - of tzolk'in. - - Every day of the 20 day cycle has unique name, we number - them from zero so it's easier to map remainder to day: - """ - tzolkin_days = { 0: "Imix'", - 1: "Ik'", - 2: "Ak'b'al", - 3: "K'an", - 4: "Chikchan", - 5: "Kimi", - 6: "Manik'", - 7: "Lamat", - 8: "Muluk", - 9: "Ok", - 10: "Chuwen", - 11: "Eb'", - 12: "B'en", - 13: "Ix", - 14: "Men", - 15: "Kib'", - 16: "Kab'an", - 17: "Etz'nab'", - 18: "Kawak", - 19: "Ajaw" } - - """ As said above, haab (year) has 19 months. Only 18 are - true months of 20 days each, the remaining 5 days called "wayeb" - do not really belong to any month, but we think of them as a pseudo-month - for convenience. - - Also, note that days of the month are actually numbered from 0, not from 1, - it's not for technical reasons. - """ - haab_months = { 0: "Pop", - 1: "Wo'", - 2: "Sip", - 3: "Sotz'", - 4: "Sek", - 5: "Xul", - 6: "Yaxk'in'", - 7: "Mol", - 8: "Ch'en", - 9: "Yax", - 10: "Sak'", - 11: "Keh", - 12: "Mak", - 13: "K'ank'in", - 14: "Muwan'", - 15: "Pax", - 16: "K'ayab", - 17: "Kumk'u", - 18: "Wayeb'" } - - """ Now we need to map the beginning of UNIX epoch - (Jan 1 1970 00:00 UTC) to the beginning of the long count - calendar (0.0.0.0.0, 4 Ajaw, 8 Kumk'u). - - The problem with mapping the long count calendar to - any other is that its start date is not known exactly. - - The most widely accepted hypothesis suggests it was - August 11, 3114 BC gregorian date. In this case UNIX epoch - starts on 12.17.16.7.5, 13 Chikchan, 3 K'ank'in - - It's known as Goodman-Martinez-Thompson (GMT) correlation - constant. - """ - start_days = 1856305 - - """ Seconds in day, for conversion from timestamp """ - seconds_in_day = 60 * 60 * 24 - - def __init__(self, timestamp): - if timestamp is None: - self.days = self.start_days - else: - self.days = self.start_days + (int(timestamp) // self.seconds_in_day) - - def long_count_date(self): - """ Returns long count date string """ - days = self.days - - cur_baktun = days // self.baktun - days = days % self.baktun - - cur_katun = days // self.katun - days = days % self.katun - - cur_tun = days // self.tun - days = days % self.tun - - cur_winal = days // self.winal - days = days % self.winal - - cur_kin = days - - longcount_string = "{0}.{1}.{2}.{3}.{4}".format( cur_baktun, - cur_katun, - cur_tun, - cur_winal, - cur_kin ) - return(longcount_string) - - def tzolkin_date(self): - """ Returns tzolkin date string """ - days = self.days - - """ The start date is not the beginning of both cycles, - it's 4 Ajaw. So we need to add 4 to the 13 days cycle day, - and substract 1 from the 20 day cycle to get correct result. - """ - tzolkin_13 = (days + 4) % 13 - tzolkin_20 = (days - 1) % 20 - - tzolkin_string = "{0} {1}".format(tzolkin_13, self.tzolkin_days[tzolkin_20]) - - return(tzolkin_string) - - def haab_date(self): - """ Returns haab date string. - - The time start on 8 Kumk'u rather than 0 Pop, which is - 17 days before the new haab, so we need to substract 17 - from the current date to get correct result. - """ - days = self.days - - haab_day = (days - 17) % 365 - haab_month = haab_day // 20 - haab_day_of_month = haab_day % 20 - - haab_string = "{0} {1}".format(haab_day_of_month, self.haab_months[haab_month]) - - return(haab_string) - - def date(self): - return("{0}, {1}, {2}".format( self.long_count_date(), self.tzolkin_date(), self.haab_date() )) - -try: - timestamp = sys.argv[1] -except: - print("Please specify timestamp in the argument") - sys.exit(1) - -maya_date = MayaDate(timestamp) -print(maya_date.date()) diff --git a/templates/poweroff/at/node.def b/templates/poweroff/at/node.def deleted file mode 100644 index 537bfff..0000000 --- a/templates/poweroff/at/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Poweroff at a specific time diff --git a/templates/poweroff/at/node.tag/node.def b/templates/poweroff/at/node.tag/node.def deleted file mode 100644 index 932e04b..0000000 --- a/templates/poweroff/at/node.tag/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Poweroff the system at a future time -allowed: echo -n '' '' '' '' -run: sudo /opt/vyatta/bin/sudo-users/vyatta-poweroff.pl --action poweroff_at --at_time "$3" diff --git a/templates/poweroff/cancel/node.def b/templates/poweroff/cancel/node.def deleted file mode 100644 index c45f17a..0000000 --- a/templates/poweroff/cancel/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Cancel a pending poweroff -run: sudo /opt/vyatta/bin/sudo-users/vyatta-poweroff.pl --action poweroff_cancel diff --git a/templates/poweroff/node.def b/templates/poweroff/node.def deleted file mode 100644 index ccb7338..0000000 --- a/templates/poweroff/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Poweroff the system -run: sudo /opt/vyatta/bin/sudo-users/vyatta-poweroff.pl --action poweroff diff --git a/templates/poweroff/now/node.def b/templates/poweroff/now/node.def deleted file mode 100644 index 6b67572..0000000 --- a/templates/poweroff/now/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Poweroff the system without confirmation -run: sudo /opt/vyatta/bin/sudo-users/vyatta-poweroff.pl --action poweroff --now diff --git a/templates/reboot/at/node.def b/templates/reboot/at/node.def deleted file mode 100644 index 9944ff7..0000000 --- a/templates/reboot/at/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Reboot at a specific time diff --git a/templates/reboot/at/node.tag/node.def b/templates/reboot/at/node.tag/node.def deleted file mode 100644 index 62f39f9..0000000 --- a/templates/reboot/at/node.tag/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Reboot the system at a future time -allowed: echo -n '' '' '' '' -run: sudo /opt/vyatta/bin/sudo-users/vyatta-reboot.pl --action reboot_at --at_time "$3" diff --git a/templates/reboot/cancel/node.def b/templates/reboot/cancel/node.def deleted file mode 100644 index 110f595..0000000 --- a/templates/reboot/cancel/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Cancel a pending reboot -run: sudo /opt/vyatta/bin/sudo-users/vyatta-reboot.pl --action reboot_cancel diff --git a/templates/reboot/node.def b/templates/reboot/node.def deleted file mode 100644 index e65917d..0000000 --- a/templates/reboot/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Reboot the system -run: sudo /opt/vyatta/bin/sudo-users/vyatta-reboot.pl --action reboot diff --git a/templates/reboot/now/node.def b/templates/reboot/now/node.def deleted file mode 100644 index 2171b45..0000000 --- a/templates/reboot/now/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Reboot the system without confirmation -run: sudo /opt/vyatta/bin/sudo-users/vyatta-reboot.pl --action reboot --now diff --git a/templates/show/arp/node.def b/templates/show/arp/node.def deleted file mode 100644 index 013e016..0000000 --- a/templates/show/arp/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show Address Resolution Protocol (ARP) information -run: /usr/sbin/arp -e -n diff --git a/templates/show/arp/node.tag/node.def b/templates/show/arp/node.tag/node.def deleted file mode 100644 index 648797b..0000000 --- a/templates/show/arp/node.tag/node.def +++ /dev/null @@ -1,7 +0,0 @@ -help: Show Address Resolution Protocol (ARP) cache for specified interface -allowed: local -a vals; - vals=($(${vyatta_sbindir}/vyatta-interfaces.pl --show ethernet)); - vals+=($(${vyatta_sbindir}/vyatta-interfaces.pl --show bridge)); - vals+=($(${vyatta_sbindir}/vyatta-interfaces.pl --show bonding)); - echo ${vals[@]}; -run: /usr/sbin/arp -e -n -i "$3" diff --git a/templates/show/bridge/node.def b/templates/show/bridge/node.def deleted file mode 100644 index 86d0193..0000000 --- a/templates/show/bridge/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show bridging information -run: /sbin/brctl show diff --git a/templates/show/bridge/node.tag/macs/node.def b/templates/show/bridge/node.tag/macs/node.def deleted file mode 100644 index e985437..0000000 --- a/templates/show/bridge/node.tag/macs/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show bridge Media Access Control (MAC) address table -run: /sbin/brctl showmacs "$3" diff --git a/templates/show/bridge/node.tag/node.def b/templates/show/bridge/node.tag/node.def deleted file mode 100644 index 0ae82f1..0000000 --- a/templates/show/bridge/node.tag/node.def +++ /dev/null @@ -1,5 +0,0 @@ -help: Show bridge information for a given bridge interface -allowed: local -a array ; - array=( /sys/class/net/br* ) ; - echo -n '' ${array[@]##*/} -run: /sbin/brctl show "$3" diff --git a/templates/show/bridge/node.tag/spanning-tree/node.def b/templates/show/bridge/node.tag/spanning-tree/node.def deleted file mode 100644 index 360d15a..0000000 --- a/templates/show/bridge/node.tag/spanning-tree/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show bridge spanning tree information -run: /sbin/brctl showstp "$3" diff --git a/templates/show/configuration/all/node.def b/templates/show/configuration/all/node.def deleted file mode 100644 index 3f93f48..0000000 --- a/templates/show/configuration/all/node.def +++ /dev/null @@ -1,8 +0,0 @@ -help: Show running configuration (including default values) -run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; - then - cli-shell-api showCfg --show-show-defaults --show-active-only \ - --show-hide-secrets - else - echo Must be an admin user to run this command. - fi diff --git a/templates/show/configuration/commands/node.def b/templates/show/configuration/commands/node.def deleted file mode 100644 index f2e047e..0000000 --- a/templates/show/configuration/commands/node.def +++ /dev/null @@ -1,7 +0,0 @@ -help: Show running configuration as set commands -run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; - then - cli-shell-api showCfg --show-active-only | vyos-config-to-commands - else - echo Must be an admin user to run this command. - fi diff --git a/templates/show/configuration/files/node.def b/templates/show/configuration/files/node.def deleted file mode 100644 index 698ba14..0000000 --- a/templates/show/configuration/files/node.def +++ /dev/null @@ -1,11 +0,0 @@ -help: Show available saved configurations -run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; - then - find ${vyatta_sysconfdir}/config/ -type f -not -name ".*" -not -name "config.boot.*" -printf "%f\t(%Tc)\t%T@\n" | sort -r -k3 | awk -F"\t" '{printf ("%-20s\t%s\n", $1,$2) ;}' - else - echo Must be an admin user to run this command. - fi - - - - diff --git a/templates/show/configuration/node.def b/templates/show/configuration/node.def deleted file mode 100644 index 34813a4..0000000 --- a/templates/show/configuration/node.def +++ /dev/null @@ -1,7 +0,0 @@ -help: Show running configuration -run: if [ "$VYATTA_USER_LEVEL_DIR" == "/opt/vyatta/etc/shell/level/admin" ]; - then - cli-shell-api showCfg --show-active-only --show-hide-secrets - else - echo Must be an admin user to run this command. - fi diff --git a/templates/show/date/node.def b/templates/show/date/node.def deleted file mode 100644 index eb5adf9..0000000 --- a/templates/show/date/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show system date and time -run: /bin/date diff --git a/templates/show/date/utc/maya/node.def b/templates/show/date/utc/maya/node.def deleted file mode 100644 index ddc82c7..0000000 --- a/templates/show/date/utc/maya/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show UTC date in Maya calendar format -run: ${vyatta_bindir}/maya-date.py $(date +%s) diff --git a/templates/show/date/utc/node.def b/templates/show/date/utc/node.def deleted file mode 100644 index cb12d00..0000000 --- a/templates/show/date/utc/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show system date and time as Coordinated Universal Time -run: /bin/date -u diff --git a/templates/show/disk/node.def b/templates/show/disk/node.def deleted file mode 100644 index 8572a9f..0000000 --- a/templates/show/disk/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Show status of disk device diff --git a/templates/show/disk/node.tag/format/node.def b/templates/show/disk/node.tag/format/node.def deleted file mode 100644 index ad87cfc..0000000 --- a/templates/show/disk/node.tag/format/node.def +++ /dev/null @@ -1,7 +0,0 @@ -help: Show disk drive formatting -run: disk_dev="/dev/$3" - if [ ! -b "$disk_dev" ] - then echo "$3 is not a disk device" - exit 1 - fi - sudo /sbin/fdisk -l "$disk_dev" diff --git a/templates/show/disk/node.tag/node.def b/templates/show/disk/node.tag/node.def deleted file mode 100644 index 8690008..0000000 --- a/templates/show/disk/node.tag/node.def +++ /dev/null @@ -1,4 +0,0 @@ -help: Disk device name -allowed: awk 'NR > 2 && $4 !~ /[0-9]$/ { print $4 }' ' -run: last -aF -n $4 | sed -e "s/^wtmp begins/Displaying logins since/" -- cgit v1.2.3 From 195dc1e0ac8cebfbb84ed613993d807abbc4e338 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 14 Jun 2018 21:14:53 +0200 Subject: T683: Rewrite SNMP op mode commands in new stlye XML/Python --- templates/show/snmp/community/node.def | 1 - templates/show/snmp/community/node.tag/host/node.def | 2 -- templates/show/snmp/community/node.tag/host/node.tag/node.def | 3 --- templates/show/snmp/community/node.tag/node.def | 3 --- templates/show/snmp/mib/ifmib/ifAlias/node.def | 2 -- templates/show/snmp/mib/ifmib/ifAlias/node.tag/node.def | 2 -- templates/show/snmp/mib/ifmib/ifDescr/node.def | 2 -- templates/show/snmp/mib/ifmib/ifDescr/node.tag/node.def | 2 -- templates/show/snmp/mib/ifmib/ifIndex/node.def | 2 -- templates/show/snmp/mib/ifmib/ifIndex/node.tag/node.def | 2 -- templates/show/snmp/mib/ifmib/node.def | 2 -- templates/show/snmp/mib/node.def | 1 - templates/show/snmp/node.def | 2 -- templates/show/snmp/v3/certificates/node.def | 7 ------- templates/show/snmp/v3/group/node.def | 2 -- templates/show/snmp/v3/node.def | 2 -- templates/show/snmp/v3/trap-target/node.def | 2 -- templates/show/snmp/v3/user/node.def | 2 -- templates/show/snmp/v3/view/node.def | 2 -- 19 files changed, 43 deletions(-) delete mode 100644 templates/show/snmp/community/node.def delete mode 100644 templates/show/snmp/community/node.tag/host/node.def delete mode 100644 templates/show/snmp/community/node.tag/host/node.tag/node.def delete mode 100644 templates/show/snmp/community/node.tag/node.def delete mode 100644 templates/show/snmp/mib/ifmib/ifAlias/node.def delete mode 100644 templates/show/snmp/mib/ifmib/ifAlias/node.tag/node.def delete mode 100644 templates/show/snmp/mib/ifmib/ifDescr/node.def delete mode 100644 templates/show/snmp/mib/ifmib/ifDescr/node.tag/node.def delete mode 100644 templates/show/snmp/mib/ifmib/ifIndex/node.def delete mode 100644 templates/show/snmp/mib/ifmib/ifIndex/node.tag/node.def delete mode 100644 templates/show/snmp/mib/ifmib/node.def delete mode 100644 templates/show/snmp/mib/node.def delete mode 100644 templates/show/snmp/node.def delete mode 100644 templates/show/snmp/v3/certificates/node.def delete mode 100644 templates/show/snmp/v3/group/node.def delete mode 100644 templates/show/snmp/v3/node.def delete mode 100644 templates/show/snmp/v3/trap-target/node.def delete mode 100644 templates/show/snmp/v3/user/node.def delete mode 100644 templates/show/snmp/v3/view/node.def (limited to 'templates') diff --git a/templates/show/snmp/community/node.def b/templates/show/snmp/community/node.def deleted file mode 100644 index 48e7d1d..0000000 --- a/templates/show/snmp/community/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Show status of SNMP community diff --git a/templates/show/snmp/community/node.tag/host/node.def b/templates/show/snmp/community/node.tag/host/node.def deleted file mode 100644 index ac7e559..0000000 --- a/templates/show/snmp/community/node.tag/host/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show status of SNMP on remote host - diff --git a/templates/show/snmp/community/node.tag/host/node.tag/node.def b/templates/show/snmp/community/node.tag/host/node.tag/node.def deleted file mode 100644 index b20409d..0000000 --- a/templates/show/snmp/community/node.tag/host/node.tag/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Show status of SNMP on specified host -allowed: echo -n ' ' -run: ${vyatta_bindir}/vyatta-show-snmp.pl --community $4 --host $6 diff --git a/templates/show/snmp/community/node.tag/node.def b/templates/show/snmp/community/node.tag/node.def deleted file mode 100644 index 48aa6ad..0000000 --- a/templates/show/snmp/community/node.tag/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Show status of specified SNMP community -allowed: ${vyatta_bindir}/vyatta-show-snmp.pl --allowed -run: ${vyatta_bindir}/vyatta-show-snmp.pl --community="$4" diff --git a/templates/show/snmp/mib/ifmib/ifAlias/node.def b/templates/show/snmp/mib/ifmib/ifAlias/node.def deleted file mode 100644 index 91a0aa0..0000000 --- a/templates/show/snmp/mib/ifmib/ifAlias/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show SNMP ifAlias for all interfaces -run: ${vyatta_bindir}/vyatta-show-snmp-ifmib --ifalias diff --git a/templates/show/snmp/mib/ifmib/ifAlias/node.tag/node.def b/templates/show/snmp/mib/ifmib/ifAlias/node.tag/node.def deleted file mode 100644 index 6c5b00a..0000000 --- a/templates/show/snmp/mib/ifmib/ifAlias/node.tag/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show SNMP ifAlias for specified interface -run: ${vyatta_bindir}/vyatta-show-snmp-ifmib --ifalias $6 diff --git a/templates/show/snmp/mib/ifmib/ifDescr/node.def b/templates/show/snmp/mib/ifmib/ifDescr/node.def deleted file mode 100644 index 6ec827d..0000000 --- a/templates/show/snmp/mib/ifmib/ifDescr/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show SNMP ifDescr for all interfaces -run: ${vyatta_bindir}/vyatta-show-snmp-ifmib --ifdescr diff --git a/templates/show/snmp/mib/ifmib/ifDescr/node.tag/node.def b/templates/show/snmp/mib/ifmib/ifDescr/node.tag/node.def deleted file mode 100644 index 95222de..0000000 --- a/templates/show/snmp/mib/ifmib/ifDescr/node.tag/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show SNMP ifDescr for specified interface -run: ${vyatta_bindir}/vyatta-show-snmp-ifmib --ifdescr $6 diff --git a/templates/show/snmp/mib/ifmib/ifIndex/node.def b/templates/show/snmp/mib/ifmib/ifIndex/node.def deleted file mode 100644 index 2955c1d..0000000 --- a/templates/show/snmp/mib/ifmib/ifIndex/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show SNMP ifIndex for all interfaces -run: ${vyatta_bindir}/vyatta-show-snmp-ifmib --ifindex diff --git a/templates/show/snmp/mib/ifmib/ifIndex/node.tag/node.def b/templates/show/snmp/mib/ifmib/ifIndex/node.tag/node.def deleted file mode 100644 index f9159ac..0000000 --- a/templates/show/snmp/mib/ifmib/ifIndex/node.tag/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show SNMP ifIndex for specified interface -run: ${vyatta_bindir}/vyatta-show-snmp-ifmib --ifindex $6 diff --git a/templates/show/snmp/mib/ifmib/node.def b/templates/show/snmp/mib/ifmib/node.def deleted file mode 100644 index fa309ff..0000000 --- a/templates/show/snmp/mib/ifmib/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show SNMP interfaces MIB information -run: ${vyatta_bindir}/vyatta-show-snmp-ifmib diff --git a/templates/show/snmp/mib/node.def b/templates/show/snmp/mib/node.def deleted file mode 100644 index de4f01b..0000000 --- a/templates/show/snmp/mib/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Show SNMP MIB information diff --git a/templates/show/snmp/node.def b/templates/show/snmp/node.def deleted file mode 100644 index 98f4366..0000000 --- a/templates/show/snmp/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show status of SNMP on localhost -run: ${vyatta_bindir}/vyatta-show-snmp.pl diff --git a/templates/show/snmp/v3/certificates/node.def b/templates/show/snmp/v3/certificates/node.def deleted file mode 100644 index e66fc0d..0000000 --- a/templates/show/snmp/v3/certificates/node.def +++ /dev/null @@ -1,7 +0,0 @@ -help: Show TSM certificates -run: files=`sudo ls /etc/snmp/tls/certs/ 2> /dev/null`; - if [ -n "$files" ]; then - sudo /usr/bin/net-snmp-cert showcerts --subject --fingerprint - else - echo "You don't have any certificates. Put it in '/etc/snmp/tls/certs/' folder." - fi diff --git a/templates/show/snmp/v3/group/node.def b/templates/show/snmp/v3/group/node.def deleted file mode 100644 index 7ff947a..0000000 --- a/templates/show/snmp/v3/group/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show the list of configured groups -run: /opt/vyatta/bin/vyatta-show-snmp-v3.pl --group \ No newline at end of file diff --git a/templates/show/snmp/v3/node.def b/templates/show/snmp/v3/node.def deleted file mode 100644 index 70c0df2..0000000 --- a/templates/show/snmp/v3/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show status of SNMP v3 on localhost -run: /opt/vyatta/bin/vyatta-show-snmp-v3.pl --all \ No newline at end of file diff --git a/templates/show/snmp/v3/trap-target/node.def b/templates/show/snmp/v3/trap-target/node.def deleted file mode 100644 index 9f0d2f1..0000000 --- a/templates/show/snmp/v3/trap-target/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show the list of configured targets -run: /opt/vyatta/bin/vyatta-show-snmp-v3.pl --trap diff --git a/templates/show/snmp/v3/user/node.def b/templates/show/snmp/v3/user/node.def deleted file mode 100644 index 621ccc8..0000000 --- a/templates/show/snmp/v3/user/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show the list of configured users -run: /opt/vyatta/bin/vyatta-show-snmp-v3.pl --user diff --git a/templates/show/snmp/v3/view/node.def b/templates/show/snmp/v3/view/node.def deleted file mode 100644 index 7e05d84..0000000 --- a/templates/show/snmp/v3/view/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show the list of configured views -run: /opt/vyatta/bin/vyatta-show-snmp-v3.pl --view \ No newline at end of file -- cgit v1.2.3