Skip to content

Commit

Permalink
Initial implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Res42 committed Feb 1, 2020
1 parent 51da008 commit 9f555f0
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# anyk-docker
Docker files for ÁNYK

Docker files for [ÁNYK](https://www.nav.gov.hu/nav/letoltesek/nyomtatvanykitolto_programok/nyomtatvany_apeh/keretprogramok/abevjava_install.html).

Built on <https://github.com/danielguerra69/ubuntu-xrdp>.

## How to use

1. Start one of the docker images with `docker-compose up`.
2. Connect with a remote desktop app to `localhost:3990` (the port may be changed in the docker-compose.yml)
3. User/password: `root`/`root`

## Docker images

- ÁNYK only: <https://github.com/Res42/anyk-docker/blob/master/anyk>
- ÁNYK and 19KATA (KATA for 2019): <https://github.com/Res42/anyk-docker/blob/master/anyk-19kata>
8 changes: 8 additions & 0 deletions anyk-19kata/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM reisingeradam/anyk:2.94.0
LABEL maintainer="Adam Reisinger"

# Download and install 19KATA plugin for ANYK
RUN wget https://www.nav.gov.hu/data/cms489660/NAV_19KATA.jar -P ~ \
# -s: silent (non-gui) install
&& java -jar ~/NAV_19KATA.jar -s \
&& rm ~/NAV_19KATA.jar
10 changes: 10 additions & 0 deletions anyk-19kata/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3"

services:
anyk:
build: .
image: ${DOCKER_REGISTRY:-reisingeradam}/anyk:2.94.0-19kata
ports:
- "3390:3389"
# - "2222:22"
shm_size: 1g
21 changes: 21 additions & 0 deletions anyk/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM danielguerra/ubuntu-xrdp:18.04
LABEL maintainer="Adam Reisinger"

# Install Java 8
RUN apt-get update && apt-get install -y \
crudini \
openjdk-8-jre \
&& rm -rf /var/lib/apt/lists/*

# Overwrite entrypoint bash file: removed the user creation script there
COPY ./shared/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh

RUN echo "root:root" | chpasswd \
# Create 'Desktop' folder so the ANYK installer can create a shortcut there
&& mkdir ~/Desktop \
# Download and install ANYK
&& wget https://www.nav.gov.hu/data/cms36637/abevjava_install.jar -P ~ \
# -s: silent (non-gui) install
# -u: create user settings
&& java -jar ~/abevjava_install.jar -s -u \
&& rm ~/abevjava_install.jar
12 changes: 12 additions & 0 deletions anyk/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3"

services:
anyk:
build:
context: ..
dockerfile: anyk/Dockerfile
image: ${DOCKER_REGISTRY:-reisingeradam}/anyk:2.94.0
ports:
- "3390:3389"
# - "2222:22"
shm_size: 1g
63 changes: 63 additions & 0 deletions shared/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

# Add the ssh config if needed

if [ ! -f "/etc/ssh/sshd_config" ];
then
cp /ssh_orig/sshd_config /etc/ssh
fi

if [ ! -f "/etc/ssh/ssh_config" ];
then
cp /ssh_orig/ssh_config /etc/ssh
fi

if [ ! -f "/etc/ssh/moduli" ];
then
cp /ssh_orig/moduli /etc/ssh
fi

# generate fresh rsa key if needed
if [ ! -f "/etc/ssh/ssh_host_rsa_key" ];
then
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
fi

# generate fresh dsa key if needed
if [ ! -f "/etc/ssh/ssh_host_dsa_key" ];
then
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
fi

#prepare run dir
mkdir -p /var/run/sshd

# generate xrdp key
if [ ! -f "/etc/xrdp/rsakeys.ini" ];
then
xrdp-keygen xrdp auto
fi

# generate certificate for tls connection
if [ ! -f "/etc/xrdp/cert.pem" ];
then
# delete eventual leftover private key
rm -f /etc/xrdp/key.pem || true
cd /etc/xrdp
# TODO make data in certificate configurable?
openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem -days 365 \
-subj "/C=US/ST=Some State/L=Some City/O=Some Org/OU=Some Unit/CN=Terminalserver"
crudini --set /etc/xrdp/xrdp.ini Globals security_layer tls
crudini --set /etc/xrdp/xrdp.ini Globals certificate /etc/xrdp/cert.pem
crudini --set /etc/xrdp/xrdp.ini Globals key_file /etc/xrdp/key.pem

fi

# generate machine-id
uuidgen > /etc/machine-id

# set keyboard for all sh users
echo "export QT_XKB_CONFIG_ROOT=/usr/share/X11/locale" >> /etc/profile


exec "$@"

0 comments on commit 9f555f0

Please sign in to comment.