From d63969cc27e8e9fbd7ff8b759d05bb0931dd0273 Mon Sep 17 00:00:00 2001 From: Thomas Jepp Date: Mon, 23 Nov 2015 17:20:01 +0000 Subject: Add missing build depends for Jessie. --- debian/control | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index ac29f08..1046c54 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,8 @@ Source: vyatta-op Section: contrib/net Priority: extra Maintainer: VyOS Package Maintainers -Build-Depends: debhelper (>= 5), autotools-dev +Build-Depends: debhelper (>= 5), autotools-dev, autoconf, automake, + cpio Standards-Version: 3.9.1 Package: vyatta-op -- cgit v1.2.3 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(-) 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 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 c71796a32064cdd215530c0a6f3882a57add91d4 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Sun, 24 Jan 2016 15:19:33 -0500 Subject: 0.14.0+vyos2+current1 --- debian/changelog | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/debian/changelog b/debian/changelog index 9b17b00..5a896d3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +vyatta-op (0.14.0+vyos2+current1) unstable; urgency=medium + + [ Thomas Jepp ] + * Add missing build depends for Jessie. + + [ Daniil Baturin ] + * Remove referenced to Vyatta from 'show version' completion help. + * Easter egg: 'show version funny' command that displays limericks after version information. + + [ Kim Hagen ] + + -- Kim Hagen Sun, 24 Jan 2016 15:19:11 -0500 + vyatta-op (0.14.0+vyos2+lithium12) unstable; urgency=low [ Thomas Jepp ] -- cgit v1.2.3 From 3a92c96ba66b256db30b5325267cb123cbe9b7b6 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Tue, 26 Jan 2016 02:27:24 -0500 Subject: Add function to bash-completion script to fix message "bad array subscript" --- etc/bash_completion.d/vyatta-op | 46 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op index c820305..47092a2 100644 --- a/etc/bash_completion.d/vyatta-op +++ b/etc/bash_completion.d/vyatta-op @@ -104,14 +104,14 @@ _vyatta_op_default_expand () local wc=${#COMP_WORDS[@]} if [[ "${COMP_WORDS[0]}" =~ "/" ]]; then # if we are looking for a directory on the first completion then do directory completions - _filedir_xspec + _filedir_xspec_vyos elif (( wc < 2 )) || [[ $COMP_CWORD -eq 0 ]] || [[ $1 == $2 ]]; then _vyatta_op_expand "$@" else # after the first word => cannot be vyatta command so use original default - _filedir_xspec + _filedir_xspec_vyos fi } @@ -599,6 +599,48 @@ _vyatta_set_comptype () done } +_filedir_xspec_vyos() +{ + local cur prev words cword + _init_completion || return + + _tilde "$cur" || return 0 + + local IFS=$'\n' xspec=${_xspec[${1##*/}]} tmp + local -a toks + + toks=( $( + compgen -d -- "$(quote_readline "$cur")" | { + while read -r tmp; do + printf '%s\n' $tmp + done + } + )) + + # Munge xspec to contain uppercase version too + # http://thread.gmane.org/gmane.comp.shells.bash.bugs/15294/focus=15306 + eval xspec="${xspec}" + local matchop=! + if [[ $xspec == !* ]]; then + xspec=${xspec#!} + matchop=@ + fi + xspec="$matchop($xspec|${xspec^^})" + + toks+=( $( + eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | { + while read -r tmp; do + [[ -n $tmp ]] && printf '%s\n' $tmp + done + } + )) + + if [[ ${#toks[@]} -ne 0 ]]; then + compopt -o filenames + COMPREPLY=( "${toks[@]}" ) + fi +} + nullglob_save=$( shopt -p nullglob ) shopt -s nullglob for f in ${vyatta_datadir}/vyatta-op/functions/allowed/* ; do -- 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(-) 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 75caf5c06cd8841db4aedd1ef6673f6dbcf74bb2 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Mon, 8 Feb 2016 07:45:00 -0500 Subject: Fix "show system image version" command. --- scripts/vyatta-boot-image.pl | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl index 52d5198..a4c0169 100755 --- a/scripts/vyatta-boot-image.pl +++ b/scripts/vyatta-boot-image.pl @@ -31,7 +31,7 @@ use File::Copy; # # Constants # -my $UNION_BOOT = '/live/image/boot'; +my $UNION_BOOT = '/lib/live/mount/persistence/boot'; my $UNION_GRUB_CFG = "$UNION_BOOT/grub/grub.cfg"; my $VER_FILE = '/opt/vyatta/etc/version'; my $OLD_IMG_VER_STR = 'Old-non-image-installation'; @@ -226,32 +226,31 @@ sub image_vyatta_version { my ($image_name) = @_; my $vers; - my $dpkg_path = "var/lib/dpkg"; my $image_path; if ($image_name eq $OLD_IMG_VER_STR) { $image_path = ""; } else { - $image_path = "/live/image/boot/$image_name/live-rw"; + $image_path = "/lib/live/mount/persistence/boot/$image_name/rw"; } - $image_path .= "/var/lib/dpkg"; + $image_path .= "/opt/vyatta/etc/version"; if ( -e $image_path ) { - $vers = `dpkg-query --admindir=$image_path --showformat='\${Version}' --show vyatta-version`; + $vers = `cat $image_path | awk '{print \$2}'`; return $vers; } else { if ($image_name eq $OLD_IMG_VER_STR) { return "unknown"; } - my @squash_files = glob("/live/image/boot/$image_name/*.squashfs"); + my @squash_files = glob("/lib/live/mount/persistence/boot/$image_name/*.squashfs"); foreach my $squash_file (@squash_files) { if (-e $squash_file) { system("sudo mkdir /tmp/squash_mount"); system("sudo mount -o loop,ro -t squashfs $squash_file /tmp/squash_mount"); - $image_path = "/tmp/squash_mount/var/lib/dpkg"; - my $vers = `dpkg-query --admindir=$image_path --showformat='\${Version}' --show vyatta-version`; + $image_path = "/tmp/squash_mount/opt/vyatta/etc/version"; + my $vers = `cat $image_path | awk '{print \$2}'`; system("sudo umount /tmp/squash_mount"); system("sudo rmdir /tmp/squash_mount"); return $vers; -- cgit v1.2.3 From 0c77160cd5e22714c2373e9554998c140b9c0bdd Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Mon, 8 Feb 2016 11:06:17 -0500 Subject: Update paths in del_non_image_files function. --- scripts/vyatta-boot-image.pl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl index a4c0169..0a15bb0 100755 --- a/scripts/vyatta-boot-image.pl +++ b/scripts/vyatta-boot-image.pl @@ -431,15 +431,15 @@ sub del_non_image_files { system("echo Deleting disk-based system files at: `date` >> $logfile"); system("echo Run by: `whoami` >> $logfile"); - foreach my $entry (glob("/live/image/*")) { - if ($entry eq "/live/image/boot") { - print "Skipping $entry.\n"; - } else { - print "Deleting $entry..."; - system ("echo deleting $entry >> $logfile"); - system ("rm -rf $entry >> $logfile 2>&1"); - print "\n"; - } + foreach my $entry (glob("/lib/live/mount/persistence/*")) { + if ($entry eq "/lib/live/mount/persistence/boot") { + print "Skipping $entry.\n"; + } else { + print "Deleting $entry..."; + system ("echo deleting $entry >> $logfile"); + system ("rm -rf $entry >> $logfile 2>&1"); + print "\n"; + } } system ("echo done at: `date` >> $logfile"); } -- cgit v1.2.3 From fdf69619a8f27a3310235a9d320748d8dbb3f657 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Mon, 8 Feb 2016 11:21:47 -0500 Subject: Update location of LIVE_CD. --- scripts/vyatta-boot-image.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl index 0a15bb0..e1d4a8c 100755 --- a/scripts/vyatta-boot-image.pl +++ b/scripts/vyatta-boot-image.pl @@ -38,7 +38,7 @@ my $OLD_IMG_VER_STR = 'Old-non-image-installation'; my $OLD_GRUB_CFG = '/boot/grub/grub.cfg'; my $DISK_BOOT = '/boot'; my $XEN_DEFAULT_IMAGE = "$UNION_BOOT/%%default_image"; -my $LIVE_CD = '/live/image/live'; +my $LIVE_CD = '/lib/live/mount/medium/live'; # # Globals -- cgit v1.2.3 From b4275461305f74798c7805ce2a5d25105e82caea Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Mon, 8 Feb 2016 11:56:29 -0500 Subject: Update debian live mountpoin. --- functions/interpreter/vyatta-image-complete | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/functions/interpreter/vyatta-image-complete b/functions/interpreter/vyatta-image-complete index 622123b..cfc1c90 100644 --- a/functions/interpreter/vyatta-image-complete +++ b/functions/interpreter/vyatta-image-complete @@ -29,11 +29,11 @@ _vyatta_image_is_file() if [[ $topdir == "running" ]]; then cur="/${cur}" elif [[ $topdir == "disk-install" ]]; then - cur="/live/image/${cur}" + cur="/lib/live/mount/persistence/${cur}" elif [[ ${cur:0:1} =~ "/" ]]; then cur=${cur} else - cur="/live/image/boot/${topdir}/live-rw/${cur}" + cur="/lib/live/mount/persistence/boot/${topdir}/rw/${cur}" fi if [[ -f ${cur} ]]; then return 0; @@ -75,14 +75,14 @@ _vyatta_image_path_complete() return fi if [[ ${cur} == "" ]]; then - reply=( $(compgen -d /live/image/boot/ | grep -v grub) ) + 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\//} reply[$i]="${reply[$i]}://config/" done reply+=( "running://config/" ) - if [[ -d /live/image/opt/vyatta/etc/config || -d /live/image/config ]]; then + if [[ -d /lib/live/mount/persistence/opt/vyatta/etc/config || -d /lib/live/mount/persistence/config ]]; then reply+=( "disk-install://" ) fi _vyatta_op_noncompletions=( "${non_comps[@]}" ) @@ -100,9 +100,9 @@ _vyatta_image_path_complete() if [[ $isrunningimg == "running" ]];then cur="/" elif [[ $isdiskinstall == "disk-install" ]]; then - cur="/live/image/" + cur="/lib/live/mount/persistence/" else - cur="/live/image/boot/${cur}" + cur="/lib/live/mount/persistence/boot/${cur}" fi reply=( $(compgen -f ${cur} | grep -v grub) ) for i in `seq 0 $[${#reply[@]}-1]`; do @@ -112,8 +112,8 @@ _vyatta_image_path_complete() elif [[ $isdiskinstall == "disk-install" ]]; then reply[$i]="disk-install://" else - reply[$i]=${file/#\/live\/image\/boot\//} - if [[ -d /live/image/boot/${reply[$i]} ]]; then + reply[$i]=${file/#\/lib\/live\/mount\/persistence\/boot\//} + if [[ -d /ib/live/mount/persistence/boot/${reply[$i]} ]]; then reply[$i]="${reply[$i]/#\//}://config/" fi fi @@ -125,9 +125,9 @@ _vyatta_image_path_complete() if [[ $topdir == "running" ]]; then cur="/${cur}" elif [[ $topdir == "disk-install" ]]; then - cur="/live/image/${cur}" + cur="/ib/live/mount/persistence/${cur}" else - cur="/live/image/boot/${topdir}/live-rw/${cur}" + cur="/ib/live/mount/persistence/boot/${topdir}/rw/${cur}" fi reply=( $(compgen -f ${cur}) ) # for loop from _filedirs() in /etc/bash_completion @@ -148,10 +148,10 @@ _vyatta_image_path_complete() if [[ $topdir == "running" ]]; then reply[$i]=${file/#\//"$topdir://"} elif [[ $topdir == "disk-install" ]]; then - reply[$i]=${file/#\/live\/image\//"$topdir://"} + reply[$i]=${file/#\/lib\/live\/mount\/persistence\//"$topdir://"} else - reply[$i]=${file/#\/live\/image\/boot\/$topdir/"$topdir://"} - reply[$i]=${reply[$i]/\/live-rw\/} + reply[$i]=${file/#\/lib\/live\/mount\/persistence\/boot\/$topdir/"$topdir://"} + reply[$i]=${reply[$i]/\/rw\/} fi done 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(-) 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(-) 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 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 bb2e1e9dbb7bdf153bf43056d64e82d749a3aa81 Mon Sep 17 00:00:00 2001 From: Kim Date: Sat, 16 Apr 2016 18:03:51 +0200 Subject: stop smartmatch warnings --- scripts/ping | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ping b/scripts/ping index c0fae36..b72ea54 100755 --- a/scripts/ping +++ b/scripts/ping @@ -40,6 +40,7 @@ use strict; use warnings; use NetAddr::IP; use feature ":5.10"; +use experimental 'smartmatch'; sub get_options { my ($opt, $args) = @_; -- 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(-) 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 a34e4f13c9b387c184b4f55d53477b0b33610bd7 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Thu, 15 Sep 2016 12:28:12 +0200 Subject: fix error message "NameError: name 'CalledProcessError' is not defined" when doing a 'show version' on a non virtual machine --- scripts/vyos-show-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/vyos-show-version b/scripts/vyos-show-version index a701b84..c0609ca 100644 --- a/scripts/vyos-show-version +++ b/scripts/vyos-show-version @@ -73,7 +73,7 @@ system_type = "physical" try: hypervisor = subprocess.check_output('hvinfo', shell=True).strip() system_type = "{0} guest".format(hypervisor) -except CalledProcessError: +except subprocess.CalledProcessError: # hvinfo returns 1 if it cannot detect any hypervisor pass version_data['system_type'] = system_type -- cgit v1.2.3 From 7487f99240d3815cf70d1a016415e2c44ef2a8d3 Mon Sep 17 00:00:00 2001 From: Geoff Adams Date: Tue, 20 Sep 2016 18:25:56 -0700 Subject: Correctly identify ttyS1 as a serial console, as well (issue T146). --- scripts/vyatta-boot-image.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl index 52b4769..6d03865 100755 --- a/scripts/vyatta-boot-image.pl +++ b/scripts/vyatta-boot-image.pl @@ -102,7 +102,7 @@ sub parseGrubCfg { # old install $ehash{'ver'} = $OLD_IMG_VER_STR; } - if (/console=tty0.*console=ttyS0/) { + if (/console=tty0.*console=ttyS[01]/) { $ehash{'term'} = 'serial'; } else { $ehash{'term'} = 'kvm'; -- cgit v1.2.3 From 55915987f745d48fa4b1319888c1edb86963c6ba Mon Sep 17 00:00:00 2001 From: Geoff Adams Date: Mon, 26 Sep 2016 22:18:16 -0700 Subject: Support serial console on any ttyS#. Well, any of the first 10. --- scripts/vyatta-boot-image.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl index 6d03865..d3ca5e8 100755 --- a/scripts/vyatta-boot-image.pl +++ b/scripts/vyatta-boot-image.pl @@ -102,7 +102,7 @@ sub parseGrubCfg { # old install $ehash{'ver'} = $OLD_IMG_VER_STR; } - if (/console=tty0.*console=ttyS[01]/) { + if (/console=tty0.*console=ttyS[0-9]/) { $ehash{'term'} = 'serial'; } else { $ehash{'term'} = 'kvm'; -- 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(-) 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(-) 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 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 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 970ff0cfe393ccfa63d1f875483f3df7543d6c62 Mon Sep 17 00:00:00 2001 From: Chris Freas Date: Sun, 5 Mar 2017 11:40:59 -0500 Subject: Fix the 'ssh-server-key' script to use the 'yesno' script as per dmbaturin's request. --- scripts/ssh-server-key | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/ssh-server-key b/scripts/ssh-server-key index 9712393..949d314 100755 --- a/scripts/ssh-server-key +++ b/scripts/ssh-server-key @@ -5,11 +5,10 @@ regen_host_keys () 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 +echo "Do you really want to remove the existing SSH host keys? " +${vyatta_bindir}/yesno + +if [ $? -eq 0 ] +then + regen_host_keys +fi -- 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(-) 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 1002bd9b740befed18aca7a6ffafb786b91a9b3c Mon Sep 17 00:00:00 2001 From: Kim Date: Sat, 25 Mar 2017 14:45:07 +0100 Subject: remove console-setup dependency non of its binaries are used and it installs non needed xkb-data package --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 6062453..733e9eb 100644 --- a/debian/control +++ b/debian/control @@ -9,7 +9,7 @@ Standards-Version: 3.9.1 Package: vyatta-op Architecture: all Depends: sed (>= 4.1.5), - console-setup, console-terminus, + console-terminus, bmon, iftop, ethtool, -- cgit v1.2.3 From a57412bb0a95f80f90e57f631dc27dacd0720c71 Mon Sep 17 00:00:00 2001 From: Kim Date: Thu, 27 Apr 2017 18:07:51 +0200 Subject: include ssh-server-key in package --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 2554bb3..04c463d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -53,6 +53,7 @@ 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 += ssh-server-key sbin_SCRIPTS = scripts/dhcpv6-client-show-leases.pl sbin_SCRIPTS += scripts/vyatta-image-tools.pl -- cgit v1.2.3 From 76822101f04681402df67fcb194e8c0fdd71c96d Mon Sep 17 00:00:00 2001 From: Kim Date: Thu, 27 Apr 2017 18:08:57 +0200 Subject: correctly include ssh-server-key in package --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 04c463d..c79a629 100644 --- a/Makefile.am +++ b/Makefile.am @@ -53,7 +53,7 @@ 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 += ssh-server-key +bin_SCRIPTS += scripts/ssh-server-key sbin_SCRIPTS = scripts/dhcpv6-client-show-leases.pl sbin_SCRIPTS += scripts/vyatta-image-tools.pl -- 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(-) 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 6f9273fe6e5585b6a7e8e076916f9429d472a002 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Fri, 15 Sep 2017 09:19:23 +0200 Subject: T394: copy vyatta_* environment variables to vyos_* equivalents. --- etc/default/vyatta.in | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/etc/default/vyatta.in b/etc/default/vyatta.in index 88940f5..3601f36 100644 --- a/etc/default/vyatta.in +++ b/etc/default/vyatta.in @@ -26,57 +26,73 @@ unset _vyatta_extglob if test -z "$vyatta_prefix" ; then if test -n "@prefix@" ; then declare -x -r vyatta_prefix=@prefix@ + declare -x -r vyos_prefix=@prefix@ else declare -x -r vyatta_prefix=/opt/vyatta + declare -x -r vyos_prefix=/opt/vyatta fi fi if test -z "$vyatta_exec_prefix" ; then if test -n "@exec_prefix@" ; then declare -x -r vyatta_prefix=@exec_prefix@ + declare -x -r vyos_prefix=@exec_prefix@ else declare -x -r vyatta_prefix=$vyatta_prefix + declare -x -r vyos_prefix=$vyatta_prefix fi fi if test -z "$vyatta_datarootdir" ; then if test -n "@datarootdir@" ; then declare -x -r vyatta_datarootdir=@datarootdir@ + declare -x -r vyos_datarootdir=@datarootdir@ else declare -x -r vyatta_datarootdir=$vyatta_prefix/share + declare -x -r vyos_datarootdir=$vyatta_prefix/share fi fi if test -z "$vyatta_bindir" ; then if test -n "@bindir@" ; then declare -x -r vyatta_bindir=@bindir@ + declare -x -r vyos_bindir=@bindir@ else declare -x -r vyatta_bindir=$vyatta_exec_prefix/bin + declare -x -r vyos_bindir=$vyatta_exec_prefix/bin fi fi if test -z "$vyatta_sbindir" ; then if test -n "@sbindir@" ; then declare -x -r vyatta_sbindir=@sbindir@ + declare -x -r vyos_sbindir=@sbindir@ else declare -x -r vyatta_sbindir=$vyatta_exec_prefix/sbin + declare -x -r vyos_sbindir=$vyatta_exec_prefix/sbin fi fi if test -z "$vyatta_libdir" ; then if test -n "@libdir@" ; then declare -x -r vyatta_libdir=@libdir@ + declare -x -r vyos_libdir=@libdir@ else declare -x -r vyatta_libdir=$vyatta_exec_prefix/lib + declare -x -r vyos_libdir=$vyatta_exec_prefix/lib fi fi if test -z "$vyatta_libexecdir" ; then if test -n "@libexecdir@" ; then declare -x -r vyatta_libexecdir=@libexecdir@ + declare -x -r vyos_libexecdir=@libexecdir@ else declare -x -r vyatta_libexecdir=$vyatta_exec_prefix/libexec + declare -x -r vyos_libexecdir=$vyatta_exec_prefix/libexec fi fi if test -z "$vyatta_datadir" ; then if test -n "@datadir@" ; then declare -x -r vyatta_datadir=@datadir@ + declare -x -r vyos_datadir=@datadir@ else declare -x -r vyatta_datadir=$vyatta_datarootdir + declare -x -r vyos_datadir=$vyatta_datarootdir fi fi if test -z "$vyatta_htmldir" ; then @@ -131,12 +147,15 @@ unset _vyatta_extglob if test -z "$vyatta_op_templates" ; then declare -x -r vyatta_op_templates=$vyatta_datadir/vyatta-op/templates + declare -x -r vyos_op_templates=$vyatta_datadir/vyatta-op/templates fi if test -z "$vyatta_cfg_templates" ; then declare -x -r vyatta_cfg_templates=$vyatta_datadir/vyatta-cfg/templates + declare -x -r vyos_cfg_templates=$vyatta_datadir/vyatta-cfg/templates fi if test -z "$vyatta_configdir" ; then declare -x -r vyatta_configdir=$vyatta_prefix/config + declare -x -r vyos_configdir=$vyatta_prefix/config fi for var in prefix exec_prefix datarootdir ; do -- 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 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 447bc26b83b2d4a540d1340f846c6f15fd118710 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 28 Aug 2017 17:17:18 +0200 Subject: Added generated-templates folder to .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e1bffc4..8c3a92a 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,4 @@ libtool /etc/shell/level/users/allowed-op /src/render_xml - +generated-templates/* -- 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 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 7d6556160144566a47ac43d528c334f62d26ba2e Mon Sep 17 00:00:00 2001 From: Carl Byington Date: Thu, 23 Nov 2017 09:08:02 +0100 Subject: fix changelog date format --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 8faac25..8d8625e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,7 +4,7 @@ vyatta-op (0.14.0+vyos2+current3) unstable; urgency=medium information is removed. * Added 'show tech-support private' which contains non redacted output - -- Christian Poessinger Sun Oct 29 15:36:45 2017 +0100 + -- Christian Poessinger Sun, 29 Oct 2017 15:36:45 +0100 vyatta-op (0.14.0+vyos2+current2) unstable; urgency=medium -- cgit v1.2.3 From 7586d7f0b6fb9f24ba2d406941d963cf5b0068e8 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 21 Jan 2018 17:12:58 +0100 Subject: T523: Use new location for dnsmasq config files --- debian/changelog | 6 ++++++ scripts/vyatta-op-dns-forwarding.pl | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 8d8625e..14f8078 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-op (0.14.0+vyos2+current4) unstable; urgency=medium + + * T523: Use new location for dnsmasq config files + + -- Christian Poessinger Sun, 21 Jan 2018 17:10:30 +0100 + vyatta-op (0.14.0+vyos2+current3) unstable; urgency=medium * Changed 'show tech-support' implementation to a redacted output, private diff --git a/scripts/vyatta-op-dns-forwarding.pl b/scripts/vyatta-op-dns-forwarding.pl index 5f94c15..ae72b37 100755 --- a/scripts/vyatta-op-dns-forwarding.pl +++ b/scripts/vyatta-op-dns-forwarding.pl @@ -122,7 +122,7 @@ sub get_dns_nameservers { my @use_dhcp_nameservers = $vyatta_config->returnOrigValues("dhcp"); my @use_nameservers = $vyatta_config->returnOrigValues("name-server"); my @resolv_conf_nameservers = `grep "^nameserver" /etc/resolv.conf`; - my @dnsmasq_conf_nameservers = `grep "server=" /etc/dnsmasq.conf`; + my @dnsmasq_conf_nameservers = `grep "server=" /etc/dnsmasq.d/vyos.conf`; my @dnsmasq_running = `ps ax | grep dnsmasq | grep -v grep`; if (!(defined $use_system_nameservers) && (@use_dhcp_nameservers == 0) && (@use_nameservers == 0)) { -- 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 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 18c58a419dd2e89b5f092baef5e4cccbbe1408dc Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 3 May 2018 16:47:55 +0200 Subject: T618: supress stderr of hvinfo in the show version script. Also convert the script to python3. --- debian/control | 2 +- scripts/vyos-show-version | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/control b/debian/control index 733e9eb..bd17cf4 100644 --- a/debian/control +++ b/debian/control @@ -33,7 +33,7 @@ Depends: sed (>= 4.1.5), usbutils, lsscsi, hvinfo, - python-pystache + python3-pystache Suggests: util-linux (>= 2.13-5), ncurses-bin (>= 5.5-5), dialog diff --git a/scripts/vyos-show-version b/scripts/vyos-show-version index 438f365..be86b73 100644 --- a/scripts/vyos-show-version +++ b/scripts/vyos-show-version @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2016 VyOS maintainers and contributors # @@ -74,9 +74,9 @@ version_data['system_arch'] = subprocess.check_output('uname -m', shell=True).st # Get hypervisor name, if any -system_type = "physical" +system_type = "bare metal" try: - hypervisor = subprocess.check_output('hvinfo', shell=True).strip() + 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 -- 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 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 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 685eac2fbf06f194fcfb4e3ea50f59efa5bda4f8 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 15 May 2018 00:51:52 +0200 Subject: T637: remove the old 'monitor interfaces ... traffic' implementation. --- gen-monitor-interface-templates.sh | 119 ------------------------- gen-monitor-vif-interface-templates.sh | 102 ---------------------- scripts/vyatta-tshark-interface-port.pl | 92 -------------------- scripts/vyatta-tshark.pl | 150 -------------------------------- 4 files changed, 463 deletions(-) delete mode 100755 gen-monitor-interface-templates.sh delete mode 100755 gen-monitor-vif-interface-templates.sh delete mode 100755 scripts/vyatta-tshark-interface-port.pl delete mode 100755 scripts/vyatta-tshark.pl diff --git a/gen-monitor-interface-templates.sh b/gen-monitor-interface-templates.sh deleted file mode 100755 index 2170e71..0000000 --- a/gen-monitor-interface-templates.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash -#monitor interfaces [type] [name] traffic -#monitor interfaces [type] [name] traffic flow -#monitor interfaces [type] [name] traffic save [filename] -#monitor interfaces [type] [name] traffic save [filename] size [number] -#monitor interfaces [type] [name] traffic save [filename] size [number] files [number] -#monitor interfaces [type] [name] traffic detail -#monitor interfaces [type] [name] traffic detail filter -#monitor interfaces [type] [name] traffic detail unlimited -#monitor interfaces [type] [name] traffic detail unlimited filter -#monitor interfaces [type] [name] traffic filter -#monitor interfaces [type] [name] traffic unlimited -#monitor interfaces [type] [name] traffic unlimited filter - -declare -a types=( - "bonding" \ - "bridge" \ - "ethernet" \ - "loopback" \ - "pseudo-ethernet" \ - "tunnel" \ - "vrrp" \ - "vti" \ - "dummy" \ - "l2tpv3" -) - -TEMPLATE_DIR=generated-templates/monitor/interfaces -mkdir -p $TEMPLATE_DIR -cd $TEMPLATE_DIR - -for type in "${types[@]}"; do - mkdir -p $type/node.tag/flow - mkdir -p $type/node.tag/traffic/save/node.tag/size/node.tag/files/node.tag - mkdir -p $type/node.tag/traffic/detail/filter/node.tag - mkdir -p $type/node.tag/traffic/detail/unlimited/filter/node.tag - mkdir -p $type/node.tag/traffic/filter/node.tag - mkdir -p $type/node.tag/traffic/unlimited/filter/node.tag - - # node.tag - echo "help: Monitor specified $type interface" >| $type/node.tag/node.def - echo "allowed: \${vyatta_sbindir}/vyatta-interfaces.pl --show $type" >> $type/node.tag/node.def - echo 'run: bmon -p $4' >> $type/node.tag/node.def - - # flow - echo 'help: Monitor flows on specified interface' >| $type/node.tag/flow/node.def - echo 'run: sudo /usr/sbin/iftop -i $4' >> $type/node.tag/flow/node.def - - # traffic - echo "help: Montior captured traffic on specified $type interface" >| $type/node.tag/traffic/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4' >> $type/node.tag/traffic/node.def - - # traffic save - echo 'help: Save monitored traffic to a file' >| $type/node.tag/traffic/save/node.def - echo 'help: Save monitored traffic to the specified file' >| $type/node.tag/traffic/save/node.tag/node.def - echo "allowed: echo -e '.pcap'" >> $type/node.tag/traffic/save/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --save "${@:7}"' >> $type/node.tag/traffic/save/node.tag/node.def - - # traffic save size - echo 'help: Save monitored traffic to a file with max size' >| $type/node.tag/traffic/save/node.tag/size/node.def - echo "help: Maximum file size (e.g., 1 = 1 KiB, 1M = 1 MiB)" >| $type/node.tag/traffic/save/node.tag/size/node.tag/node.def - echo "allowed: echo -e ''" >> $type/node.tag/traffic/save/node.tag/size/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --save "${@:7}" --size "${@:9}"' >> $type/node.tag/traffic/save/node.tag/size/node.tag/node.def - - # traffic save size files - echo 'help: Save monitored traffic to a set of rotated file' >| $type/node.tag/traffic/save/node.tag/size/node.tag/files/node.def - echo 'help: Number of files to rotate stored traffic through' >| $type/node.tag/traffic/save/node.tag/size/node.tag/files/node.tag/node.def - echo "allowed: echo -e ''" >> $type/node.tag/traffic/save/node.tag/size/node.tag/files/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --save "${@:7}" --size "${@:9}" --files "${@:11}"' >> $type/node.tag/traffic/save/node.tag/size/node.tag/files/node.tag/node.def - - # traffic detail - echo -e "help: Monitor detailed traffic for the specified $type interface" >| $type/node.tag/traffic/detail/node.def - echo -e 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --detail' >> $type/node.tag/traffic/detail/node.def - - # traffic detail filter - echo "help: Monitor detailed filtered traffic for the specified $type interface" >| $type/node.tag/traffic/detail/filter/node.def - echo -e "help: Monitor detailed filtered traffic for the specified $type interface" >| $type/node.tag/traffic/detail/filter/node.tag/node.def - echo -e "allowed: echo -e ''" >> $type/node.tag/traffic/detail/filter/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --detail --filter "${@:8}"' >> $type/node.tag/traffic/detail/filter/node.tag/node.def - - # traffic detail unlimited - echo -e "help: Monitor detailed traffic for the specified $type interface" >| $type/node.tag/traffic/detail/unlimited/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --detail --unlimited' >> $type/node.tag/traffic/detail/unlimited/node.def - - # traffic detail unlimited filter - echo "help: Monitor detailed filtered traffic for the specified $type interface" >| $type/node.tag/traffic/detail/unlimited/filter/node.def - echo "help: Monitor detailed filtered traffic for the specified $type interface" >| $type/node.tag/traffic/detail/unlimited/filter/node.tag/node.def - echo "allowed: echo -e ''" >> $type/node.tag/traffic/detail/unlimited/filter/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --detail --unlimited --filter "${@:9}"' >> $type/node.tag/traffic/detail/unlimited/filter/node.tag/node.def - - # traffic filter - echo "help: Monitor filtered traffic for the specified $type interface" >| $type/node.tag/traffic/filter/node.def - echo "help: Monitor filtered traffic for the specified $type interface" >| $type/node.tag/traffic/filter/node.tag/node.def - echo "allowed: echo -e ''" >> $type/node.tag/traffic/filter/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --filter "${@:7}"' >> $type/node.tag/traffic/filter/node.tag/node.def - - # traffic unlimited - echo "help: Monitor traffic for the specified $type interface" >| $type/node.tag/traffic/unlimited/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --unlimited' >> $type/node.tag/traffic/unlimited/node.def - - # traffic unlimited filter - echo "help: Monitor filtered traffic for the specified $type interface" >| $type/node.tag/traffic/unlimited/filter/node.def - echo "help: Monitor filtered traffic for the specified $type interface" >| $type/node.tag/traffic/unlimited/filter/node.tag/node.def - echo "allowed: echo -e ''" >> $type/node.tag/traffic/unlimited/filter/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --unlimited --filter "${@:8}"' >> $type/node.tag/traffic/unlimited/filter/node.tag/node.def - -done - -# Overrides -# This is where specific tweaks to the above can be made - -# loopback -sed -i -e 's;run: bmon -p $4;;' loopback/node.tag/node.def - -# vti -rm -rf vti/node.tag/flow - -# VRRP -sed -i -e 's;allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show vrrp;allowed: ${vyatta_bindir}/vyatta-show-interfaces.pl --vrrp --action=allowed;' vrrp/node.tag/node.def diff --git a/gen-monitor-vif-interface-templates.sh b/gen-monitor-vif-interface-templates.sh deleted file mode 100755 index ac128e8..0000000 --- a/gen-monitor-vif-interface-templates.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -#monitor interfaces [type] [name] vif flow -#monitor interfaces [type] [name] vif traffic -#monitor interfaces [type] [name] vif traffic save [filename] -#monitor interfaces [type] [name] vif traffic detail -#monitor interfaces [type] [name] vif traffic detail filter -#monitor interfaces [type] [name] vif traffic detail unlimited -#monitor interfaces [type] [name] vif traffic detail unlimited filter -#monitor interfaces [type] [name] vif traffic filter -#monitor interfaces [type] [name] vif traffic unlimited -#monitor interfaces [type] [name] vif traffic unlimited filter - -declare -a types=( - "bonding" \ - "ethernet" \ -) - -TEMPLATE_DIR=generated-templates/monitor/interfaces -mkdir -p $TEMPLATE_DIR -cd $TEMPLATE_DIR - -for type in "${types[@]}"; do - mkdir -p $type/node.tag/vif/node.tag/flow - mkdir -p $type/node.tag/vif/node.tag/traffic/save/node.tag/size/node.tag/files/node.tag - mkdir -p $type/node.tag/vif/node.tag/traffic/detail/filter/node.tag - mkdir -p $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.tag - mkdir -p $type/node.tag/vif/node.tag/traffic/filter/node.tag - mkdir -p $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.tag - - # node.tag - echo "help: Monitor specified $type interface" >| $type/node.tag/vif/node.tag/node.def - echo "allowed: \${vyatta_sbindir}/vyatta-interfaces.pl --show $type --vif \${COMP_WORDS[COMP_CWORD-2]}" >> $type/node.tag/vif/node.tag/node.def - echo 'run: bmon -p $4.$6' >> $type/node.tag/vif/node.tag/node.def - - # flow - echo 'help: Monitor flows on specified interface' >| $type/node.tag/vif/node.tag/flow/node.def - echo 'run: sudo /usr/sbin/iftop -i $4.$6' >> $type/node.tag/vif/node.tag/flow/node.def - - # node.tag - echo "help: Monitor specified $type interface" > $type/node.tag/vif/node.tag/node.def - echo "allowed: \${vyatta_sbindir}/vyatta-interfaces.pl --show $type --vif \${COMP_WORDS[COMP_CWORD-2]}" >> $type/node.tag/vif/node.tag/node.def - echo 'run: bmon -p $4.$6' >> $type/node.tag/vif/node.tag/node.def - - # traffic - echo "help: Montior captured traffic on specified $type interface" >| $type/node.tag/vif/node.tag/traffic/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6' >> $type/node.tag/vif/node.tag/traffic/node.def - - # traffic save - echo 'help: Save monitored traffic to a file' >| $type/node.tag/vif/node.tag/traffic/save/node.def - echo 'help: Save monitored traffic to the specified file' >| $type/node.tag/vif/node.tag/traffic/save/node.tag/node.def - echo "allowed: echo -e '.pcap'" >> $type/node.tag/vif/node.tag/traffic/save/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --save "${@:9}"' >> $type/node.tag/vif/node.tag/traffic/save/node.tag/node.def - - # traffic save size - echo 'help: Save monitored traffic to a file with max size' >| $type/node.tag/vif/node.tag/traffic/save/node.tag/size/node.def - echo "help: Maximum file size (e.g., 1 = 1 KiB, 1M = 1 MiB)" >| $type/node.tag/vif/node.tag/traffic/save/node.tag/size/node.tag/node.def - echo "allowed: echo -e ''" >> $type/node.tag/vif/node.tag/traffic/save/node.tag/size/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --save "${@:7}" --size "${@:9}"' >> $type/node.tag/vif/node.tag/traffic/save/node.tag/size/node.tag/node.def - - # traffic save size files - echo 'help: Save monitored traffic to a set of rotated files' >| $type/node.tag/vif/node.tag/traffic/save/node.tag/size/node.tag/files/node.def - echo 'help: Number of files to rotate stored traffic through' >| $type/node.tag/vif/node.tag/traffic/save/node.tag/size/node.tag/files/node.tag/node.def - echo "allowed: echo -e ''" >> $type/node.tag/vif/node.tag/traffic/save/node.tag/size/node.tag/files/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4 --save "${@:7}" --size "${@:9}" --files "${@:11}"' >> $type/node.tag/vif/node.tag/traffic/save/node.tag/size/node.tag/files/node.tag/node.def - - # traffic detail - echo -e "help: Monitor detailed traffic for the specified $type interface" >| $type/node.tag/vif/node.tag/traffic/detail/node.def - echo -e 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --detail' >> $type/node.tag/vif/node.tag/traffic/detail/node.def - - # traffic detail filter - echo "help: Monitor detailed filtered traffic for the specified $type interface" >| $type/node.tag/vif/node.tag/traffic/detail/filter/node.def - echo -e "help: Monitor detailed filtered traffic for the specified $type interface" >| $type/node.tag/vif/node.tag/traffic/detail/filter/node.tag/node.def - echo -e "allowed: echo -e ''" >> $type/node.tag/vif/node.tag/traffic/detail/filter/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --detail --filter "${@:10}"' >> $type/node.tag/vif/node.tag/traffic/detail/filter/node.tag/node.def - - # traffic detail unlimited - echo -e "help: Monitor detailed traffic for the specified $type interface" >| $type/node.tag/vif/node.tag/traffic/detail/unlimited/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --detail --unlimited' >> $type/node.tag/vif/node.tag/traffic/detail/unlimited/node.def - - # traffic detail unlimited filter - echo "help: Monitor detailed filtered traffic for the specified $type interface" >| $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.def - echo "help: Monitor detailed filtered traffic for the specified $type interface" >| $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.tag/node.def - echo "allowed: echo -e ''" >> $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --detail --unlimited --filter "${@:11}"' >> $type/node.tag/vif/node.tag/traffic/detail/unlimited/filter/node.tag/node.def - - # traffic filter - echo "help: Monitor filtered traffic for the specified $type interface" >| $type/node.tag/vif/node.tag/traffic/filter/node.def - echo "help: Monitor filtered traffic for the specified $type interface" >| $type/node.tag/vif/node.tag/traffic/filter/node.tag/node.def - echo "allowed: echo -e ''" >> $type/node.tag/vif/node.tag/traffic/filter/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --filter "${@:9}"' >> $type/node.tag/vif/node.tag/traffic/filter/node.tag/node.def - - # traffic unlimited - echo "help: Monitor traffic for the specified $type interface" >| $type/node.tag/vif/node.tag/traffic/unlimited/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --unlimited' >> $type/node.tag/vif/node.tag/traffic/unlimited/node.def - - # traffic unlimited filter - echo "help: Monitor filtered traffic for the specified $type interface" >| $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.def - echo "help: Monitor filtered traffic for the specified $type interface" >| $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.tag/node.def - echo "allowed: echo -e ''" >> $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.tag/node.def - echo 'run: ${vyatta_bindir}/vyatta-tshark.pl --intf $4.$6 --unlimited --filter "${@:10}"' >> $type/node.tag/vif/node.tag/traffic/unlimited/filter/node.tag/node.def - -done diff --git a/scripts/vyatta-tshark-interface-port.pl b/scripts/vyatta-tshark-interface-port.pl deleted file mode 100755 index aa750e5..0000000 --- a/scripts/vyatta-tshark-interface-port.pl +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/perl -# -# Module: vyatta-tshark-interface-port.pl -# -# **** License **** -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# This code was originally developed by Vyatta, Inc. -# Portions created by Vyatta are Copyright (C) 2006, 2007, 2008 Vyatta, Inc. -# All Rights Reserved. -# -# Author: Mohit Mehta -# Date: April 2008 -# Description: tshark on a given port for a given interface from vyatta cli -# -# **** End License **** -# - -use lib "/opt/vyatta/share/perl5/"; - -use strict; -use warnings; - -sub check_if_interface_is_tsharkable { - my $interface = shift; - - my @grep_tshark_interfaces = `sudo /usr/bin/tshark -D | grep $interface`; - my $any_interface; - - for my $count (0 .. $#grep_tshark_interfaces) { - my @temp = split(/ /,$grep_tshark_interfaces[$count]); - chomp $temp[1]; - $grep_tshark_interfaces[$count] = $temp[1]; - } - - my $exact_match = 0; - for my $count (0 .. $#grep_tshark_interfaces) { - if ($grep_tshark_interfaces[$count] eq $interface) { - $exact_match = 1; - $any_interface = $grep_tshark_interfaces[$count]; - } - } - if ($exact_match == 0 || $any_interface eq 'any') { - print "Unable to capture traffic on $interface\n"; - exit 1; - } -} - -# -# main -# - -my $intf = $ARGV[0]; - -check_if_interface_is_tsharkable($intf); - -if ($#ARGV > 0){ - my $port = $ARGV[1]; - my $not_port = $ARGV[2]; - if ($port =~ /[a-zA-Z]/){ - print "Port number has to be numeric. Allowed values: <1-65535>\n"; - exit 1; - } else { - if (($port > 0) and ($port < 65536)){ - if ($not_port == 0){ - print "Capturing traffic on $intf port $port ...\n"; - exec "sudo /usr/bin/tshark -n -i $intf port $port 2> /dev/null"; - } else { - print "Capturing traffic on $intf excluding port $port ...\n"; - exec "sudo /usr/bin/tshark -n -i $intf not port $port 2> /dev/null"; - } - } else { - print "Invalid port number. Allowed values: <1-65535>\n"; - exit 1; - } - - } -} else { - print "Capturing traffic on $intf ...\n"; - exec "sudo /usr/bin/tshark -n -i $intf 2> /dev/null"; -} - -exit 0; - -#end of file diff --git a/scripts/vyatta-tshark.pl b/scripts/vyatta-tshark.pl deleted file mode 100755 index 5423cfc..0000000 --- a/scripts/vyatta-tshark.pl +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/perl -# -# Module: vyatta-tshark-interface-port.pl -# -# **** License **** -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# This code was originally developed by Vyatta, Inc. -# Portions created by Vyatta are Copyright (C) 2006, 2007, 2008 Vyatta, Inc. -# All Rights Reserved. -# -# Author: John Southworth -# Date: Sept. 2011 -# Description: run tshark on a given interface with options -# -# **** End License **** -# - -use lib "/opt/vyatta/share/perl5/"; - -use strict; -use warnings; -use Getopt::Long; - -sub check_if_interface_is_tsharkable { - my $interface = shift; - - my @grep_tshark_interfaces = `/usr/bin/tshark -D | grep $interface`; - my $any_interface; - - for my $count (0 .. $#grep_tshark_interfaces) { - my @temp = split(/ /,$grep_tshark_interfaces[$count]); - chomp $temp[1]; - $grep_tshark_interfaces[$count] = $temp[1]; - } - - my $exact_match = 0; - for my $count (0 .. $#grep_tshark_interfaces) { - if ($grep_tshark_interfaces[$count] eq $interface) { - $exact_match = 1; - $any_interface = $grep_tshark_interfaces[$count]; - } - } - if ($exact_match == 0 || $any_interface eq 'any') { - print "Unable to capture traffic on $interface\n"; - exit 1; - } -} - -my ($detail,$filter,$intf,$unlimited,$save,$files,$size); - -# -# The size parameter can have one of the following -# unit suffixes: -# -# - [kK] KiB (1024 bytes) -# - [mM] MiB (1048576 bytes) -# - [gG] GiB (1073741824 bytes) -# - [tT] TiB (109951162778 bytes) -# -# Note: tshark's default size unit is KiB -sub parse_size { - my ( $name, $parm ) = @_; - my %mult = ('T' => 1073741824, 't' => 1073741824, - 'G' => 1048576, 'g' => 1048576, - 'M' => 1024, 'm' => 1024, - 'K' => 1, 'k' => 1); - - die "Invalid parameter: $name" if ($name ne "size"); - my ( $value, $unit ) = $parm =~ m/^([0-9]+)([kKmMgGtT])?$/; - die "Invalid size specified" unless $value; - $unit = "K" unless $unit; - $size = $value * $mult{$unit}; -} - -# -# main -# - -my $result = GetOptions("detail!" => \$detail, - "filter=s" => \$filter, - "save=s" => \$save, - "intf=s" => \$intf, - "unlimited!" => \$unlimited, - "files=i" => \$files, - "size=s" => \&parse_size); - -if (! $result) { - print "Invalid option specifications\n"; - exit 1; -} - -check_if_interface_is_tsharkable($intf); - -if (defined($save)){ - if (!($save =~ /.*\.pcap/)) { - print("Please name your file .pcap\n"); - exit 1; - } - my $options = ""; - - # the CLI will make sure that files is not defined w/o size also - $options .= " -a filesize:$size" if defined($size); - $options .= " -b files:$files" if defined($files); - exec "/usr/bin/tshark -i $intf -w '$save' $options"; - exit 0; -} - -if (defined($filter)) { - if (defined($detail)) { - if (defined($unlimited)){ - print "Capturing traffic on $intf ...\n"; - exec "/usr/bin/tshark -n -i $intf -V $filter 2> /dev/null"; - } else { - print "Capturing traffic on $intf ...\n"; - exec "/usr/bin/tshark -n -i $intf -c 1000 -V $filter 2> /dev/null"; - } - } elsif (defined($unlimited)) { - print "Capturing traffic on $intf ...\n"; - exec "/usr/bin/tshark -n -i $intf $filter 2> /dev/null"; - } else { - print "Capturing traffic on $intf ...\n"; - exec "/usr/bin/tshark -n -i $intf -c 1000 $filter 2> /dev/null"; - } -} elsif (defined($detail)) { - if (defined($unlimited)) { - print "Capturing traffic on $intf ...\n"; - exec "/usr/bin/tshark -n -i $intf -V 2> /dev/null"; - } else { - print "Capturing traffic on $intf ...\n"; - exec "/usr/bin/tshark -n -i $intf -c 1000 -V 2> /dev/null"; - } -} elsif (defined($unlimited)) { - print "Capturing traffic on $intf ...\n"; - exec "/usr/bin/tshark -n -i $intf 2> /dev/null"; -} else { - print "Capturing traffic on $intf ...\n"; - exec "/usr/bin/tshark -n -i $intf -c 1000 2> /dev/null"; -} - -exit 0; - -#end of file -- 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 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 773df82ea88e220aaa3354d2b01f4cc43113f730 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 15 May 2018 03:15:05 +0200 Subject: T637: Remove references to autogenerated monitor interfaces commands from the makefile. --- Makefile.am | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index ea115cf..2ecd735 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,8 +21,6 @@ bin_SCRIPTS = scripts/vyatta-show-interfaces bin_SCRIPTS += scripts/vyatta-show-interfaces.pl bin_SCRIPTS += scripts/vyatta-show-dhclient.pl bin_SCRIPTS += scripts/vyatta-show-dmi -bin_SCRIPTS += scripts/vyatta-tshark-interface-port.pl -bin_SCRIPTS += scripts/vyatta-tshark.pl bin_SCRIPTS += scripts/vyatta-show-bonding.pl bin_SCRIPTS += scripts/vyatta-cpu-summary.pl bin_SCRIPTS += scripts/yesno @@ -68,8 +66,6 @@ bin_sudo_users_SCRIPTS += scripts/vyatta-clear-conntrack all-local: ./gen-unpriv-commands.sh - ./gen-monitor-interface-templates.sh - ./gen-monitor-vif-interface-templates.sh clean-local: $(RM) -r generated-templates @@ -80,7 +76,6 @@ cpiop = find . ! -regex '\(.*~\|.*\.bak\|.*\.swp\|.*\#.*\#\)' -print0 | \ install-exec-hook: mkdir -p $(DESTDIR)$(opdir) cd templates; $(cpiop) $(DESTDIR)$(opdir) - cd generated-templates && $(cpiop) $(DESTDIR)$(opdir) mkdir -p $(DESTDIR)$(etc_shell_leveldir) cd etc/shell/level; $(cpiop) $(DESTDIR)$(etc_shell_leveldir) mkdir -p $(DESTDIR)/etc/ -- cgit v1.2.3 From 1c911e9b090638abebb0f91b20e2f42e7ebe2a28 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 16 May 2018 15:47:37 +0200 Subject: T644: point vyos_* dirs to the /usr/ hierarchy intead of /opt/vyatta --- etc/default/vyatta.in | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/etc/default/vyatta.in b/etc/default/vyatta.in index 3601f36..9841dc5 100644 --- a/etc/default/vyatta.in +++ b/etc/default/vyatta.in @@ -53,19 +53,15 @@ unset _vyatta_extglob if test -z "$vyatta_bindir" ; then if test -n "@bindir@" ; then declare -x -r vyatta_bindir=@bindir@ - declare -x -r vyos_bindir=@bindir@ else declare -x -r vyatta_bindir=$vyatta_exec_prefix/bin - declare -x -r vyos_bindir=$vyatta_exec_prefix/bin fi fi if test -z "$vyatta_sbindir" ; then if test -n "@sbindir@" ; then declare -x -r vyatta_sbindir=@sbindir@ - declare -x -r vyos_sbindir=@sbindir@ else declare -x -r vyatta_sbindir=$vyatta_exec_prefix/sbin - declare -x -r vyos_sbindir=$vyatta_exec_prefix/sbin fi fi if test -z "$vyatta_libdir" ; then @@ -80,10 +76,8 @@ unset _vyatta_extglob if test -z "$vyatta_libexecdir" ; then if test -n "@libexecdir@" ; then declare -x -r vyatta_libexecdir=@libexecdir@ - declare -x -r vyos_libexecdir=@libexecdir@ else declare -x -r vyatta_libexecdir=$vyatta_exec_prefix/libexec - declare -x -r vyos_libexecdir=$vyatta_exec_prefix/libexec fi fi if test -z "$vyatta_datadir" ; then @@ -161,7 +155,27 @@ unset _vyatta_extglob for var in prefix exec_prefix datarootdir ; do eval test -n \"\$_vyatta_save_$var\" \&\& $var=\$_vyatta_save_$var done - + + # It's not like we do, or should support installing VyOS at a different prefix + declare -x -r vyos_libexec_dir=/usr/libexec/vyos + declare -x -r vyos_bin_dir=/usr/bin + declare -x -r vyos_sbin_dir=/usr/sbin + + if test -z "$vyos_conf_scripts_dir" ; then + declare -x -r vyos_conf_scripts_dir=$vyos_libexec_dir/conf_mode + fi + + if test -z "$vyos_op_scripts_dir" ; then + declare -x -r vyos_op_scripts_dir=$vyos_libexec_dir/op_mode + fi + + if test -z "$vyos_completion__dir" ; then + declare -x -r vyos_completion_dir=$vyos_libexec_dir/completion + fi + + if test -z "$vyos_validators_dir" ; then + declare -x -r vyos_validators_dir=$vyos_libexec_dir/validators + fi } 2>/dev/null || : -- 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(-) 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 83234bc6a31775c0c750e2d90176673dd8b5f3c8 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sun, 10 Jun 2018 22:03:01 +0200 Subject: T588: remove the old DNS forwarding op mode script. --- scripts/vyatta-op-dns-forwarding.pl | 350 ------------------------------------ 1 file changed, 350 deletions(-) delete mode 100755 scripts/vyatta-op-dns-forwarding.pl diff --git a/scripts/vyatta-op-dns-forwarding.pl b/scripts/vyatta-op-dns-forwarding.pl deleted file mode 100755 index ae72b37..0000000 --- a/scripts/vyatta-op-dns-forwarding.pl +++ /dev/null @@ -1,350 +0,0 @@ -#!/usr/bin/perl -# -# Module: vyatta-op-dns-forwarding.pl -# -# **** License **** -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# This code was originally developed by Vyatta, Inc. -# Portions created by Vyatta are Copyright (C) 2008 Vyatta, Inc. -# All Rights Reserved. -# -# Author: Mohit Mehta -# Date: August 2008 -# Description: Script to execute op-mode commands for DNS forwarding -# -# **** End License **** -# - -use lib "/opt/vyatta/share/perl5/"; -use Getopt::Long; -use Vyatta::Config; -use strict; -use warnings; - -my $show_stats_output=""; -my $show_nameservers_output=""; -my $dnsmasq_log='/var/log/dnsmasq.log'; - -sub get_cache_stats { - my ($cache_size, $queries_forwarded, $queries_answered_locally, $entries_inserted, $entries_removed); - - my $grepped_line = `grep 'cache size' $dnsmasq_log`; - my @split_line = split(/\s+/, $grepped_line); - my @temp_split = split(/,/, $split_line[6]); - $cache_size = $temp_split[0]; - @temp_split = split(/\//, $split_line[7]); - $entries_removed = $temp_split[0]; - $entries_inserted = $temp_split[1]; - - $grepped_line = `grep 'queries forwarded' $dnsmasq_log`; - @split_line = split(/\s+/, $grepped_line); - @temp_split = split(/,/, $split_line[6]); - $queries_forwarded = $temp_split[0]; - $queries_answered_locally = $split_line[10]; - - $show_stats_output .= "----------------\n"; - $show_stats_output .= "Cache statistics\n"; - $show_stats_output .= "----------------\n"; - $show_stats_output .= "Cache size: $cache_size\n"; - $show_stats_output .= "Queries forwarded: $queries_forwarded\n"; - $show_stats_output .= "Queries answered locally: $queries_answered_locally\n"; - $show_stats_output .= "Total DNS entries inserted into cache: $entries_inserted\n"; - $show_stats_output .= "DNS entries removed from cache before expiry: $entries_removed\n"; - -} - -sub get_nameserver_stats { - - $show_stats_output .= "\n---------------------\n"; - $show_stats_output .= "Nameserver statistics\n"; - $show_stats_output .= "---------------------\n"; - - #To show overridden domain servers seperately, we need to compare IPs - #configured for the domain overrides in the config with the stats. - - my $vyatta_config = new Vyatta::Config; - $vyatta_config->setLevel("service dns forwarding"); - - my @domains = $vyatta_config->listOrigNodes("domain"); - my @domain_servers_list; - - #build a list of servers that are overriding global nameservers - if (@domains) { - foreach my $domain (@domains) { - push(@domain_servers_list, $vyatta_config->returnOrigValue("domain $domain server")); - } - } - my $found_overrides = 0; - my $show_stats_overrides; - my @grepped_lines = `grep ': server' $dnsmasq_log`; - foreach my $lines (@grepped_lines) { - my @each_line = split(/\s+/, $lines); - my $nameserver_word = $each_line[5]; - my @nameserver_split = split(/#/, $nameserver_word); - my $nameserver = $nameserver_split[0]; - my $queries_sent_word = $each_line[8]; - my @queries_sent_split = split(/,/, $queries_sent_word); - my $queries_sent = $queries_sent_split[0]; - my $queries_retried_failed = $each_line[12]; - - if (grep {$_ eq $nameserver}@domain_servers_list) { - if (!$found_overrides) { - $found_overrides = 1; - $show_stats_overrides .= "\nDomain Override Servers\n\n"; - } - $show_stats_overrides .= "Server: $nameserver\nQueries sent: $queries_sent\nQueries retried or failed: $queries_retried_failed\n\n"; - } else { - $show_stats_output .= "Server: $nameserver\nQueries sent: $queries_sent\nQueries retried or failed: $queries_retried_failed\n\n"; - } - } - if (defined($show_stats_overrides)) { - $show_stats_output .= $show_stats_overrides; - } -} - -sub print_stats { - print $show_stats_output; -} - -sub get_dns_nameservers { - my $vyatta_config = new Vyatta::Config; - - $vyatta_config->setLevel("service dns forwarding"); - my $use_system_nameservers = $vyatta_config->existsOrig("system"); - my @use_dhcp_nameservers = $vyatta_config->returnOrigValues("dhcp"); - my @use_nameservers = $vyatta_config->returnOrigValues("name-server"); - my @resolv_conf_nameservers = `grep "^nameserver" /etc/resolv.conf`; - my @dnsmasq_conf_nameservers = `grep "server=" /etc/dnsmasq.d/vyos.conf`; - my @dnsmasq_running = `ps ax | grep dnsmasq | grep -v grep`; - - if (!(defined $use_system_nameservers) && (@use_dhcp_nameservers == 0) && (@use_nameservers == 0)) { - - # no specific nameservers specified under DNS forwarding, so dnsmasq is getting nameservers from /etc/resolv.conf - - if (! @resolv_conf_nameservers > 0){ - $show_nameservers_output .= "No DNS servers present to forward queries to.\n"; - if (! @dnsmasq_running > 0){ - $show_nameservers_output .= "DNS forwarding has not been configured either.\n"; - } - } else { - if (! @dnsmasq_running > 0){ - $show_nameservers_output .= "\n**DNS forwarding has not been configured**\n\n"; - } - $show_nameservers_output .= "-----------------------------------------------\n"; - if ( @dnsmasq_running > 0){ - $show_nameservers_output .= " Nameservers configured for DNS forwarding\n"; - } else { - $show_nameservers_output .= " Nameservers NOT configured for DNS forwarding\n"; - } - $show_nameservers_output .= "-----------------------------------------------\n"; - foreach my $line (@resolv_conf_nameservers) { - my @split_line = split(/\s+/, $line); - my $nameserver = $split_line[1]; - my $nameserver_via = "system"; - if (@split_line > 2) { - my @dhclient_resolv_files = `ls /etc/resolv.conf.dhclient-new-* 2>/dev/null`; - foreach my $each_dhcp_resolv_conf (@dhclient_resolv_files) { - my @ns_dhclient_resolv=`grep "$nameserver\$" $each_dhcp_resolv_conf`; - if ( @ns_dhclient_resolv > 0) { - my @dhclient_file_array = split(/-/, $each_dhcp_resolv_conf); - $nameserver_via = $dhclient_file_array[2]; - chomp $nameserver_via; - $nameserver_via = 'dhcp ' . $nameserver_via; - } - } - # check here if nameserver_via is still system, if yes then search /etc/ppp/resolv-interface.conf - if ($nameserver_via eq "system") { - my @ppp_resolv_files = `ls /etc/ppp/resolv-*conf 2>/dev/null`; - foreach my $each_ppp_resolv_conf (@ppp_resolv_files) { - my @ns_ppp_resolv=`grep "$nameserver\$" $each_ppp_resolv_conf`; - if ( @ns_ppp_resolv > 0) { - my @ppp_file_array = split(/-/, $each_ppp_resolv_conf); - @ppp_file_array = split(/\./, $ppp_file_array[1]); - $nameserver_via = $ppp_file_array[0]; - chomp $nameserver_via; - $nameserver_via = 'ppp ' . $nameserver_via; - } - } - } - } - $show_nameservers_output .= "$nameserver available via '$nameserver_via'\n"; - } - } - $show_nameservers_output .= "\n"; - } else { - - # nameservers specified under DNS forwarding, so dnsmasq getting nameservers from /etc/dnsmasq.conf - - my @active_nameservers; - my $active_nameserver_count = 0; - $show_nameservers_output .= "-----------------------------------------------\n"; - $show_nameservers_output .= " Nameservers configured for DNS forwarding\n"; - $show_nameservers_output .= "-----------------------------------------------\n"; - my $show_nameservers_output_dhcp; - my $show_nameservers_output_domain; - my $show_nameservers_output_nameserver; - - my $line_flag; - ## server=/test.com/1.1.1.1 - foreach my $line (@dnsmasq_conf_nameservers) { - my @split_line = split(/=/, $line); - my @nameserver_array = split(/\s+/, $split_line[1]); - my $nameserver = $nameserver_array[0]; - my $domain; - my @domain_tokens; - - if ($nameserver_array[2] eq "domain-override") - { - #$nameserver has /test.com/1.1.1.1, seperate it. - @domain_tokens = split(/\//, $nameserver); - if (!defined($line_flag)) { - $line_flag = 1; - $show_nameservers_output_domain .= "\n"; - $show_nameservers_output_domain .= "Domain Overrides:\n"; - $show_nameservers_output_domain .= "\n"; - } - } - $active_nameservers[$active_nameserver_count] = $nameserver; - $active_nameserver_count++; - my $nameserver_via = $nameserver_array[2]; - if (@nameserver_array > 3){ - my $dhcp_interface = $nameserver_array[3]; - $show_nameservers_output_dhcp .= "$nameserver available via '$nameserver_via $dhcp_interface'\n"; - } elsif (@domain_tokens) { - $show_nameservers_output_domain .= "$domain_tokens[1] uses $domain_tokens[2]\n"; - } else { - $show_nameservers_output_nameserver .= "$nameserver available via '$nameserver_via'\n"; - } - } - if (defined ($show_nameservers_output_nameserver)) { - $show_nameservers_output .= $show_nameservers_output_nameserver; - } - if (defined ($show_nameservers_output_dhcp)) { - $show_nameservers_output .= $show_nameservers_output_dhcp; - } - if (defined ($show_nameservers_output_domain)) { - $show_nameservers_output .= $show_nameservers_output_domain ; - } - - # then you need to get nameservers from /etc/resolv.conf that are not in dnsmasq.conf to show them as inactive - - my $active_dnsmasq_nameserver; - my $output_inactive_nameservers = 0; - foreach my $resolv_conf_line (@resolv_conf_nameservers) { - my @resolv_conf_split_line = split(/\s+/, $resolv_conf_line); - my $resolv_conf_nameserver = $resolv_conf_split_line[1]; - $active_dnsmasq_nameserver = 0; - my $resolv_nameserver_via = "system"; - foreach my $dnsmasq_nameserver (@active_nameservers) { - if ($dnsmasq_nameserver eq $resolv_conf_nameserver) { - $active_dnsmasq_nameserver = 1; - } - } - if ($active_dnsmasq_nameserver == 0) { - if ($output_inactive_nameservers == 0){ - $output_inactive_nameservers = 1; - $show_nameservers_output .= "\n-----------------------------------------------\n"; - $show_nameservers_output .= " Nameservers NOT configured for DNS forwarding\n"; - $show_nameservers_output .= "-----------------------------------------------\n"; - } - if (@resolv_conf_split_line > 2) { - my @dhclient_resolv_files = `ls /etc/resolv.conf.dhclient-new-* 2>/dev/null`; - foreach my $each_dhcp_resolv_conf (@dhclient_resolv_files) { - chomp $each_dhcp_resolv_conf; - my @ns_dhclient_resolv=`grep "$resolv_conf_nameserver\$" $each_dhcp_resolv_conf`; - if ( @ns_dhclient_resolv > 0) { - my @dhclient_file_array = split(/-/, $each_dhcp_resolv_conf); - $resolv_nameserver_via = $dhclient_file_array[2]; - chomp $resolv_nameserver_via; - $resolv_nameserver_via = 'dhcp ' . $resolv_nameserver_via; - } - } - # check here if resolv_nameserver_via is still system, if yes then search /etc/ppp/resolv-interface.conf - if ($resolv_nameserver_via eq "system") { - my @ppp_resolv_files = `ls /etc/ppp/resolv-*conf 2>/dev/null`; - foreach my $each_ppp_resolv_conf (@ppp_resolv_files) { - my @ns_ppp_resolv=`grep "$resolv_conf_nameserver\$" $each_ppp_resolv_conf`; - if ( @ns_ppp_resolv > 0) { - my @ppp_file_array = split(/-/, $each_ppp_resolv_conf); - @ppp_file_array = split(/\./, $ppp_file_array[1]); - $resolv_nameserver_via = $ppp_file_array[0]; - chomp $resolv_nameserver_via; - $resolv_nameserver_via = 'ppp ' . $resolv_nameserver_via; - } - } - } - } - - $show_nameservers_output .= "$resolv_conf_nameserver available via '$resolv_nameserver_via'\n"; - } - } - $show_nameservers_output .= "\n"; - } -} - -sub print_nameservers { - print $show_nameservers_output; -} - -sub wait_for_write { - - my $last_size = (stat($dnsmasq_log))[7]; - my $cnt=0; - while(1) { - system("usleep 10000"); # sleep for 0.01 second - my $curr_size = (stat($dnsmasq_log))[7]; - if( $curr_size == $last_size ) { - # Not modified - $cnt++; - last if($cnt > 1); - } else { - # Modified\n - $cnt=0; - } - $last_size = $curr_size; - } - -} - -# -# main -# -my ($clear_cache, $clear_all, $show_statistics, $show_nameservers); - -GetOptions("clear-cache!" => \$clear_cache, - "clear-all!" => \$clear_all, - "show-statistics!" => \$show_statistics, - "show-nameservers!" => \$show_nameservers); - -if (defined $clear_cache) { - system("kill -1 `pidof dnsmasq`"); -} - -if (defined $clear_all) { - system("/etc/init.d/dnsmasq restart >&/dev/null"); -} - -if (defined $show_statistics) { - system("echo > $dnsmasq_log; kill -10 `pidof dnsmasq`"); - wait_for_write; - get_cache_stats; - get_nameserver_stats; - print_stats; -} - -if (defined $show_nameservers) { - get_dns_nameservers; - print_nameservers; -} - -exit 0; - -# end of file -- cgit v1.2.3 From 98c47096b1b008066963b8e99ce792f0f5127345 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sun, 10 Jun 2018 22:14:06 +0200 Subject: Related to T689: update the show tech-support scripts. Remove references to Vyatta. Remove all references to serial WAN interfaces: not supported since forever. Remove references to IPS, also not supported since forever. Update configuration path for NAT. Do not try to check if VRRP is configured since it can be inside VIFs, the old check was incomplete. --- functions/tech-support | 111 ++++--------------------------------------- functions/tech-support-brief | 2 +- 2 files changed, 11 insertions(+), 102 deletions(-) diff --git a/functions/tech-support b/functions/tech-support index e4602d2..5c619d6 100755 --- a/functions/tech-support +++ b/functions/tech-support @@ -75,7 +75,7 @@ header Entitlement show entitlement fi -header Vyatta Version and Package Changes +header VyOS Version and Package Changes show version all header Configuration File @@ -104,12 +104,12 @@ header Ethernet header Interface statistics ip -s link show -for eth in $(/opt/vyatta/sbin/vyatta-interfaces.pl --show=ethernet) +for eth in $(${vyos_completion_dir}/list_interfaces.py --type=ethernet) do header "Physical Interface statistics for $eth" sudo ethtool -S $eth done -for eth in $(/opt/vyatta/sbin/vyatta-interfaces.pl --show=ethernet) +for eth in $(${vyos_completion_dir}/list_interfaces.py --type=ethernet) do header "Physical Interface Details for $eth" show interfaces ethernet $eth physical /sbin/ethtool -k $eth @@ -123,83 +123,12 @@ show arp | grep incomplete | wc -l header Bridge /sbin/brctl show -for br in $(/opt/vyatta/sbin/vyatta-interfaces.pl --show=bridge) +for br in $(${vyos_completion_dir}/list_interfaces.py --type=bridge) do header "Bridge Information for $br" /sbin/brctl showstp $br /sbin/brctl showmacs $br done -header Serial - -header "WAN Interface Hardware Information (wanrouter hwprobe)" -is_sangoma='lspci -n -d '1923:*'' -is_adsl='lspci -n -d '14bc:*'' -if [ -z "$is_sangoma" -a -z "$is_adsl" ]; then - - sudo wanrouter hwprobe - -header "WAN Interface Software Version (wanrouter version)" -wanrouter version - -header "WAN Interface Debugging Information (wanrouter debug)" -wanrouter debug - -header "WAN Interface Connection Status Information (wanrouter summary)" -wanrouter summary - -header "WAN Interface Information Summary (wanrouter status)" -wanrouter status - -header "WAN Interface Driver Information (wanrouter modules)" -wanrouter modules - -if [ -e /etc/wanpipe/wanrouter.rc ]; then - header "WAN Interface Startup Script (/etc/wanpipe/wanrouter.rc)" - cat /etc/wanpipe/wanrouter.rc -fi - -header WAN Interfaces -wanifs=( /sys/class/net/wan* ) -wanifs=`echo -n ${wanifs[@]##*/}` - -echo "wanifs are $wanifs" - -for ifname in $wanifs ; do - header "wanpipemon -i $ifname -c sc" - sudo wanpipemon -i $ifname -c sc - - header "wanpipemon -i $ifname -c so" - sudo wanpipemon -i $ifname -c so - - header "wanpipemon -i $ifname -c xcv" - sudo wanpipemon -i $ifname -c xcv - - header "wanpipemon -i $ifname -c xru" - sudo wanpipemon -i $ifname -c xru - - header "wanpipemon -i $ifname -c xm" - sudo wanpipemon -i $ifname -c xm - - header "wanpipemon -i $ifname -c xl" - sudo wanpipemon -i $ifname -c xl - - header "wanpipemon -i $ifname -c Ta" - sudo wanpipemon -i $ifname -c Ta -done - -for i in /etc/wanpipe/wanpipe*.conf ; do - if [ -e $i ]; then - header $i - cat $i - fi -done - -header "WAN Interface Configuration Log (wanrouter conflog)" -wanrouter conflog - -else -echo "Wanpipe not configured" -fi header ROUTING @@ -465,16 +394,6 @@ else echo "Firewall is not configured" fi -header IPS -if cli-shell-api existsActive content-inspection; then - header IPS log - show ips log - header IPS Update-Log - show ips update-log -else - echo "IPS is not configured" -fi - header IPSec if cli-shell-api existsActive vpn ipsec; then header IPSec Status @@ -498,7 +417,7 @@ else fi header NAT -if cli-shell-api existsActive service nat; then +if cli-shell-api existsActive nat; then header NAT Rules show nat rules header NAT Statistics @@ -510,12 +429,11 @@ else fi -header NETFLOW -if cli-shell-api existsActive system flow-accounting netflow; then - header NetFlow Accounting +header FlowAccounting +if cli-shell-api existsActive system flow-accounting; then show flow-accounting else - echo "Netflow is not configured" + echo "Flow accounting is not configured" fi header OPENVPN @@ -618,17 +536,8 @@ else fi header VRRP -found=0 -for eth in $(cd /sys/class/net; echo eth*); do - if cli-shell-api existsActive interfaces ethernet $eth vrrp; then - header \''show vrrp'\' - show vrrp - found=1 - fi -done -if [ $found -eq 0 ]; then - echo "VRRP is not configured" -fi +# XXX: not checking if configured, we'd have to walk all VIFs +show vrrp detail header WAN LOAD BALANCING if cli-shell-api existsActive load-balancing wan; then diff --git a/functions/tech-support-brief b/functions/tech-support-brief index 998adaf..6035d4a 100755 --- a/functions/tech-support-brief +++ b/functions/tech-support-brief @@ -71,7 +71,7 @@ header Show Tech-Support Brief header CONFIGURATION -header Vyatta Version and Package Changes +header VyOS Version and Package Changes show version all header Running configuration -- 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 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 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 From 418c6cfefcdf13cf6b96dd628bcd1d75046f179b Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 14 Jun 2018 21:17:51 +0200 Subject: T683: remove old Perl scripts for 'show snmp' --- Makefile.am | 3 - scripts/vyatta-show-snmp-ifmib | 138 --------------------------------- scripts/vyatta-show-snmp-v3.pl | 168 ----------------------------------------- scripts/vyatta-show-snmp.pl | 123 ------------------------------ 4 files changed, 432 deletions(-) delete mode 100644 scripts/vyatta-show-snmp-ifmib delete mode 100644 scripts/vyatta-show-snmp-v3.pl delete mode 100755 scripts/vyatta-show-snmp.pl diff --git a/Makefile.am b/Makefile.am index ad9c01a..0a1f89b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,9 +29,6 @@ bin_SCRIPTS += scripts/show-users.pl bin_SCRIPTS += scripts/show-dhcp-leases.pl bin_SCRIPTS += scripts/vyatta-boot-image.pl bin_SCRIPTS += scripts/vyatta-sudo -bin_SCRIPTS += scripts/vyatta-show-snmp.pl -bin_SCRIPTS += scripts/vyatta-show-snmp-ifmib -bin_SCRIPTS += scripts/vyatta-show-snmp-v3.pl bin_SCRIPTS += scripts/rename-image.pl bin_SCRIPTS += scripts/show-image-storage.pl bin_SCRIPTS += scripts/vyatta-remote-copy.pl diff --git a/scripts/vyatta-show-snmp-ifmib b/scripts/vyatta-show-snmp-ifmib deleted file mode 100644 index 8fb1004..0000000 --- a/scripts/vyatta-show-snmp-ifmib +++ /dev/null @@ -1,138 +0,0 @@ -#! /usr/bin/perl - -# **** License **** -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# This code was originally developed by Vyatta, Inc. -# Portions created by Vyatta are Copyright (C) 2007 Vyatta, Inc. -# All Rights Reserved. -# -# Author: Stephen Hemminger -# Date: Novemember 2010 -# Description: Script for show snmp ifmib -# -# **** End License **** - -use strict; -use warnings; -use Getopt::Long; -use POSIX qw(strtol); - -# This is used to show values corresponding to to results IF-MIB. -my %interfaces; - -sub show_ifindex { - foreach my $ifname (@_) { - my $info = $interfaces{$ifname}; - my $ifindex = $info->{'ifIndex'}; - printf "%s: ifIndex = %d\n", $ifname, $ifindex; - } -} - -sub show_ifalias { - foreach my $ifname (@_) { - my $info = $interfaces{$ifname}; - my $ifalias = $info->{'ifAlias'}; - printf "%s: ifAlias = %s\n", $ifname, - defined($ifalias) ? $ifalias : $ifname; - } -} - -sub read_sysfs { - my $filename = shift; - - open( my $f, '<', $filename ) - or return; # not a PCI device - - my $val = <$f>; - close $f; - - return strtol($val); -} - -# Imitate code in net-snmp to lookup PC -# TODO - move to common code extension (and handle USB?) -sub pci_info { - my $ifname = shift; - my $vendor_id = read_sysfs("/sys/class/net/$ifname/device/vendor"); - my $device_id = read_sysfs("/sys/class/net/$ifname/device/device"); - - return unless ( defined($vendor_id) && defined($device_id) ); - - my $cmd = sprintf("lspci -m -d %04x:%04x", $vendor_id, $device_id); - open( my $pci, '-|', $cmd ) - or die "Can't run $cmd"; - my $info = <$pci>; - close $pci; - - return unless $info; - - # extract vendor and device description from output - $info =~ /^\S+ "[^"]*" "([^"]*)" "([^"]*)"/; - - return "$1 $2"; -} - -sub show_ifdescr { - foreach my $ifname (@_) { - my $ifdescr = pci_info($ifname); - - printf "%s: ifDescr = %s\n", $ifname, - defined($ifdescr) ? $ifdescr : $ifname; - } -} - -sub show_all { - foreach my $ifname (@_) { - my $info = $interfaces{$ifname}; - my $ifindex = $info->{'ifIndex'}; - my $ifalias = $info->{'ifAlias'}; - my $ifdescr = pci_info($ifname); - - printf "%s: ifIndex = %d\n", $ifname, $ifindex; - - my $pad = sprintf( "%-*s", length($ifname) + 1, " " ); - printf "%s ifAlias = %s\n", $pad, $ifalias if ($ifalias); - printf "%s ifDescr = %s\n", $pad, $ifdescr if ($ifdescr); - } -} - -my $show = \&show_all; - -GetOptions( - "ifindex" => sub { $show = \&show_ifindex }, - "ifalias" => sub { $show = \&show_ifalias }, - "ifdescr" => sub { $show = \&show_ifdescr }, -) or die "Unknown option\n"; - -# List of all interfaces that currently exist on system -# includes interfaces that may be outside Vyatta CLI because -# they still show up in SNMP -open( my $ip, '-|', 'ip li' ) - or die "Can't run ip command\n"; - -my $ifname; -while (<$ip>) { - if (/^(\d+): ([^:]*): /) { - $ifname = $2; - $interfaces{$ifname} = { 'ifIndex' => $1 }; - } - elsif (/^ +alias (.*)$/) { - $interfaces{$ifname}->{'ifAlias'} = $1; - } -} -close $ip; - -if (@ARGV) { - $show->(@ARGV); -} -else { - $show->( sort keys %interfaces ); -} diff --git a/scripts/vyatta-show-snmp-v3.pl b/scripts/vyatta-show-snmp-v3.pl deleted file mode 100644 index dc81623..0000000 --- a/scripts/vyatta-show-snmp-v3.pl +++ /dev/null @@ -1,168 +0,0 @@ -#! /usr/bin/perl - -use Getopt::Long; - -sub show_view() { - print <= 20 ) { - print "$group\n $view($mode)\n"; - } - else { - $~ = "GROUP_FORMAT"; - format GROUP_FORMAT = -@<<<<<<<<<<<<<<<<<< @*(@*) -$group $view $mode -. - write; - } - } - print "\n"; -} - -sub show_user() { - print <= 20 ) { - print "$user\n $auth $priv $mode $group\n"; - } - else { - $~ = "USER_FORMAT"; - format USER_FORMAT = -@<<<<<<<<<<<<<<<<<< @<<< @<<< @<<< @* -$user $auth $priv $mode $group -. - write; - } - } - print "\n"; -} - -sub show_trap() { - print <= 30 ) { - $~ = "TRAP_BIG_FORMAT"; - format TRAP_BIG_FORMAT = -^* -$trap - @<<<<< @<<<<<<< @<<< @<<< @<<<<< @<<<<<<<<<<<<<<<<<<<<... @* -$port $protocol $auth $priv $type $engineid $user -. - write; - } - else { - $~ = "TRAP_FORMAT"; - format TRAP_FORMAT = -@<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<< @<<<<<<< @<<< @<<< @<<<<< @<<<<<<<<<<<<<<<<<<<<... @* -$trap $port $protocol $auth $priv $type $engineid $user -. - write; - } - } - print "\n"; -} - -sub show_all() { - show_user(); - show_group(); - show_view(); - show_trap(); -} - -sub listNodes { - my $path = shift; - my @nodes = - split( ' ', `cli-shell-api listActiveNodes service snmp v3 $path` ); - return map { substr $_, 1, -1 } @nodes; -} - -sub returnValue { - my $path = shift; - my $value = `cli-shell-api returnActiveValue service snmp v3 $path`; - return $value; -} - -sub isExists { - my $path = shift; - system("cli-shell-api existsActive service snmp v3 $path"); - return !$?; -} - -my $all; -my $view; -my $group; -my $user; -my $trap; - -GetOptions( - "all!" => \$all, - "view!" => \$view, - "group!" => \$group, - "user!" => \$user, - "trap!" => \$trap, -); - -show_all() if ($all); -show_view() if ($view); -show_group() if ($group); -show_user() if ($user); -show_trap() if ($trap); diff --git a/scripts/vyatta-show-snmp.pl b/scripts/vyatta-show-snmp.pl deleted file mode 100755 index 634b3cc..0000000 --- a/scripts/vyatta-show-snmp.pl +++ /dev/null @@ -1,123 +0,0 @@ -#! /usr/bin/perl - -# **** License **** -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# This code was originally developed by Vyatta, Inc. -# Portions created by Vyatta are Copyright (C) 2007 Vyatta, Inc. -# All Rights Reserved. -# -# Author: Stephen Hemminger -# Date: January 2010 -# Description: Script to display SNMP information -# -# **** End License **** -# -use strict; -use warnings; -use Getopt::Long; -use NetAddr::IP; - -my $SNMPDCFG = '/etc/snmp/snmpd.conf'; -my $SNMPSTATUS = '/usr/bin/snmpstatus'; -my $password_file = '/config/snmp/superuser_pass'; - -# generate list of communities in configuration file -sub read_config { - my %community; - - die "Service SNMP does not configured.\n" if (! -e $SNMPDCFG); - - open( my $cfg, '<', $SNMPDCFG ) - or die "Can't open $SNMPDCFG : $!\n"; - - while (<$cfg>) { - chomp; - s/#.*$//; - my @cols = split; - next - unless ( $#cols > 0 - && ( $cols[0] eq 'rocommunity' || $cols[0] eq 'rwcommunity' ) ); - - my $addr = ( $#cols > 1 ) ? $cols[2] : "0.0.0.0/0"; - $community{ $cols[1] } = NetAddr::IP->new($addr); - } - close $cfg; - - return \%community; -} - -# expand list of available communities for allowed: tag -sub show_all { - my $community = read_config(); - - print join( ' ', keys( %{$community} ) ), "\n"; - exit 0; -} - -# check status of any accessible community on localhost -sub status_any { - my $cref = read_config(); - my %community = %{$cref}; - my $localhost = new NetAddr::IP('localhost'); - - if (scalar(%community)) { - foreach my $c ( keys %community ) { - my $addr = $community{$c}; - status( $c, $localhost->addr() ) if ( $addr->contains($localhost) ); - } - } - status_v3(); - -} - -sub status_v3 { - open (my $file, '<' , $password_file) or die "Couldn't open $password_file - $!"; - my $superuser_pass = do { local $/; <$file> }; - close $file; - open ($file, '<', $SNMPDCFG) or die "Couldn't open $SNMPDCFG - $!"; - my $superuser_login = ''; - while (my $line = <$file>) { - if ($line =~ /^iquerySecName (.*)$/) { - $superuser_login = $1; - } - } - close $file; - exec $SNMPSTATUS, '-v3', '-l', 'authNoPriv', '-u', $superuser_login, '-A', $superuser_pass, 'localhost'; -} - -# check status of one community -sub status { - my ( $community, $host ) = @_; - $host = 'localhost' unless defined($host); - - print "Status of SNMP community $community on $host\n"; - exec $SNMPSTATUS, '-v1', '-c', $community, $host; - die "Can't exec $SNMPSTATUS : $!"; -} - -sub usage { - print "usage: $0 [--community=name [--host=hostname]]\n"; - print " $0 --allowed\n"; - exit 1; -} - -my ( $host, $community, $allowed ); - -GetOptions( - "host=s" => \$host, - "community=s" => \$community, - "allowed" => \$allowed, -) or usage(); - -show_all() if ($allowed); -status( $community, $host ) if ( defined($community) ); -status_any(); - -- cgit v1.2.3 From add153b13de56f97624b2dc433fdbe21b36dbeed Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 14 Jun 2018 21:34:32 +0200 Subject: T697: dependency clean up. Moving pciutils, usbutils, lsscsi, bmon, hvinfo to vyos-1x Moving iftop and lsof to the utils package list in vyos-build --- debian/control | 8 -------- 1 file changed, 8 deletions(-) diff --git a/debian/control b/debian/control index bd17cf4..4bff070 100644 --- a/debian/control +++ b/debian/control @@ -10,17 +10,13 @@ Package: vyatta-op Architecture: all Depends: sed (>= 4.1.5), console-terminus, - bmon, - iftop, ethtool, traceroute, ntpdate, procps (>= 1:3.2.7-3), - pciutils, vyatta-cfg (>= 0.16.26), vyatta-cfg-system (>= 0.19.93), vyatta-quagga (>= 0.99.15-26), - lsof, coreutils (>= 5.97-5.3), host, vyatta-bash | bash (>= 4.1), @@ -30,10 +26,6 @@ Depends: sed (>= 4.1.5), at, net-tools, libtimedate-perl, - usbutils, - lsscsi, - hvinfo, - python3-pystache Suggests: util-linux (>= 2.13-5), ncurses-bin (>= 5.5-5), dialog -- cgit v1.2.3