diff options
159 files changed, 469 insertions, 2210 deletions
@@ -26,4 +26,4 @@ libtool /etc/shell/level/users/allowed-op /src/render_xml - +generated-templates/* diff --git a/Makefile.am b/Makefile.am index e736419..0a1f89b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,11 +19,8 @@ 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/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 @@ -32,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 @@ -51,25 +45,22 @@ 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/limericks.py +bin_SCRIPTS += scripts/ssh-server-key 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 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 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 +71,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/ diff --git a/debian/changelog b/debian/changelog index fdd3f31..8755dcc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,48 @@ +vyatta-op (0.14.0+vyos2+current6) unstable; urgency=medium + + * T588: Remove DNS forwarder restart command in favor if XML interface definition + + -- Christian Poessinger <christian@poessinger.com> 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 <christian@poessinger.com> 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 + + -- Christian Poessinger <christian@poessinger.com> 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 + information is removed. + * Added 'show tech-support private' which contains non redacted output + + -- Christian Poessinger <christian@poessinger.com> Sun, 29 Oct 2017 15:36:45 +0100 + +vyatta-op (0.14.0+vyos2+current2) unstable; urgency=medium + + * New implementation of "run show version" + + -- <daniil@baturin.org> Thu, 03 Mar 2016 09:57:48 -0500 + +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 <kim.sidney@gmail.com> Sun, 24 Jan 2016 15:19:11 -0500 + vyatta-op (0.14.0+vyos2+lithium14) unstable; urgency=low * Remove referenced to Vyatta from 'show version' completion help. @@ -15,7 +60,7 @@ vyatta-op (0.14.0+vyos2+lithium13) unstable; urgency=low * vyatta-op: add restart cli command for ssh -- Alex Harpin <development@landsofshadow.co.uk> Sat, 21 Nov 2015 11:30:24 +0000 - + vyatta-op (0.14.0+vyos2+lithium12) unstable; urgency=low [ Thomas Jepp ] diff --git a/debian/control b/debian/control index ac29f08..4bff070 100644 --- a/debian/control +++ b/debian/control @@ -2,24 +2,21 @@ Source: vyatta-op Section: contrib/net Priority: extra Maintainer: VyOS Package Maintainers <maintainers@vyos.net> -Build-Depends: debhelper (>= 5), autotools-dev +Build-Depends: debhelper (>= 5), autotools-dev, autoconf, automake, + cpio Standards-Version: 3.9.1 Package: vyatta-op Architecture: all Depends: sed (>= 4.1.5), - console-setup, console-terminus, - bmon, - iftop, + console-terminus, 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), @@ -29,9 +26,6 @@ Depends: sed (>= 4.1.5), at, net-tools, libtimedate-perl, - usbutils, - lsscsi, - hvinfo Suggests: util-linux (>= 2.13-5), ncurses-bin (>= 5.5-5), dialog diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op index c820305..d917806 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 } @@ -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 @@ -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 diff --git a/etc/default/vyatta.in b/etc/default/vyatta.in index 88940f5..9841dc5 100644 --- a/etc/default/vyatta.in +++ b/etc/default/vyatta.in @@ -26,22 +26,28 @@ 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 @@ -61,8 +67,10 @@ unset _vyatta_extglob 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 @@ -75,8 +83,10 @@ unset _vyatta_extglob 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,18 +141,41 @@ 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 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 || : 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 diff --git a/functions/tech-support b/functions/tech-support index 680dc09..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 @@ -122,84 +122,13 @@ header Number of incomplete entries in ARP table show arp | grep incomplete | wc -l header Bridge -/usr/sbin/brctl show -for br in $(/opt/vyatta/sbin/vyatta-interfaces.pl --show=bridge) +/sbin/brctl show +for br in $(${vyos_completion_dir}/list_interfaces.py --type=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 - -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 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 '<name>.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 '<number>'" >> $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 '<number>'" >> $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 '<pcap-filter>'" >> $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 '<pcap-filter>'" >> $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 '<pcap-filter>'" >> $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 '<pcap-filter>'" >> $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 '<name>.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 '<number>'" >> $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 '<number>'" >> $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 '<pcap-filter>'" >> $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 '<pcap-filter>'" >> $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 '<pcap-filter>'" >> $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 '<pcap-filter>'" >> $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/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/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 <daniil at baturin dot org> -# -# 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, - <baktun>.<katun>.<tun>.<winal>.<kin> - 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/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) = @_; 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-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/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/ssh-server-key b/scripts/ssh-server-key new file mode 100755 index 0000000..949d314 --- /dev/null +++ b/scripts/ssh-server-key @@ -0,0 +1,14 @@ +regen_host_keys () +{ + sudo /bin/rm -v /etc/ssh/ssh_host_* + sudo dpkg-reconfigure openssh-server + sudo /etc/init.d/ssh restart +} + +echo "Do you really want to remove the existing SSH host keys? " +${vyatta_bindir}/yesno + +if [ $? -eq 0 ] +then + regen_host_keys +fi diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl index 52d5198..d3ca5e8 100755 --- a/scripts/vyatta-boot-image.pl +++ b/scripts/vyatta-boot-image.pl @@ -31,14 +31,14 @@ 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'; 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 @@ -102,7 +102,7 @@ sub parseGrubCfg { # old install $ehash{'ver'} = $OLD_IMG_VER_STR; } - if (/console=tty0.*console=ttyS0/) { + if (/console=tty0.*console=ttyS[0-9]/) { $ehash{'term'} = 'serial'; } else { $ehash{'term'} = 'kvm'; @@ -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; @@ -410,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); } @@ -432,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"); } 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/scripts/vyatta-op-dns-forwarding.pl b/scripts/vyatta-op-dns-forwarding.pl deleted file mode 100755 index 5f94c15..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.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 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/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 <<END; - -SNMPv3 Views: - -END - - foreach my $view ( listNodes("view") ) { - print "View : $view\nOIDs :\n"; - foreach my $oid ( listNodes("view $view oid") ) { - my $exclude = ''; - $exclude = ' exclude' - if ( isExists("view $view oid $oid exclude") ); - my $mask = ''; - if ( isExists("view $view oid $oid mask") ) { - my $value = returnValue("view $view oid $oid mask"); - $mask = " mask $value"; - } - print " .$oid$exclude$mask\n"; - } - print "\n"; - } -} - -sub show_group() { - print <<END; - -SNMPv3 Groups: - -Group View ------ ---- -END - - foreach my $group ( listNodes("group") ) { - my $view = returnValue("group $group view"); - my $mode = returnValue("group $group mode"); - if ( length($group) >= 20 ) { - print "$group\n $view($mode)\n"; - } - else { - $~ = "GROUP_FORMAT"; - format GROUP_FORMAT = -@<<<<<<<<<<<<<<<<<< @*(@*) -$group $view $mode -. - write; - } - } - print "\n"; -} - -sub show_user() { - print <<END; - -SNMPv3 Users: - -User Auth Priv Mode Group ----- ---- ---- ---- ----- -END - - foreach my $user ( listNodes("user") ) { - my $auth = returnValue("user $user auth type"); - my $priv = returnValue("user $user privacy type"); - my $mode = returnValue("user $user mode"); - my $group = returnValue("user $user group"); - if ( length($user) >= 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 <<END; - -SNMPv3 Trap-targets: - -Tpap-target Port Protocol Auth Priv Type EngineID User ------------ ---- -------- ---- ---- ---- -------- ---- -END - - foreach my $trap ( listNodes("trap-target") ) { - my $auth = returnValue("trap-target $trap auth type"); - my $priv = returnValue("trap-target $trap privacy type"); - my $type = returnValue("trap-target $trap type"); - my $port = returnValue("trap-target $trap port"); - my $user = returnValue("trap-target $trap user"); - my $protocol = returnValue("trap-target $trap protocol"); - my $engineid = returnValue("trap-target $trap engineid"); - if ( length($trap) >= 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(); - 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/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 <filename>.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 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 <http://www.gnu.org/licenses/>. + +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/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/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 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 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 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]\]" 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* 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 '<HH:MM>' '<MMDDYY>' '<midnight>' '<noon>' -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 '<HH:MM>' '<MMDDYY>' '<midnight>' '<noon>' -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/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[@]} 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/restart/dns/forwarding/node.def b/templates/restart/dns/forwarding/node.def deleted file mode 100644 index 5740ebf..0000000 --- a/templates/restart/dns/forwarding/node.def +++ /dev/null @@ -1,12 +0,0 @@ -help: Restart DNS forwarding - -run: - if cli-shell-api existsActive service dns forwarding; then - echo "Restarting DNS forwarding..." - sudo /opt/vyatta/sbin/vyatta-dns-forwarding.pl --restart-dnsforwarding; - if [[ $? -eq 0 ]]; then - echo "Success!" - fi - else - echo "DNS forwarding is not configured" - 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 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 a1ed782..0000000 --- a/templates/show/bridge/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show bridging information -run: /usr/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 d07958c..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: /usr/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 d20611f..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 '<brN>' ${array[@]##*/} -run: /usr/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 3921867..0000000 --- a/templates/show/bridge/node.tag/spanning-tree/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show bridge spanning tree information -run: /usr/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 a2d55cf..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 - ${vyatta_sbindir}/vyatta-config-gen-sets.pl - 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 }' </proc/partitions - - 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 diff --git a/templates/show/hardware/cpu/detail/node.def b/templates/show/hardware/cpu/detail/node.def deleted file mode 100644 index 2e3c616..0000000 --- a/templates/show/hardware/cpu/detail/node.def +++ /dev/null @@ -1,4 +0,0 @@ -help: Show system CPU details -run: less $_vyatta_less_options \ - --prompt=".cpu info" \ - -- /proc/cpuinfo diff --git a/templates/show/hardware/cpu/node.def b/templates/show/hardware/cpu/node.def deleted file mode 100644 index 653b558..0000000 --- a/templates/show/hardware/cpu/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show CPU info -run: lscpu diff --git a/templates/show/hardware/cpu/summary/node.def b/templates/show/hardware/cpu/summary/node.def deleted file mode 100644 index 6a6582a..0000000 --- a/templates/show/hardware/cpu/summary/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show CPU's on system -run: ${vyatta_bindir}/vyatta-cpu-summary.pl diff --git a/templates/show/hardware/dmi/node.def b/templates/show/hardware/dmi/node.def deleted file mode 100644 index 897c9ec..0000000 --- a/templates/show/hardware/dmi/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show system DMI details -run: ${vyatta_bindir}/vyatta-show-dmi diff --git a/templates/show/hardware/mem/node.def b/templates/show/hardware/mem/node.def deleted file mode 100644 index acf1109..0000000 --- a/templates/show/hardware/mem/node.def +++ /dev/null @@ -1,4 +0,0 @@ -help: Show system RAM details -run: less $_vyatta_less_options \ - --prompt=".mem info" \ - -- /proc/meminfo diff --git a/templates/show/hardware/node.def b/templates/show/hardware/node.def deleted file mode 100644 index e9a8e4d..0000000 --- a/templates/show/hardware/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Show system hardware details diff --git a/templates/show/hardware/pci/detailed/node.def b/templates/show/hardware/pci/detailed/node.def deleted file mode 100644 index b76b487..0000000 --- a/templates/show/hardware/pci/detailed/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show verbose system PCI bus details -run: lspci -vvv diff --git a/templates/show/hardware/pci/node.def b/templates/show/hardware/pci/node.def deleted file mode 100644 index 9b2e890..0000000 --- a/templates/show/hardware/pci/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show system PCI bus details -run: lspci diff --git a/templates/show/hardware/scsi/detail/node.def b/templates/show/hardware/scsi/detail/node.def deleted file mode 100644 index 902b570..0000000 --- a/templates/show/hardware/scsi/detail/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show detailed SCSI device information -run: lsscsi -vvv diff --git a/templates/show/hardware/scsi/node.def b/templates/show/hardware/scsi/node.def deleted file mode 100644 index 54d406a..0000000 --- a/templates/show/hardware/scsi/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show SCSI device information -run: lsscsi diff --git a/templates/show/hardware/usb/detail/node.def b/templates/show/hardware/usb/detail/node.def deleted file mode 100644 index a976d7c..0000000 --- a/templates/show/hardware/usb/detail/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Show detailed USB bus information -run: lsusb -v - diff --git a/templates/show/hardware/usb/node.def b/templates/show/hardware/usb/node.def deleted file mode 100644 index d66f163..0000000 --- a/templates/show/hardware/usb/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show peripherals connected to the USB bus -run: lsusb 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 '<NUMBER>' -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} diff --git a/templates/show/raid/node.def b/templates/show/raid/node.def deleted file mode 100644 index d0ec96d..0000000 --- a/templates/show/raid/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show status of RAID set - diff --git a/templates/show/raid/node.tag/node.def b/templates/show/raid/node.tag/node.def deleted file mode 100644 index ff64da4..0000000 --- a/templates/show/raid/node.tag/node.def +++ /dev/null @@ -1,23 +0,0 @@ -help: RAID set name - -allowed: - local -a raid_sets ; - raid_sets=`cat /proc/partitions | grep md | awk '{ print $4 }'` - echo -n $raid_sets - -run: - raid_set_name=$3 - raid_sets=`cat /proc/partitions | grep md | awk '{ print $4 }'` - valid_set=`echo $raid_sets | grep $raid_set_name` - if [ -z $valid_set ]; then - echo "$raid_set_name is not a RAID set" - else - if [ -r /dev/${raid_set_name} ]; then - # This should work without sudo because we have read - # access to the dev, but for some reason mdadm must be - # run as root in order to succeed. - sudo /sbin/mdadm --detail /dev/${raid_set_name} - else - echo "Must be administrator or root to display RAID status" - fi - fi 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 '<vtunN>' ${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 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 '<hostname> <x.x.x.x>' -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 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 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 '<file> <scp://<user>:<passwd>@<host>/<file>> <ftp://<user>:<passwd>@<host>/<file>>' 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 '<file> <scp://<user>:<passwd>@<host>/<file>> <ftp://<user>:<passwd>@<host>/<file>>' 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 '<file> <scp://<user>:<passwd>@<host>/<file>> <ftp://<user>:<passwd>@<host>/<file>>' +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 '<file> <scp://<user>:<passwd>@<host>/<file>> <ftp://<user>:<passwd>@<host>/<file>>' +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 '<file> <scp://<user>:<passwd>@<host>/<file>> <ftp://<user>:<passwd>@<host>/<file>>' +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 '<file> <scp://<user>:<passwd>@<host>/<file>> <ftp://<user>:<passwd>@<host>/<file>>' +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 '<file> <scp://<user>:<passwd>@<host>/<file>> <ftp://<user>:<passwd>@<host>/<file>>' 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 '<file> <scp://<user>:<passwd>@<host>/<file>> <ftp://<user>:<passwd>@<host>/<file>>' +help: Save compressed tech-support report to the specified path/file (private information removed) +allowed: echo -n '<file> <scp://<user>:<passwd>@<host>/<file>> <ftp://<user>:<passwd>@<host>/<file>>' 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 diff --git a/templates/show/users/node.def b/templates/show/users/node.def deleted file mode 100644 index f7b2e87..0000000 --- a/templates/show/users/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show user information -run: who -H diff --git a/templates/show/users/recent/node.def b/templates/show/users/recent/node.def deleted file mode 100644 index 9199d6d..0000000 --- a/templates/show/users/recent/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show 10 recently logged in users -run: last -aF -n 10 | sed -e "s/^wtmp begins/Displaying logins since/" diff --git a/templates/show/users/recent/node.tag/node.def b/templates/show/users/recent/node.tag/node.def deleted file mode 100644 index a37e6e0..0000000 --- a/templates/show/users/recent/node.tag/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Show specified number of recently logged in users -allowed: echo -n '<NUMBER>' -run: last -aF -n $4 | sed -e "s/^wtmp begins/Displaying logins since/" 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 deleted file mode 100644 index 5b60609..0000000 --- a/templates/show/version/all/node.def +++ /dev/null @@ -1,2 +0,0 @@ -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 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/node.def b/templates/show/version/node.def deleted file mode 100644 index 4237e5d..0000000 --- a/templates/show/version/node.def +++ /dev/null @@ -1,2 +0,0 @@ -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 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 |