diff options
28 files changed, 0 insertions, 242 deletions
diff --git a/Makefile.am b/Makefile.am index 3d01190..476254b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,10 +25,8 @@ bin_SCRIPTS += scripts/vyatta-show-bonding.pl bin_SCRIPTS += scripts/vyatta-cpu-summary.pl bin_SCRIPTS += scripts/yesno bin_SCRIPTS += scripts/vyatta-gettime.pl -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/rename-image.pl bin_SCRIPTS += scripts/show-image-storage.pl bin_SCRIPTS += scripts/vyatta-remote-copy.pl @@ -43,7 +41,6 @@ bin_SCRIPTS += scripts/vyatta-monitor-cleanup bin_SCRIPTS += scripts/vyatta-monitor-background 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/ssh-server-key diff --git a/scripts/show-users.pl b/scripts/show-users.pl deleted file mode 100755 index 321fbcb..0000000 --- a/scripts/show-users.pl +++ /dev/null @@ -1,129 +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: Sept 2009 -# Description: Show password accounts -# -# **** End License **** - -use lib "/opt/vyatta/share/perl5"; -use Vyatta::Config; -use IO::Seekable; - -use strict; -use warnings; - -sub usage { - print "Usage: $0 {type}\n"; - print " type := all | vyatta | locked | other | color\n"; - exit 1; -} - -use constant { - VYATTA => 0x1, - OTHER => 0x2, - LOCKED => 0x4, -}; - -my %filters = ( - 'vyatta' => VYATTA, - 'other' => OTHER, - 'locked' => OTHER|LOCKED, - 'all' => VYATTA|OTHER|LOCKED, -); - -my $filter = 0; -for (@ARGV) { - my $mask = $filters{$_}; - unless ($mask) { - warn "Unknown type $_\n"; - usage(); - } - $filter |= $mask; -} -# Default is everything but locked accounts -$filter |= VYATTA|OTHER if ($filter == 0); - -# Read list of Vyatta users -my $cfg = new Vyatta::Config; -$cfg->setLevel('system login user'); -my %vuser = map { $_ => 1 } $cfg->listOrigNodes(); - -# Setup to access lastlog -open (my $lastlog, '<', "/var/log/lastlog") - or die "can't open /var/log/lastlog:$!"; -# Magic values based on binary format of last log -# See /usr/include/bits/utm.h -my $typedef = 'L Z32 Z256'; -my $reclen = length(pack($typedef)); - -sub lastlog { - my $uid = shift; - - sysseek($lastlog, $uid * $reclen, SEEK_SET) - or die "seek failed: $!"; - - my ($rec, $line, $host, $time); - if (sysread($lastlog, $rec, $reclen) == $reclen) { - my ($time, $line, $host) = unpack($typedef, $rec); - return scalar(localtime($time)), $line, $host - if ($time != 0); - } - - return ("never logged in", "", ""); -} - - -# Walk password file -# Note: this only works as root -my %users; -setpwent(); -while ( my ($u, $p, $uid) = getpwent()) { - my $l = length($p); - my $status; - my $flag = 0; - - my $type = defined($vuser{$u}) ? 'vyatta' : 'other'; - if ($type eq 'vyatta') { - $flag |= VYATTA; - } elsif ($l != 1) { - $flag |= OTHER; - } - - # only works as root, otherwise shadow file is inaccessible - if ($l == 0) { - $type .= '!'; - } if ($l == 1) { - $flag |= LOCKED; - $type .= '-'; - } - - next if (($flag & $filter) == 0); - - my ($time, $line, $host) = lastlog($uid); - # fields to printf - $users{$u} = [ $type, $line, $host, $time ]; -} -endpwent(); -close $lastlog; - -my $fmt = "%-15s %-7s %-8s %-19s %s\n"; -printf $fmt, "Username","Type","Tty", "From","Last login"; - -foreach my $u (sort keys %users) { - printf $fmt, $u, @{$users{$u}}; -} diff --git a/scripts/vyatta-sudo b/scripts/vyatta-sudo deleted file mode 100755 index bb95ae5..0000000 --- a/scripts/vyatta-sudo +++ /dev/null @@ -1,21 +0,0 @@ -#! /usr/bin/perl -# - -# Look if user is in sudo group -use strict; -use warnings; - -sub isadmin { - my $gid = getgrnam("sudo"); - return unless $gid; - - # is $gid in list of current groups - return grep { $_ eq $gid } split / /, $(; -} - -die "Missing command arguement\n" unless @ARGV; - -exec ('sudo', @ARGV ) if (isadmin()); - -print "This account is not authorized to run this command\n"; -exit 1; diff --git a/scripts/vyos-show-ram.sh b/scripts/vyos-show-ram.sh deleted file mode 100644 index 11ead79..0000000 --- a/scripts/vyos-show-ram.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# -# Module: vyos-show-ram.sh -# Displays memory usage information in minimalistic format -# -# Copyright (C) 2013 SO3Group -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -MB_DIVISOR=1024 - -TOTAL=$(cat /proc/meminfo | grep -E "^MemTotal:" | awk -F ' ' '{print $2}') -FREE=$(cat /proc/meminfo | grep -E "^MemFree:" | awk -F ' ' '{print $2}') -BUFFERS=$(cat /proc/meminfo | grep -E "^Buffers:" | awk -F ' ' '{print $2}') -CACHED=$(cat /proc/meminfo | grep -E "^Cached:" | awk -F ' ' '{print $2}') - -DISPLAY_FREE=$(( ($FREE + $BUFFERS + $CACHED) / $MB_DIVISOR )) -DISPLAY_TOTAL=$(( $TOTAL / $MB_DIVISOR )) -DISPLAY_USED=$(( $DISPLAY_TOTAL - $DISPLAY_FREE )) - -echo "Total: $DISPLAY_TOTAL" -echo "Free: $DISPLAY_FREE" -echo "Used: $DISPLAY_USED" - diff --git a/templates/show/system/boot-messages/all/node.def b/templates/show/system/boot-messages/all/node.def deleted file mode 100644 index b792d0a..0000000 --- a/templates/show/system/boot-messages/all/node.def +++ /dev/null @@ -1,7 +0,0 @@ -help: Show all kernel boot messages -run: LESSOPEN="|/usr/bin/lesspipe %s" LESSCLOSE="/usr/bin/lesspipe %s %s" \ - less $_vyatta_less_options \ - --prompt=".boot-messages?m, file %i of %m., page %dt of %D" \ - -- $(printf "%s\n" /var/log/dmesg* | sort -nr | while read; do \ - if [[ "$(head -n 1 $REPLY)" != "(Nothing has been logged yet.)" ]]; then \ - echo $REPLY; fi; done) diff --git a/templates/show/system/boot-messages/node.def b/templates/show/system/boot-messages/node.def deleted file mode 100644 index 97bbb61..0000000 --- a/templates/show/system/boot-messages/node.def +++ /dev/null @@ -1,4 +0,0 @@ -help: Show most recent kernel boot messages -run: less $_vyatta_less_options \ - --prompt=".boot-messages, page %dt of %D" \ - -- /var/log/dmesg diff --git a/templates/show/system/connections/node.def b/templates/show/system/connections/node.def deleted file mode 100644 index 43da826..0000000 --- a/templates/show/system/connections/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show active network connections on the system -run: netstat -an diff --git a/templates/show/system/connections/tcp/all/node.def b/templates/show/system/connections/tcp/all/node.def deleted file mode 100644 index 52c3893..0000000 --- a/templates/show/system/connections/tcp/all/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: show all TCP connections -run: ss -t -a diff --git a/templates/show/system/connections/tcp/node.def b/templates/show/system/connections/tcp/node.def deleted file mode 100644 index 07d04a6..0000000 --- a/templates/show/system/connections/tcp/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: show TCP connection information -run: ss -t -r diff --git a/templates/show/system/connections/tcp/numeric/node.def b/templates/show/system/connections/tcp/numeric/node.def deleted file mode 100644 index 35a13fe..0000000 --- a/templates/show/system/connections/tcp/numeric/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: show TCP connection without resolving names -run: ss -t -n diff --git a/templates/show/system/connections/udp/node.def b/templates/show/system/connections/udp/node.def deleted file mode 100644 index 29e7548..0000000 --- a/templates/show/system/connections/udp/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: show UDP socket information -run: ss -u -a -r diff --git a/templates/show/system/connections/udp/numeric/node.def b/templates/show/system/connections/udp/numeric/node.def deleted file mode 100644 index 6eae466..0000000 --- a/templates/show/system/connections/udp/numeric/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: show UDP socket information without resolving names -run: ss -u -a -n diff --git a/templates/show/system/kernel-messages/node.def b/templates/show/system/kernel-messages/node.def deleted file mode 100644 index 9a9229b..0000000 --- a/templates/show/system/kernel-messages/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show messages in kernel ring buffer -run: sudo dmesg diff --git a/templates/show/system/login/node.def b/templates/show/system/login/node.def deleted file mode 100644 index 0969ccf..0000000 --- a/templates/show/system/login/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Show user accounts diff --git a/templates/show/system/login/users/all/node.def b/templates/show/system/login/users/all/node.def deleted file mode 100644 index 519e442..0000000 --- a/templates/show/system/login/users/all/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show information about all accounts -run: /opt/vyatta/bin/show-users.pl all diff --git a/templates/show/system/login/users/locked/node.def b/templates/show/system/login/users/locked/node.def deleted file mode 100644 index 354c204..0000000 --- a/templates/show/system/login/users/locked/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show information about locked accounts -run: ${vyatta_bindir}/vyatta-sudo /opt/vyatta/bin/show-users.pl locked diff --git a/templates/show/system/login/users/node.def b/templates/show/system/login/users/node.def deleted file mode 100644 index 5943122..0000000 --- a/templates/show/system/login/users/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show user account information -run: ${vyatta_bindir}/vyatta-sudo /opt/vyatta/bin/show-users.pl diff --git a/templates/show/system/login/users/other/node.def b/templates/show/system/login/users/other/node.def deleted file mode 100644 index 1942004..0000000 --- a/templates/show/system/login/users/other/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show information about non VyOS user accounts -run: ${vyatta_bindir}/vyatta-sudo /opt/vyatta/bin/show-users.pl other diff --git a/templates/show/system/login/users/vyos/node.def b/templates/show/system/login/users/vyos/node.def deleted file mode 100644 index 6583315..0000000 --- a/templates/show/system/login/users/vyos/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show information about VyOS user accounts -run: /opt/vyatta/bin/show-users.pl vyatta diff --git a/templates/show/system/memory/cache/node.def b/templates/show/system/memory/cache/node.def deleted file mode 100644 index e8e00e4..0000000 --- a/templates/show/system/memory/cache/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show kernel cache information -run: sudo slabtop -o diff --git a/templates/show/system/memory/detail/node.def b/templates/show/system/memory/detail/node.def deleted file mode 100644 index 04e98c5..0000000 --- a/templates/show/system/memory/detail/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Report detailed system memory usage -run: cat /proc/meminfo diff --git a/templates/show/system/memory/node.def b/templates/show/system/memory/node.def deleted file mode 100644 index 4725a47..0000000 --- a/templates/show/system/memory/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Display system memory usage -run: ${vyatta_bindir}/vyos-show-ram.sh diff --git a/templates/show/system/processes/extensive/node.def b/templates/show/system/processes/extensive/node.def deleted file mode 100644 index d737c21..0000000 --- a/templates/show/system/processes/extensive/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show extensive process info -run: top -b -n1 diff --git a/templates/show/system/processes/node.def b/templates/show/system/processes/node.def deleted file mode 100644 index b971827..0000000 --- a/templates/show/system/processes/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show system processes -run: ps ax diff --git a/templates/show/system/processes/summary/node.def b/templates/show/system/processes/summary/node.def deleted file mode 100644 index 0430cd0..0000000 --- a/templates/show/system/processes/summary/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show summary of system processes -run: uptime diff --git a/templates/show/system/processes/tree/node.def b/templates/show/system/processes/tree/node.def deleted file mode 100644 index b3044fc..0000000 --- a/templates/show/system/processes/tree/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show process tree -run: ps -ejH diff --git a/templates/show/system/storage/node.def b/templates/show/system/storage/node.def deleted file mode 100644 index 8a7bb6b..0000000 --- a/templates/show/system/storage/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Show filesystem usage -run: df -h -x squashfs diff --git a/templates/show/system/uptime/node.def b/templates/show/system/uptime/node.def deleted file mode 100644 index 92611fb..0000000 --- a/templates/show/system/uptime/node.def +++ /dev/null @@ -1,3 +0,0 @@ -help: Show how long the system has been up -run: uptime - |