]> git.ipfire.org Git - thirdparty/strongswan.git/blame - testing/ssh
github: Use tpm2-tss 3.2.3 for tests
[thirdparty/strongswan.git] / testing / ssh
CommitLineData
9a70fe84
TB
1#!/bin/bash
2
3DIR=$(dirname `readlink -f $0`)
4. $DIR/testing.conf
b5f3c1f7 5SSHCONF="-F $DIR/ssh_config"
9a70fe84
TB
6
7if [ $# == 0 ]
8then
9 echo "$0 <host>"
10 exit 1
11fi
12
13host=$1
45ee7c94
TB
14echo "$host" | grep -q "^\([0-9]\+\.\|[0-9a-fA-F]\+:\).*"
15if [ $? -eq 0 ]
9a70fe84 16then
45ee7c94
TB
17 # assume we got an ip address
18 ip=$host
19else
eeb02936
TB
20 pos='$1'
21 echo "$host" | grep -q ".*1$"
22 if [ $? -eq 0 ]
23 then
24 # {host}1, use second address
25 pos='$2'
26 host=`echo "$host" | sed -n -e "s/1$//p"`
27 fi
28 ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, "{ print ${pos} }" | awk '{ print $1 }'`"
45ee7c94
TB
29 if [ -z $ip ]
30 then
31 echo "Host '$host' unknown"
32 exit 1
33 fi
9a70fe84
TB
34fi
35
50574556
TB
36shift
37exec ssh $SSHCONF -q root@$ip $@