Get iDRAC working with version 5.

Signed-off-by: Nathan Cerny <ncerny@gmail.com>
This commit is contained in:
Nathan Cerny 2018-07-23 11:54:01 -05:00
parent 23d8947d34
commit c64b85d334
4 changed files with 56 additions and 38 deletions

View File

@ -1,7 +1,9 @@
FROM jlesage/baseimage-gui:alpine-3.7
ENV APP_NAME="iDRAC 6"
ENV APP_NAME="iDRAC"
RUN apk add --no-cache curl
RUN apk add --no-cache wget
RUN apk add --no-cache openjdk7-jre
RUN mkdir /app && \

View File

@ -1,4 +1,4 @@
# iDRAC 6 dockerized
# iDRAC 5 and 6 dockerized
![Web interface](https://i.imgur.com/Au9DPmg.png)
*Web interface*
@ -8,15 +8,15 @@
## About
Allows access to the iDRAC 6 console without installing Java or messing with Java Web Start. Java is only run inside of the container and access is provided via web interface or directly with VNC.
Allows access to the iDRAC console without installing Java or messing with Java Web Start. Java is only run inside of the container and access is provided via web interface or directly with VNC.
Container is based on [baseimage-gui](https://github.com/jlesage/docker-baseimage-gui) by [jlesage](https://github.com/jlesage)
Container is based on [docker-idrac6](https://github.com/DomiStyle/docker-idrac6) by [DomiStyle](https://github.com/DomiStyle) which in turn is based on [baseimage-gui](https://github.com/jlesage/docker-baseimage-gui) by [jlesage](https://github.com/jlesage)
# Usage
See the docker-compose [here](https://github.com/DomiStyle/docker-idrac6/blob/master/docker-compose.yml) or use this command:
See the docker-compose [here](https://github.com/ncerny/docker-idrac/blob/master/docker-compose.yml) or use this command:
docker run -d -p 5800:5800 -p 5900:5900 -e IDRAC_HOST=idrac1.example.org -e IDRAC_USER=root -e IDRAC_PASSWORD=1234 domistyle/idrac6
docker run -d -p 5800:5800 -p 5900:5900 -e IDRAC_HOST=idrac1.example.org -e IDRAC_USER=root -e IDRAC_PASSWORD=1234 ncerny/idrac
The web interface will be available on port 5800 while the VNC server can be accessed on 5900. Startup might take a few seconds while the Java libraries are downloaded. You can add a volume on /app if you would like to cache them.

View File

@ -2,7 +2,7 @@ version: '2'
services:
idrac1:
image: domistyle/idrac6
image: ncerny/idrac
restart: always
ports:
- 5800:5800
@ -12,7 +12,7 @@ services:
- IDRAC_USER=root
- IDRAC_PASSWORD=1234
idrac2:
image: domistyle/idrac6
image: ncerny/idrac
restart: always
ports:
- 5801:5800

View File

@ -3,6 +3,24 @@
RED='\033[0;31m'
NC='\033[0m'
download() {
jar=$1
path=$2
if [ ! -f "${path}/${jar}" ]; then
if [ "${IDRAC_VERSION}" -eq 5 ]; then
URI="Java/release"
elif [ "${IDRAC_VERSION}" -eq 6 ]; then
URI="software"
fi
wget --load-cookies=cookies -O "${path}/${jar}" https://${IDRAC_HOST}/${URI}/${jar} --no-check-certificate
if [ ! $? -eq 0 ]; then
echo -e "${RED}Failed to download ${jar}, please check your settings${NC}"
sleep 2
exit 2
fi
fi
}
echo "Starting"
if [ -z "${IDRAC_HOST}" ]; then
@ -30,36 +48,34 @@ echo "Creating library folder"
cd /app
mkdir lib
echo "Downloading required files"
touch cookies
if [ ! -f avctKVM.jar ]; then
wget https://${IDRAC_HOST}/software/avctKVM.jar --no-check-certificate
if ( curl -k -y 1 --head https://${IDRAC_HOST}/page/login.html | grep '200 OK' > /dev/null ); then
IDRAC_VERSION=5
echo "iDRAC version 5 detected"
COOKIE=$(curl -k --data "WEBVAR_USERNAME=${IDRAC_USER}&WEBVAR_PASSWORD=${IDRAC_PASSWORD}" https://${IDRAC_HOST}/rpc/WEBSES/create.asp 2> /dev/null | grep SESSION_COOKIE | cut -d\' -f 4)
echo "Cookie=SessionCookie=${COOKIE}" > cookies
if [ ! $? -eq 0 ]; then
echo -e "${RED}Failed to download avctKVM.jar, please check your settings${NC}"
sleep 2
exit 2
fi
echo "Downloading required files"
download JViewer.jar .
download Win64.jar lib
download Win32.jar lib
download Linux_x86_32.jar lib
download Linux_x86_64.jar lib
download Mac32.jar lib
args=$(curl -k --cookie Cookie=SessionCookie=${COOKIE} https://${IDRAC_HOST}/Java/jviewer.jnlp | awk -F '[<>]' '/argument/ { print $3 }')
exec java -Djava.library.path="lib" -jar JViewer.jar $args
elif ( curl -k -y 1 --head https://${IDRAC_HOST}/images/Ttl_2_iDRAC6_Ent_ML.png | grep '200 OK' > /dev/null ); then
IDRAC_VERSION=6
echo "iDRAC version 6 detected"
echo "Downloading required files"
download avctKVM.jar .
download avctKVMIOLinux64.jar lib
download avctVMLinux64.jar lib
exec java -cp avctKVM.jar -Djava.library.path="lib" com.avocent.idrac.kvm.Main ip=${IDRAC_HOST} kmport=5900 vport=5900 user=${IDRAC_USER} passwd=${IDRAC_PASSWORD} apcp=1 version=2 vmprivilege=true "helpurl=https://${IDRAC_HOST}:443/help/contents.html"
fi
if [ ! -f lib/avctKVMIOLinux64.jar ]; then
wget -O lib/avctKVMIOLinux64.jar https://${IDRAC_HOST}/software/avctKVMIOLinux64.jar --no-check-certificate
if [ ! $? -eq 0 ]; then
echo -e "${RED}Failed to download avctKVMIOLinux64.jar, please check your settings${NC}"
sleep 2
exit 2
fi
fi
if [ ! -f lib/avctVMLinux64.jar ]; then
wget -O lib/avctVMLinux64.jar https://${IDRAC_HOST}/software/avctVMLinux64.jar --no-check-certificate
if [ ! $? -eq 0 ]; then
echo -e "${RED}Failed to download avctVMLinux64.jar, please check your settings${NC}"
sleep 2
exit 2
fi
fi
exec java -cp avctKVM.jar -Djava.library.path="./lib" com.avocent.idrac.kvm.Main ip=${IDRAC_HOST} kmport=5900 vport=5900 user=${IDRAC_USER} passwd=${IDRAC_PASSWORD} apcp=1 version=2 vmprivilege=true "helpurl=https://${IDRAC_HOST}:443/help/contents.html"