2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-21 10:40:24 +00:00

able to run no random bytes if /usr/bin/nice is not available

This commit is contained in:
cxhong
2020-10-09 15:19:27 -04:00
parent 6013ccd5a1
commit 2878022b95
4 changed files with 18 additions and 27 deletions

View File

@@ -129,11 +129,11 @@ xCATCmd () {
# $1 is the xCAT server
# $2 is the command
if [ -f "/usr/bin/nice" ]; then
NICE="/usr/bin/nice"
RANDOMBYTES="-rand /usr/bin/nice"
else
NICE="/bin/nice"
RANDOMBYTES=""
fi
echo "<xcatrequest>\n<command>${2}</command>\n</xcatrequest>" | /usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -quiet -no_ssl3 $(/usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -help 2>&1 | grep -m 1 -o -- -no_ssl2) -connect ${1} -rand ${NICE} 2>/dev/null
echo "<xcatrequest>\n<command>${2}</command>\n</xcatrequest>" | /usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -quiet -no_ssl3 $(/usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -help 2>&1 | grep -m 1 -o -- -no_ssl2) -connect ${1} ${RANDOMBYTES} 2>/dev/null
}

View File

@@ -1,12 +1,9 @@
#!/usr/bin/awk -f
BEGIN {
if (!system("test -f /bin/nice")) {
nice = "/bin/nice"
} else if (!system("test -f /usr/bin/nice")) {
nice = "/usr/bin/nice"
if (!system("test -f /usr/bin/nice")) {
randombytes = "-rand /usr/bin/nice"
} else {
print "Error: nice utility missing"
exit 1
randombytes = ""
}
if (!system("test -f openssl")) {
print "Error: openssl utility missing"
@@ -14,9 +11,9 @@ BEGIN {
}
if ((ENVIRON["USEOPENSSLFORXCAT"]) || (ENVIRON["AIX"])) {
server = "openssl s_client -quiet -no_ssl3 -connect " ENVIRON["XCATSERVER"] " -rand "nice" 2> /dev/null"
server = "openssl s_client -quiet -no_ssl3 -connect " ENVIRON["XCATSERVER"] " "randombytes" 2> /dev/null"
if (!system("openssl s_client -help 2>&1 | grep -m 1 -q -- -no_ssl2")) {
server = "openssl s_client -quiet -no_ssl3 -no_ssl2 -connect " ENVIRON["XCATSERVER"] " -rand "nice" 2> /dev/null"
server = "openssl s_client -quiet -no_ssl3 -no_ssl2 -connect " ENVIRON["XCATSERVER"] " "randombytes" 2> /dev/null"
}
} else {
server = "/inet/tcp/0/127.0.0.1/400"

View File

@@ -1,12 +1,9 @@
#!/usr/bin/awk -f
BEGIN {
if (!system("test -f /bin/nice")) {
nice = "/bin/nice"
} else if (!system("test -f /usr/bin/nice")) {
nice = "/usr/bin/nice"
if (!system("test -f /usr/bin/nice")) {
randombytes = "-rand /usr/bin/nice"
} else {
print "Error: nice utility missing"
exit 1
randombytes = ""
}
if (!system("test -f openssl")) {
print "Error: openssl utility missing"
@@ -14,9 +11,9 @@ BEGIN {
}
if (ENVIRON["USEOPENSSLFORXCAT"]) {
server = "openssl s_client -no_ssl3 -connect " ENVIRON["XCATSERVER"] " -rand "nice" 2> /dev/null"
server = "openssl s_client -no_ssl3 -connect " ENVIRON["XCATSERVER"] " "randombytes" 2> /dev/null"
if (!system("openssl s_client -help 2>&1 | grep -m 1 -q -- -no_ssl2")) {
server = "openssl s_client -no_ssl3 -no_ssl2 -connect " ENVIRON["XCATSERVER"] " -rand "nice" 2> /dev/null"
server = "openssl s_client -no_ssl3 -no_ssl2 -connect " ENVIRON["XCATSERVER"] " "randombytes" 2> /dev/null"
}
} else {
server = "/inet/tcp/0/127.0.0.1/400"

View File

@@ -1,12 +1,9 @@
#!/usr/bin/awk -f
BEGIN {
if (!system("test -f /bin/nice")) {
nice = "/bin/nice"
} else if (!system("test -f /usr/bin/nice")) {
nice = "/usr/bin/nice"
if (!system("test -f /usr/bin/nice")) {
randombytes = "-rand /usr/bin/nice"
} else {
print "Error: nice utility missing"
exit 1
randombytes = ""
}
if (!system("test -f openssl")) {
print "Error: openssl utility missing"
@@ -14,9 +11,9 @@ BEGIN {
}
if (ENVIRON["USEOPENSSLFORXCAT"]) {
server = "openssl s_client -no_ssl3 -connect " ENVIRON["XCATSERVER"] " -rand "nice" 2> /dev/null"
server = "openssl s_client -no_ssl3 -connect " ENVIRON["XCATSERVER"] " "randombytes" 2> /dev/null"
if (!system("openssl s_client -help 2>&1 | grep -m 1 -q -- -no_ssl2")) {
server = "openssl s_client -no_ssl3 -no_ssl2 -connect " ENVIRON["XCATSERVER"] " -rand "nice 2> /dev/null"
server = "openssl s_client -no_ssl3 -no_ssl2 -connect " ENVIRON["XCATSERVER"] " "randombytes" 2> /dev/null"
}
} else {
server = "/inet/tcp/0/127.0.0.1/400"