diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-05-18 13:46:45 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-05-18 13:46:45 +0200 |
commit | f3d0995e9078c0b6a99793a90ce6671afc756ee1 (patch) | |
tree | 14b0e32d5526231ca04055dea50b1e128e59d591 /lib | |
parent | f9553f3e2b7f21080ce7974909e92d251aaae528 (diff) |
CPANization
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/ssh-forcecommand | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/lib/ssh-forcecommand b/lib/ssh-forcecommand deleted file mode 100755 index 6352b13..0000000 --- a/lib/ssh-forcecommand +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env perl -# Copyright © 2010,2011 by Daniel Friesel <derf@finalrewind.org> -# License: WTFPL: -# 0. You just DO WHAT THE FUCK YOU WANT TO. -# -# SSH forcecommand to be used for nagios ssh checks etc. -# Example line for ssh authorized_keys file: -# command="/usr/local/lib/ssh-forcecommand /etc/forcecommand/backup.cfg",no-agent-forwarding,no-port-forwarding,no-pty,no-X11-forwarding $key -# -# Configfile format: -# ssh_command = real_command -# Example: -# home = tar -C / -cf - home - -use strict; -use warnings; - -my $conffile = shift or die("Usage: $0 <configfile>\n"); -my %commands; -my $input = $ENV{'SSH_ORIGINAL_COMMAND'} or die("No command\n");; - -open(my $conf, '<', $conffile) or die("Can't open $conffile: $!\n"); - -while (my $line = <$conf>) { - my ($key, $value) = ($line =~ m{ ^ ([^=]+?) \s* = \s* (.+) $ }x); - if ($key and $value) { - $commands{$key} = $value; - } -} -close($conf) or die("Cannot close $conffile: $!\n"); - -if (exists $commands{$input}) { - exec($commands{$input}); - exit 1; -} - -die("Unknown command\n"); |