bstansell / conserver

Logged, multi-user access to device consoles
https://www.conserver.com/
BSD 3-Clause "New" or "Revised" License
129 stars 38 forks source link

Issue with listing consoles with -u with port forwarding #88

Closed tse77 closed 1 year ago

tse77 commented 1 year ago

I have a setup where i'm running conserver on a raspberry pi which is connected to several devices over consoles. I have no issue running console client application on the raspberry pi and attaching to the different devices through conserver.

But when connecting to conserver from console over port forwarding I have an issue with listing consoles with "-u" argument.

Tested with the following versions of conserver: 8.2.6 8.2.1

The raspberry pi is connected to a server and is not accessible from the network it self. So I have enabled port forwarding on the server the following ports:

3109 (primaryport) 62000 (secondaryport)

When I connect with console from my laptop attaching to a console everything works fine:

command: console -D -M 10.2.83.240

Debug log from the session:

console dut-a (works)

➜ console -D -M 10.2.83.240 dut-b
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8a536a0 created string #3
console: DEBUG: [cutil.c:2610] ReadCfg(): got keyword 'config' [/etc/conserver/console.cf:1]
console: DEBUG: [readconf.c:114] ConfigBegin(*) [/etc/conserver/console.cf:3]
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8a547a0 created string #4
console: DEBUG: [cutil.c:2693] got keyword 'sslenabled' [/etc/conserver/console.cf:3]
console: DEBUG: [readconf.c:495] ConfigItemSslenabled(off) [/etc/conserver/console.cf:4]
console: DEBUG: [cutil.c:2693] got keyword 'master' [/etc/conserver/console.cf:4]
console: DEBUG: [readconf.c:337] ConfigItemMaster(localhost) [/etc/conserver/console.cf:5]
console: DEBUG: [cutil.c:2693] got keyword 'port' [/etc/conserver/console.cf:5]
console: DEBUG: [readconf.c:377] ConfigItemPort(3109) [/etc/conserver/console.cf:6]
console: DEBUG: [readconf.c:132] ConfigEnd() [/etc/conserver/console.cf:6]
console: DEBUG: [readconf.c:165] ConfigDestroy() [/etc/conserver/console.cf:7]
console: DEBUG: [readconf.c:291] TerminalDestroy() [/etc/conserver/console.cf:7]
console: DEBUG: [readconf.c:696] pConfig->username = (null)
console: DEBUG: [readconf.c:698] pConfig->master = localhost
console: DEBUG: [readconf.c:699] pConfig->port = 3109
console: DEBUG: [readconf.c:700] pConfig->escape = (null)
console: DEBUG: [readconf.c:701] pConfig->striphigh = unset
console: DEBUG: [readconf.c:703] pConfig->replay = 0
console: DEBUG: [readconf.c:704] pConfig->playback = 0
console: DEBUG: [readconf.c:706] pConfig->sslcredentials = (null)
console: DEBUG: [readconf.c:708] pConfig->sslcacertificatefile = (null)
console: DEBUG: [readconf.c:710] pConfig->sslcacertificatepath = (null)
console: DEBUG: [readconf.c:712] pConfig->sslrequired = unset
console: DEBUG: [readconf.c:714] pConfig->sslenabled = false
console: DEBUG: [readconf.c:717] pTerm->attach = (null)
console: DEBUG: [readconf.c:718] pTerm->attachsubst = (null)
console: DEBUG: [readconf.c:720] pTerm->detach = (null)
console: DEBUG: [readconf.c:721] pTerm->detachsubst = (null)
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8a536d0 created string #5
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8a537d0 created string #6
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8a53850 created string #7
console: DEBUG: [console.c:2479] cmds[1] = call
console: DEBUG: [console.c:2479] cmds[0] = attach
console: DEBUG: [console.c:558] GetPort: hostname=10.2.83.240, ip=10.2.83.240, port=3109
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8b0d9f0 created string #8
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8b0da20 created string #9
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8b0da50 created string #10
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8b0db20 created string #11
console: DEBUG: [console.c:787] ReadReply: `ok^M^J'
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8b07370 created string #12
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8b131b0 created string #13
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8b132d0 created string #14
console: DEBUG: [console.c:787] ReadReply: `ok^M^J'
console: DEBUG: [console.c:787] ReadReply: `62000^M^J'
console: DEBUG: [console.c:787] ReadReply: `goodbye^M^J'
console: DEBUG: [cutil.c:276] DestroyString(): 0x55e8e8b0d9f0 string destroyed (count==13)
console: DEBUG: [console.c:558] GetPort: hostname=10.2.83.240, ip=10.2.83.240, port=62000
console: DEBUG: [cutil.c:299] AllocString(): 0x55e8e8b0cdd0 created string #14
console: DEBUG: [console.c:787] ReadReply: `ok^M^J'
console: DEBUG: [console.c:787] ReadReply: `ok^M^J'
console: DEBUG: [console.c:787] ReadReply: `[attached]^M^J'
console: DEBUG: [console.c:787] ReadReply: `[up]^M^J'
console: DEBUG: [console.c:787] ReadReply: `[8002006]^M^J'
[Enter `^Ec?' for help]
console: DEBUG: [console.c:787] ReadReply: `[-- MOTD --]^M^J'
console: DEBUG: [console.c:787] ReadReply: `[connected]^M^J'

D2:/#>

But when I want to list all available consoles with the following command:

console -D -M 10.2.83.240 -u

It fails!

Debug session log:

console -u (not working)

➜ console -D -M 10.2.83.240 -u
console: DEBUG: [cutil.c:299] AllocString(): 0x55876a0f16a0 created string #3
console: DEBUG: [cutil.c:2610] ReadCfg(): got keyword 'config' [/etc/conserver/console.cf:1]
console: DEBUG: [readconf.c:114] ConfigBegin(*) [/etc/conserver/console.cf:3]
console: DEBUG: [cutil.c:299] AllocString(): 0x55876a0f27a0 created string #4
console: DEBUG: [cutil.c:2693] got keyword 'sslenabled' [/etc/conserver/console.cf:3]
console: DEBUG: [readconf.c:495] ConfigItemSslenabled(off) [/etc/conserver/console.cf:4]
console: DEBUG: [cutil.c:2693] got keyword 'master' [/etc/conserver/console.cf:4]
console: DEBUG: [readconf.c:337] ConfigItemMaster(localhost) [/etc/conserver/console.cf:5]
console: DEBUG: [cutil.c:2693] got keyword 'port' [/etc/conserver/console.cf:5]
console: DEBUG: [readconf.c:377] ConfigItemPort(3109) [/etc/conserver/console.cf:6]
console: DEBUG: [readconf.c:132] ConfigEnd() [/etc/conserver/console.cf:6]
console: DEBUG: [readconf.c:165] ConfigDestroy() [/etc/conserver/console.cf:7]
console: DEBUG: [readconf.c:291] TerminalDestroy() [/etc/conserver/console.cf:7]
console: DEBUG: [readconf.c:696] pConfig->username = (null)
console: DEBUG: [readconf.c:698] pConfig->master = localhost
console: DEBUG: [readconf.c:699] pConfig->port = 3109
console: DEBUG: [readconf.c:700] pConfig->escape = (null)
console: DEBUG: [readconf.c:701] pConfig->striphigh = unset
console: DEBUG: [readconf.c:703] pConfig->replay = 0
console: DEBUG: [readconf.c:704] pConfig->playback = 0
console: DEBUG: [readconf.c:706] pConfig->sslcredentials = (null)
console: DEBUG: [readconf.c:708] pConfig->sslcacertificatefile = (null)
console: DEBUG: [readconf.c:710] pConfig->sslcacertificatepath = (null)
console: DEBUG: [readconf.c:712] pConfig->sslrequired = unset
console: DEBUG: [readconf.c:714] pConfig->sslenabled = false
console: DEBUG: [readconf.c:717] pTerm->attach = (null)
console: DEBUG: [readconf.c:718] pTerm->attachsubst = (null)
console: DEBUG: [readconf.c:720] pTerm->detach = (null)
console: DEBUG: [readconf.c:721] pTerm->detachsubst = (null)
console: DEBUG: [cutil.c:299] AllocString(): 0x55876a0f16d0 created string #5
console: DEBUG: [cutil.c:299] AllocString(): 0x55876a0f17b0 created string #6
console: DEBUG: [cutil.c:299] AllocString(): 0x55876a0f1830 created string #7
console: DEBUG: [console.c:2479] cmds[2] = master
console: DEBUG: [console.c:2479] cmds[1] = groups
console: DEBUG: [console.c:2479] cmds[0] = hosts
console: DEBUG: [console.c:558] GetPort: hostname=10.2.83.240, ip=10.2.83.240, port=3109
console: DEBUG: [cutil.c:299] AllocString(): 0x55876a1ab9d0 created string #8
console: DEBUG: [cutil.c:299] AllocString(): 0x55876a1aba00 created string #9
console: DEBUG: [cutil.c:299] AllocString(): 0x55876a1aba30 created string #10
console: DEBUG: [cutil.c:299] AllocString(): 0x55876a1abb00 created string #11
console: DEBUG: [console.c:787] ReadReply: `ok^M^J'
console: DEBUG: [cutil.c:299] AllocString(): 0x55876a1a5350 created string #12
console: DEBUG: [cutil.c:299] AllocString(): 0x55876a1b1190 created string #13
console: DEBUG: [cutil.c:299] AllocString(): 0x55876a1b12b0 created string #14
console: DEBUG: [console.c:787] ReadReply: `ok^M^J'
console: DEBUG: [console.c:787] ReadReply: `@198.18.121.10^M^J'
console: DEBUG: [console.c:787] ReadReply: `goodbye^M^J'
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a1ab9d0 string destroyed (count==13)
console: DEBUG: [console.c:558] GetPort: hostname=198.18.121.10, ip=198.18.121.10, port=3109
console: Unable to connect to 198.18.121.10:3109
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a0f1830 string destroyed (count==12)
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a1b12b0 string destroyed (count==11)
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a1b1190 string destroyed (count==10)
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a1a5350 string destroyed (count==9)
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a1abb00 string destroyed (count==8)
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a1aba30 string destroyed (count==7)
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a1aba00 string destroyed (count==6)
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a0f17b0 string destroyed (count==5)
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a0f16d0 string destroyed (count==4)
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a0f27a0 string destroyed (count==3)
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a0f16a0 string destroyed (count==2)
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a0f12d0 string destroyed (count==1)
console: DEBUG: [cutil.c:276] DestroyString(): 0x55876a0f12a0 string destroyed (count==0)

When you compare the two different logs you can see from the log for the "-u" command it says incorrectly ip 198.18.121.10 and it can not reach that address of the raspberry pi since it is sitting behind the server.

But when attaching to the console (working example) you can see from the log that you don't get that incorrect IP so I wonder why.

Anyone have any ideas, could it be an issue with conserver/console?

Best regards Thomas

tse77 commented 1 year ago

I worked it out with another setup so i'm closing this now.