# TSTssh.def: Tests Remote Connectivity and Operations # $Id: TSTssh.def,v 1.9 2008/02/25 17:32:56 mschenke Exp $ # ARCS: $Header: /home/cvs/repository/RDA_4/src/scripting/lib/modules/TSTssh.def,v 1.9 2008/02/25 17:32:56 mschenke Exp $ # # Change History # 20080225 MSC Change the copyright notice. =head1 NAME TSTssh - Tests Remote Connectivity and Associated Operations =head1 DESCRIPTION Executes several tests to check remote connectivity and operations: =cut echo tput('bold'),'Processing remote operation test module ...',tput('off') # Define macros macro chk_env {var ($key,$flg) = @arg if getEnv($key,$flg) {import $TTL echo $TTL,' ',$key,'=',last var $TTL = undef } } macro chk_ident {echo "\012Agent identities:" loop $lin (command('ssh-add -l')) echo $lin } =pod - Tests which commands are available from the PATH. =cut echo "\012Command Availability:" loop $cmd ('rcp','remsh','rsh','scp','ssh','ssh-add','ssh-agent') echo sprintf(' %-12s %s',$cmd,nvl(findCommand($cmd),'(Not found)')) =pod - Lists related files. =cut var $TTL = "\012Related files:\012" var $hom = getEnv('HOME') loop $fil ('/etc/hosts.equiv',\ grepDir('/etc/ssh','.','npr'),\ grepDir(getEnv('HOME'),'^\.[rs]hosts$','inp'),\ grepDir(catDir(getEnv('HOME'),'.ssh'),'.','npr')) {next !testFile('f',$fil) echo $TTL,' ',$fil var $TTL = undef } =pod - Tests if an authentication agent is configured. When possible, it checks if identities have been added. =cut var $TTL = "\012Check if an authentication agent is running\012" call chk_env('SSH_AGENT_PID') call chk_env('SSH_AUTH_SOCK') var $agt = $TTL if !$agt call chk_ident() =pod - Lists default remote operation settings defined. =cut var $TTL = "\012Predefined remote operation settings:\012" loop $key (grepSetting('^REMOTE_.*(SSH|SCP)','n')) {var $set{$key} = getSetting($key) echo $TTL,' ',$key,'=',last var $TTL = undef } =pod - Lists common settings modified by the remote operation initialization. =cut call initRemote() var $TTL = "\012Settings modified by the remote operation initialisation:\012" loop $key (grepSetting('^REMOTE_(SSH|SCP)','n')) {var $val = getSetting($key) next compare('eq',$val,$set{$key}) echo $TTL,' ',$key,'=',$val var $TTL = undef } =pod - Checks if an authentication agent has been started. When possible, lists agent identities. =cut if $agt {var $TTL = "\012Check if an authentication agent has been started\012" call chk_env('SSH_AGENT_PID',true) call chk_env('SSH_AUTH_SOCK',true) if !$TTL call chk_ident() } =pod - Tests a remote command execution with different settings. =cut var $sep = repeat('-',getSetting('RDA_COLUMNS',78)) echo echo $sep echo 'Test a remote command' echo $sep if !getSetting('REMOTE_TST_HOSTNAME') call requestSetting('TSTssh') call setRemoteTrace(setDebug()) var $rem = getSetting('REMOTE_TST_COMMAND','env') echo "\012Check remote command execution with default settings" echo 'Exit code: ',rexec('TST',$rem,true) var %tb_cmd = ('REMSH','remsh',\ 'RSH', 'rsh',\ 'SSH', 'ssh',\ 'SSH0', 'ssh') var %tb_dsc = ('REMSH','REMSH',\ 'RSH', 'RSH',\ 'SSH', 'SSH',\ 'SSH0', 'SSH (no timeout)') var %tb_opt = ('REMSH','',\ 'RSH', '',\ 'SSH', '-Cnq -o ConnectTimeout=30',\ 'SSH0', '-Cnq') loop $typ ('SSH','SSH0','RSH','REMSH') {if findCommand($tb_cmd{$typ}) {call setTempSetting('REMOTE_TST_SSH_COMMAND',last) call setTempSetting('REMOTE_TST_SSH_OPTIONS',$tb_opt{$typ}) call setTempSetting('REMOTE_TST_PREFIX',$typ) echo "\012Check remote command execution using ",$tb_dsc{$typ} echo 'Exit code: ',rexec('TST',$rem,true) } } =head1 COPYRIGHT NOTICE Copyright (c) 2002-2008, Oracle. All rights reserved. =head1 TRADEMARK NOTICE Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. =cut