hercules-390 / hyperion

Hercules 390
Other
251 stars 70 forks source link

Hercules cannot configure TUN interface inside Docker image #288

Open AllardKrings opened 3 years ago

AllardKrings commented 3 years ago

Hello,

I have created a hercules docker image. I can start hercules, connect to it, IPL the os, 3270 into the OS, all works fine.

I have one remaining issue: hercules cannot configure /dev/net/tun:

HHC00901I 0:0E20 CTCI: Interface tun0, type TUN opened
HHC00136E Error in function execlp(): No such file or directory
HHC00007I Previous message from function 'IFC_IOCtl' at tuntap.c(1118)

If I run "ls -l /dev/net/tun" inside the container I get the following result:

crw-rw---- 1 root sudo 10, 200 Aug 25 06:19 /dev/net/tun

If I run "ls -l /dev/net/tun" outside the container on the host I get the following result:

crw-rw-rw- 1 root root 10, 200 Jul 20 11:38 /dev/net/tun

I run the container with the following command:

docker run -it -u 0 -v /share:/share --cap-add=NET_ADMIN --device /dev/net/tun:/dev/net/tun --network=host --name hercules hercules-compile

where hercules-compile is the name of the container-image that I have built.

Any suggestions?

AllardKrings commented 3 years ago

After some fiddling around with permissions on the host, aswell as inside the container I get the following results:

Inside the container:

"ls -l /dev/net/tun" produces the result: crwxrwxrwx 1 root root 10, 200 Aug 25 12:51 /dev/net/tun

while running Hercules produces:

HHC00901I 0:0E20 CTCI: Interface tun0, type TUN opened
HHC00136E Error in function execlp(): No such file or directory
HHC00007I Previous message from function 'IFC_IOCtl' at tuntap.c(1118)

Outside the container:

"ls -l /dev/net/tun" produces the result:

crwxrwxrwx 1 root root 10, 200 Jul 20 11:38 /dev/net/tun

while running Hercules produces:

HHC00901I 0:0E20 CTCI: Interface tun0, type TUN opened
HHC02499I Hercules utility hercifc - Hercules Network Interface Configuration Program - version 4.4.9999.0-SDL- g3c4fdd85HHC01414I (C) Copyright 1999-2021 by Roger Bowler, Jan Jaeger, and others HHC01417I Built using Hercules-Helper (version: v0.9.5-15-ga3db5a2)
HHC01415I Build date: Jun 19 2021 at 15:32:51

And the TUN interface is configured correctly.

Does anybody have a clue what's happening here?

wrljet commented 3 years ago

Allard,

You might want to move this discussion to the SDL-Hercules repo. This is the original pre-non-SDL version of Hercules. And there isn't much activity here.

If you used the Dockerfile I gave you, you'll probable want to remove the --no-setcap from the last line. Then Hercules will have permission to run the networking stuff elevated.

Bill