- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- problem running command on hpux11i
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2018 11:09 PM
01-30-2018 11:09 PM
Hi Guys,
Can anyone help , I need to run a benchmark test for my os hardening with CIS tool . But, the script is written with bash , can someone help ??
./cis-cat-centralized.sh --make-jre-directories
interpreter "/bin/bash" not found
file link resolves to "/usr/bin/bash"
sh: ./cis-cat-centralized.sh: not found.
Attach is the script
#!/bin/bash
#DIR="$(dirname "$0")"
DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
. "$DIR/make-jre-directories.sh"
. "$DIR/detect-os-variant.sh"
. "$DIR/map-to-benchmark.sh"
#
# This script is intended to reside on a centralized file share that is accessible by the computers
# to be assess by CIS-CAT.
#
# The default configuration of this script expects the following target-facing file structure:
#
# /cis
# /cis/cis-cat-full
# ...
# /cis/cis-cat-full/CISCAT.jar
# ...
# /cis/reports
# /cis/jres
# /cis/jres/AIX
# ...
# /cis/jres/AIX/bin/java
# ...
# /cis/jres/Debian
# /cis/jres/HPUX
# /cis/jres/Linux
# /cis/jres/OSX
# /cis/jres/RedHat
# /cis/jres/Solaris
# /cis/jres/SolarisSparc
# /cis/jres/SUSE
#
# Note: cis-cat-centralized.sh --make-jre-directories will create the jres/* directories. However,
# you will need to download and unzip the appropriate JRE into these folders. JREs can be
# obtained from the following URLS:
#
# === IBM AIX ===
# URL:
# http://www.ibm.com/developerworks/java/jdk/aix/service.html
#
# Notes:
# IBM creates a redistributable "latest" JRE .bin. They also have a JRE .tar.
#
# === Linux ===#
# URL: http://java.com/en/download/manual.jsp
#
# Note: This JRE is expected to work for RedHat, Debian, and SUSE.
#
# === Solaris ===#
# URL: http://java.com/en/download/manual.jsp
#
# Notes: one for SPARC and one for X86
#
# === HP-UX ===
# URL: http://h18012.www1.hp.com/java/
# URL: https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPUXJAVAHOME
#
# === Apple OSX ===
# URL: http://support.apple.com/downloads/Java_for_Mac_OS_X_10_5_Update_4
# URL: http://support.apple.com/kb/DL1360
# URL: http://support.apple.com/kb/DL1421
#
#
# When using a CIS-CAT trial/timed version, users MUST set the TIMED value to '1'
#
TIMED='0'
#
# Modify the following three variables to align with target-facing file structure implemented
# in your environment.
#
if [ "$TIMED" -eq "1" ]; then
CISCAT_DIR=/cis/cis-cat-timed
else
CISCAT_DIR=/cis/cis-cat-full
fi
REPORTS_DIR=/cis/reports
JRE_BASE=/cis/jres
#
# There is no need to make modifications below this point unless you want to override the benchmark profile
# CIS-CAT uses. The default configuration of this script will cause CIS-CAT to run the "Level 2" equivalent
# profile, which includes all "Level 1" profile checks.
#
# determine if this execution is setting up jre directories or not.
if [ $1 ]; then
if [ "$1" == "--make-jre-directories" ]; then
make_jre_directories;
exit 1;
fi
fi
SSLF='0'
BENCHMARK='<UnknownBenchmark>'
PROFILE1='<UnknownProfile>'
PROFILE2='<UnknownProfile>'
DISTRO='<UnknownDistribution>'
VER='<UnknownVersion>'
OSV='<UnknownOSVersion>'
ARFORXML='-arf'
# sets DISTRO and VER
detect_os_variant
JAVA_HOME=$JRE_BASE/$DISTRO
# sets BENCHMARK and PROFILE
map_to_benchmark $DISTRO $VER
#
# When using the timed version of CIS-CAT, the benchmarks are stored in the jar,
# so the path to the benchmark needs to indicate the resource path, for example
# /benchmarks/%BENCHMARK%
#
# Timed Version:
# CISCAT_OPTS=" -a -s -x -r $REPORTS_DIR -b /benchmarks/$BENCHMARK "
#
# Full Version:
# CISCAT_OPTS=" -a -s -x -r $REPORTS_DIR -b $CISCAT_DIR/benchmarks/$BENCHMARK "
#
if [ "$TIMED" -eq "1" ]; then
CISCAT_OPTS=" -a -s -x -r $REPORTS_DIR -b /benchmarks/$BENCHMARK "
else
CISCAT_OPTS=" -a -s -x -r $REPORTS_DIR -b $CISCAT_DIR/benchmarks/$BENCHMARK "
fi
CISCAT_CMD="$JAVA_HOME/bin/java -Xmx768M -jar $CISCAT_DIR/CISCAT.jar $CISCAT_OPTS"
echo
echo "Detected OS as $DISTRO $VER"
echo "Using JRE located at '$JAVA_HOME'"
echo "Using CISCAT located at '$CISCAT_DIR/CISCAT.jar'"
echo "Using Benchmark '$BENCHMARK'"
if [ "$SSLF" -eq "1" ]; then
echo "Using Profile '$PROFILE2'"
else
echo "Using Profile '$PROFILE1'"
fi
echo "Storing Reports at '$REPORTS_DIR'"
echo
GOOD=1
if [ ! -d "$CISCAT_DIR" ]; then
echo "ERROR: CISCAT_DIR does not point to a valid directory"
GOOD=0
fi
if [ ! -e "$CISCAT_DIR/CISCAT.jar" ]; then
echo "ERROR: CISCAT.jar does not exist at '$CISCAT_DIR/CISCAT.jar'"
GOOD=0
fi
if [ ! -d "$REPORTS_DIR" ]; then
echo "ERROR: REPORTS_DIR does not point to a valid directory"
GOOD=0
fi
if [ ! -d "$JRE_BASE" ]; then
echo "ERROR: JRE_BASE does not point to a valid directory"
GOOD=0
fi
if [ ! -d "$JAVA_HOME" ]; then
echo "ERROR: JAVA_HOME does not point to a valid directory"
GOOD=0
fi
if [ ! -e "$JAVA_HOME/bin/java" ]; then
echo "ERROR: java does not exist at '$JAVA_HOME/bin/java'"
GOOD=0
fi
if [ "$TIMED" -eq "0" ]; then
if [ ! -e "$CISCAT_DIR/benchmarks/$BENCHMARK" ]; then
echo "ERROR: Benchmark '$BENCHMARK' does not exist in directory '$CISCAT_DIR/benchmarks' "
GOOD=0
fi
fi
if [ "$GOOD" -eq "1" ]; then
echo
echo "Running CISCAT with the following options: "
echo
if [ "$SSLF" -eq "1" ]; then
echo " $CISCAT_OPTS" -p "$PROFILE2"
echo
$CISCAT_CMD -p "$PROFILE2"
else
echo " $CISCAT_OPTS" -p "$PROFILE1"
echo
$CISCAT_CMD -p "$PROFILE1"
fi
else
echo
echo "Please review errors listed above, make corrective actions, and retry."
echo
fi
Pls advice ??? Thanks in advance
Regards
Vincent
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2018 11:13 PM
01-30-2018 11:13 PM
Re: problem running command on hpux11i
Hi Guys,
Below is the make-jre-directories script
#!/bin/bash
make_jre_directories()
{
JRES_DIR=jres
DISTROS='RedHat CentOS SUSE Debian Ubuntu Linux HPUX AIX OSX Solaris'
if [ -e "$JRES_DIR" -a -d "$JRES_DIR" ]; then
echo "Directory '$JRES_DIR' already exists - continuing."
else
mkdir "$JRES_DIR";
if [ $? -eq 1 ]; then
echo "ERROR: Unable to create directory '$JRES_DIR'. Ensure you have write permission on the curr
ent directory.";
exit 1;
else
echo "Created directory '$JRES_DIR'."
fi
fi
for d in $DISTROS; do
if [ -e "$JRES_DIR/$d" ]; then
echo "Directory '$JRES_DIR/$d' already exists - continuing."
continue;
else
mkdir "$JRES_DIR/$d"
if [ $? -eq 1 ]; then
echo "ERROR: Unable to create directory '$JRES_DIR/$d'. Ensure you have write permission
on '$JRES_DIR'.";
exit 1;
else
echo "Created directory '$JRES_DIR/$d'."
fi
fi
done
}
kindly help.
Regards
Vincent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2018 11:33 PM
01-30-2018 11:33 PM
Re: problem running command on hpux11i
You can modify in the script ""/bin/bash" to "/usr/bin/sh"
Regarding error "sh: ./cis-cat-centralized.sh: not found." First check in the "/ " directory whetehr the file "cis-cat-centralized.sh" exists or not and /csi folder exists. If not make sure all the required files specified in script are available.
For this you can run command : " ll /cis " , it checks for "/cis" directory and files under that directory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2018 12:01 AM
01-31-2018 12:01 AM
Re: problem running command on hpux11i
Hi ,
Thanks for the reply, I change the /bin/bash to /bin/sh and result is as below. Please advice?
./cis-cat-centralized.sh --make-jre-directories.sh
./cis-cat-centralized.sh[94]: ==: A test command parameter is not valid.
Detected OS as HPUX U
Using JRE located at '/cis/jres/HPUX'
Using CISCAT located at '/cis/cis-cat-full/CISCAT.jar'
Using Benchmark '<UnknownBenchmark>'
Using Profile '<UnknownProfile>'
Storing Reports at '/cis/reports'
ERROR: REPORTS_DIR does not point to a valid directory
ERROR: JRE_BASE does not point to a valid directory
ERROR: JAVA_HOME does not point to a valid directory
ERROR: java does not exist at '/cis/jres/HPUX/bin/java'
ERROR: Benchmark '<UnknownBenchmark>' does not exist in directory '/cis/cis-cat-full/benchmarks'
Please review errors listed above, make corrective actions, and retry.
Regards
Vincent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2018 01:53 AM
01-31-2018 01:53 AM
SolutionHi,
Below all errors are looking like either required directories are missing and JAVA location what is speciifed in script is not matching. I presume you installed all the required packages in the server eg:Java, other install it and export required paths and run the script again.
ERROR: REPORTS_DIR does not point to a valid directory ---- Check reports directory is available otherwise create one
ERROR: JRE_BASE does not point to a valid directory --- Provide correct path where JRE_BASE is available
ERROR: JAVA_HOME does not point to a valid directory --- Export JAVA_HOME path
ERROR: java does not exist at '/cis/jres/HPUX/bin/java' --- Find the right path where java is installed and change in the scripts
ERROR: Benchmark '<UnknownBenchmark>' does not exist in directory '/cis/cis-cat-full/benchmarks'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2018 07:42 AM - edited 01-31-2018 07:44 AM
01-31-2018 07:42 AM - edited 01-31-2018 07:44 AM
Re: Problem running bash script on HP-UX 11i
Perhaps it would be easiest to just install bash from the porting center?
>./cis-cat-centralized.sh[94]: ==: A test command parameter is not valid.
bash allows the operator "==" in addition to "=". You can change them all to "=" to work with the Posix shell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2018 04:42 PM
01-31-2018 04:42 PM
Re: problem running command on hpux11i
These errors:
ERROR: REPORTS_DIR does not point to a valid directory ---- Check reports directory is available otherwise create one ERROR: JRE_BASE does not point to a valid directory --- Provide correct path where JRE_BASE is available ERROR: JAVA_HOME does not point to a valid directory --- Export JAVA_HOME path ERROR: java does not exist at '/cis/jres/HPUX/bin/java' --- Find the right path where java is installed and change in the scripts ERROR: Benchmark '<UnknownBenchmark>' does not exist in directory '/cis/cis-cat-full/benchmarks'
Seem to be caused by not setting up the prequisites and correct paths. If you have no directory /cis, you'll need to explore the location where you got the above script and obtain the setup procedures for HP-UX before running the script. BASH is available to download from www.software.hp.com.
These comments seem to indicate that setup has not been done yet:
# This script is intended to reside on a centralized file share that is accessible by the computers # to be assess by CIS-CAT. # # The default configuration of this script expects the following target-facing file structure:
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2018 03:32 PM
02-03-2018 03:32 PM
Re: problem running command on hpux11i
> BASH is available to download from www.software.hp.com.
That link doesn't work. Perhaps you meant:
https://h20392.www2.hpe.com/portal/swdepot/index.do
But I don't find bash anywhere except for Linux.
Perhaps you meant the porting center?
http://hpux.connect.org.uk/hppd/cgi-bin/search?term=bash&Search=Search
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2018 04:01 PM
02-03-2018 04:01 PM
Re: problem running command on hpux11i
> > BASH is available to download from www.software.hp.com.
> That link doesn't work.
Oops, this works: software.hp.com
However, BASH seems to have disappeared from the Internet Express bundles.
So the porting center link is correct.
Bill Hassell, sysadmin