Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SOCKS5 proxy #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN APP_ICON_URL=https://raw.githubusercontent.com/DomiStyle/docker-idrac6/maste
install_app_icon.sh "$APP_ICON_URL"

RUN apt-get update && \
apt-get install -y wget software-properties-common libx11-dev gcc xdotool && \
apt-get install -y wget curl software-properties-common libx11-dev gcc xdotool && \
wget -nc https://cdn.azul.com/zulu/bin/zulu8.68.0.21-ca-jdk8.0.362-linux_amd64.deb && \
apt-get install -y ./zulu8.68.0.21-ca-jdk8.0.362-linux_amd64.deb && \
gcc -o /keycode-hack.so /keycode-hack.c -shared -s -ldl -fPIC && \
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,25 @@ docker run -d \
```
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.

## Usage (with SOCKS)

```
# Start a local port forwarding using SOCKS
ssh -fND 4443 <remote-hostname>
docker run -d \
-p 5800:5800 \
-p 5900:5900 \
-e IDRAC_HOST=idrac1.example.org \
-e IDRAC_USER=root \
-e IDRAC_PASSWORD=1234 \
-e SOCKS_PROXY_HOST=host.docker.internal \
-e SOCKS_PROXY_PORT=4443 \
domistyle/idrac6
```

NB: `host.docker.internal` only works on Windows and MacOS since Docker 18.03+.


## Configuration

| Variable | Description | Required |
Expand All @@ -38,6 +57,8 @@ The web interface will be available on port 5800 while the VNC server can be acc
|`IDRAC_PORT`| The optional port for the web interface. (443 by default) | No |
|`IDRAC_KEYCODE_HACK`| If you have issues with keyboard input, try setting this to ``true``. See [here](https://github.com/anchor/idrac-kvm-keyboard-fix) for more infos. | No |
|`VIRTUAL_MEDIA`| Filename of iso located within /vmedia to automount | No |
|`SOCKS_PROXY_HOST`| The optional host for the SOCKS5 proxy. (disabled by default) | No |
|`SOCKS_PROXY_PORT`| The optional port for the SOCKS5 proxy. (disabled by default) | No |

**For advanced configuration options please take a look [here](https://github.com/jlesage/docker-baseimage-gui#environment-variables).**

Expand Down
18 changes: 13 additions & 5 deletions startapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ if [ -f "/run/secrets/idrac_password" ]; then
IDRAC_PASSWORD="$(cat /run/secrets/idrac_password)"
fi

CURL_OPTS=""
JAVA_OPTS=""
if [ -n "${SOCKS_PROXY_HOST}" ]; then
CURL_OPTS="$CURL_OPTS -x socks5://$SOCKS_PROXY_HOST:$SOCKS_PROXY_PORT"
JAVA_OPTS="-DsocksProxyHost=$SOCKS_PROXY_HOST -DsocksProxyPort=$SOCKS_PROXY_PORT"
fi

if [ -z "${IDRAC_HOST}" ]; then
echo "${RED}Please set a proper idrac host with IDRAC_HOST${NC}"
sleep 2
Expand Down Expand Up @@ -62,7 +69,7 @@ fi
if [ ! -f avctKVM.jar ]; then
echo "Downloading avctKVM"

wget https://${IDRAC_HOST}:${IDRAC_PORT}/software/avctKVM.jar --no-check-certificate
curl $CURL_OPTS -o avctKVM.jar https://${IDRAC_HOST}:${IDRAC_PORT}/software/avctKVM.jar -k --ciphers 'DEFAULT:!DH'

if [ ! $? -eq 0 ]; then
echo "${RED}Failed to download avctKVM.jar, please check your settings${NC}"
Expand All @@ -74,7 +81,7 @@ fi
if [ ! -f lib/avctKVMIOLinux64.jar ]; then
echo "Downloading avctKVMIOLinux64"

wget -O lib/avctKVMIOLinux64.jar https://${IDRAC_HOST}:${IDRAC_PORT}/software/avctKVMIOLinux64.jar --no-check-certificate
curl $CURL_OPTS -o lib/avctKVMIOLinux64.jar https://${IDRAC_HOST}:${IDRAC_PORT}/software/avctKVMIOLinux64.jar -k --ciphers 'DEFAULT:!DH'

if [ ! $? -eq 0 ]; then
echo "${RED}Failed to download avctKVMIOLinux64.jar, please check your settings${NC}"
Expand All @@ -86,7 +93,7 @@ fi
if [ ! -f lib/avctVMLinux64.jar ]; then
echo "Downloading avctVMLinux64"

wget -O lib/avctVMLinux64.jar https://${IDRAC_HOST}:${IDRAC_PORT}/software/avctVMLinux64.jar --no-check-certificate
curl $CURL_OPTS -o lib/avctVMLinux64.jar https://${IDRAC_HOST}:${IDRAC_PORT}/software/avctVMLinux64.jar -k --ciphers 'DEFAULT:!DH'

if [ ! $? -eq 0 ]; then
echo "${RED}Failed to download avctVMLinux64.jar, please check your settings${NC}"
Expand Down Expand Up @@ -118,8 +125,9 @@ if [ -n "$IDRAC_KEYCODE_HACK" ]; then

export LD_PRELOAD=/keycode-hack.so
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" &
exec java $JAVA_OPTS -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" &

# If an iso exists at the specified location, mount it
[ -f "/vmedia/$VIRTUAL_ISO" ] && /mountiso.sh
wait
wait