Bad substitution

Cant undestand :slight_smile: why i have an error on line 2.it is working on my other boxes

#!/bin/bash
ret=$(echo Q | timeout 5 openssl s_client connect "${1`hostname`}:${2-443}" -ssl3 2> /dev/null)
if echo "${ret}" | grep -q 'Protocol.*SSLv3'; then
 if echo "${ret}" | grep -q 'Cipher.*0000'; then
   echo "SSL 3.0 disabled"
 else
   echo "SSL 3.0 enabled"
fi
else
 echo "SSL disabled or other error"
fi
~
~


error at line 2

ssh a2.BLAHBLAH.com 'bash -s' < poodleCheck.sh
sh: line 2: ${1`hostname`}:${2-443}: bad substitution
SSL disabled or other error

Try backticks `...` instead of $(...)

ret =`echo Q | timeout 5 openssl s_client connect "${1`hostname`}:${2-443}" -ssl3 2> /dev/null`

not working :slight_smile: weird hehehehe

Can you tell us what you intend here... ${1`hostname`} and here ${2-443}

Maybe?

ret=$(echo Q | timeout 5 openssl s_client connect "${1-`hostname`}:${2-443}" -ssl3 2> /dev/null)

No..not working though..its really crazy it is working in my other box

you invoke bash but the error says sh.

did you replace bash with sh?

if you have access to the webserver from your local box you can just run poodle checker using the other machine as the argument:

./poodleCheck a2.blahblah.com

But Aia's solution is correct. You are missing a - after 1

If your not passing parameters to the script just put your hostname and SSL port directly into the openssl command:

so assuming your host is called KENS-HOST and your wanting to check port 443 (standard SSL port) just use:

ret=$(echo Q | timeout 5 openssl s_client connect KENS-HOST:443 -ssl3)

Note I also took out the 2> /dev/null so it dosn't hide any errors (like command openssl not found).

If your still having trouble why not check the machine from one of the other you said works (you can put the machine name to check on the command line of the script you posted like poodleCheck.sh KENS-HOST ).

EDIT: I also didn't see the missing - after 1 (Just seeing what I expected to see I guess)