David Aldridge
asked on
Running a command remotely using ksh
I want to loop through all of our Solaris servers using ssh and make sure the patch for shellshock has been applied. The check for it is this:
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
if it prints "vulnerable", you need to have the patch applied. The problem is that the special characters in that command break when I run through a list of our servers in a for loop trying to ssh to them. I've tried \ them out, but to no avail.
The loop looks like this:
for i in $serverlist)
do
ssh $i env x='() { :;}; echo vulnerable' bash -c "echo this is a test" |grep vulnerable
if [ $? -eq 0 ]
then
print $i needs patch
fi
done
Any help would be appreciated.
David
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
if it prints "vulnerable", you need to have the patch applied. The problem is that the special characters in that command break when I run through a list of our servers in a for loop trying to ssh to them. I've tried \ them out, but to no avail.
The loop looks like this:
for i in $serverlist)
do
ssh $i env x='() { :;}; echo vulnerable' bash -c "echo this is a test" |grep vulnerable
if [ $? -eq 0 ]
then
print $i needs patch
fi
done
Any help would be appreciated.
David
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER