blacktop/docker-ghidra

Can't connect to server

sr-tream opened this issue · 11 comments

Run server with command on localhost^

docker run --init -it --rm \
             --name ghidra-server \
             --cpus 2 \
             --memory 500m \
             -e MAXMEM=500M \
             -e GHIDRA_USERS="root test" \
             -v `pwd`/repos:/repos \
             blacktop/ghidra server

Try connect in ghidra to next IPs:

  • 127.0.0.1:13100 (localhost)
  • 172.17.0.1:13100 (docker)
  • 172.17.0.2:13100 (image)

Ghidra return error 1 | Connection to server failed (localhost:13100). | Thu May 26 23:22:15 EEST 2022

And no any messages in server about this connection

In firewalld current connection and docker bridge is in trusted mode

Sorry bad docs on my behalf, but I think it's because you need to expose the port from the container:

-p 13100:13100 \ 

Does that work?

Same error. When I launch ghidra without docker all work properly.

Also with -p 13100-13102:13100-13102 \ same error

Ghidra output:

Using service wrapper: yajsw-beta-13.01
Running Ghidra Server...
YAJSW: yajsw-alpha-13.00
OS   : Linux/5.17.9-zen1-1-zen/amd64
JVM  : Oracle Corporation/11.0.15//usr/local/openjdk-11/64
wrapper|YAJSW: yajsw-alpha-13.00
wrapper|OS   : Linux/5.17.9-zen1-1-zen/amd64
wrapper|JVM  : Oracle Corporation/11.0.15//usr/local/openjdk-11/64
error evaluating os_dir : No such property: os_dir for class: Script1
system.env 19
env result 19
wrapper|exec:/usr/local/openjdk-11/bin/java -classpath /ghidra/Ghidra/Features/GhidraServer/data/yajsw-beta-13.01/wrapperApp.jar:/ghidra/Ghidra/Features/GhidraServer/data/yajsw-beta-13.01/lib/core/permit/permit-reflect-0.4.jar:/ghidra/Ghidra/Features/GhidraServer/lib/GhidraServer.jar:/ghidra/Ghidra/Framework/FileSystem/lib/FileSystem.jar:/ghidra/Ghidra/Framework/DB/lib/DB.jar:/ghidra/Ghidra/Framework/Docking/lib/Docking.jar:/ghidra/Ghidra/Framework/Generic/lib/Generic.jar:/ghidra/Ghidra/Framework/FileSystem/lib/ganymed-ssh2-262.jar:/ghidra/Ghidra/Framework/Utility/lib/Utility.jar:/ghidra/Ghidra/Framework/Generic/lib/cglib-nodep-2.2.jar:/ghidra/Ghidra/Framework/Generic/lib/guava-19.0.jar:/ghidra/Ghidra/Framework/Generic/lib/jdom-legacy-1.1.3.jar:/ghidra/Ghidra/Framework/Generic/lib/log4j-core-2.17.1.jar:/ghidra/Ghidra/Framework/Generic/lib/log4j-api-2.17.1.jar:/ghidra/Ghidra/Framework/Generic/lib/commons-collections4-4.1.jar:/ghidra/Ghidra/Framework/Generic/lib/commons-lang3-3.9.jar:/ghidra/Ghidra/Framework/Generic/lib/commons-text-1.6.jar:/ghidra/Ghidra/Framework/Generic/lib/commons-io-2.6.jar:/ghidra/Ghidra/Framework/Generic/lib/gson-2.8.9.jar:/ghidra/Ghidra/Framework/Generic/lib/bcpkix-jdk15on-1.69.jar:/ghidra/Ghidra/Framework/Generic/lib/bcprov-jdk15on-1.69.jar:/ghidra/Ghidra/Framework/Generic/lib/bcutil-jdk15on-1.69.jar:/ghidra/Ghidra/Framework/Docking/lib/timingframework-1.0.jar:/ghidra/Ghidra/Framework/Docking/lib/javahelp-2.0.05.jar -Djava.net.preferIPv4Stack=true -DApplicationRollingFileAppender.maxBackupIndex=10 -Dclasspath_frag=/ghidra/server/../Ghidra/Features/GhidraServer/data/classpath.frag -Ddb.buffers.DataBuffer.compressedOutput=true -Djava.library.path=?unresolved? -Xms396m -Xmx768m -Djava=/usr/local/openjdk-11/bin/java -Dghidra_home=/ghidra/server/.. -Dwrapper.port=15003 -Dwrapper.key=-5810541795108383923 -Dwrapper.teeName=-5810541795108383923$1653597216674 -Dwrapper.tmp.path=/tmp -Djna_tmpdir=/tmp -Dwrapper.config=/ghidra/server/server.conf org.rzo.yajsw.app.WrapperJVMMain
wrapper|posix_spawn pid 89
post start false -5810541795108383923$1653597216674
wrapper|started process 89
wrapper|started process with pid 89
89/0|error evaluating GHIDRA_IP : No such property: GHIDRA_IP for class: Script1
89/0|INFO  Using log config file: jar:file:/ghidra/Ghidra/Framework/Generic/lib/Generic.jar!/generic.log4j.xml (LoggingInitialization)
89/0|INFO  Using log file: /repos/server.log (LoggingInitialization)
89/0|INFO  Initializing SSL Context (SSLContextInitializer)
89/0|INFO  Initializing Random Number Generator... (SecureRandomFactory)
89/0|INFO  Random Number Generator initialization complete: NativePRNGNonBlocking (SecureRandomFactory)
89/0|INFO  Trust manager disabled, cacerts have not been set (ApplicationTrustManagerFactory)
89/0|INFO  Using self-signed certificate: CN=GhidraServer (ApplicationKeyManager)
89/0|INFO     defaultsigkey: GhidraServer, issued by GhidraServer, S/N 83ce4a6cb00c4ecb7a81445e43b5650a, expires Sat May 25 20:33:43 UTC 2024 (ApplicationKeyStore)
89/0|INFO  Ghidra Server 10.1.4 (GhidraServer)
89/0|INFO     Server remote access address: ?unresolved? (GhidraServer)
89/0|INFO     Server listening on all interfaces (GhidraServer)
89/0|INFO     RMI Registry port: 13100 (GhidraServer)
89/0|INFO     RMI SSL port: 13101 (GhidraServer)
89/0|INFO     Block Stream port: 13102 (GhidraServer)
89/0|INFO     Block Stream compression: enabled (GhidraServer)
89/0|INFO     Root: /repos (GhidraServer)
89/0|INFO     Auth: Password File (GhidraServer)
89/0|INFO     Prompt for user ID: yes (GhidraServer)
89/0|INFO     Anonymous server access: disabled (GhidraServer)
89/0|INFO  root starting Ghidra Server... (GhidraServer)
89/0|INFO  Instantiating Repository Manager for /repos (RepositoryManager)
89/0|INFO  Instantiating User Manager (w/password management) (UserManager)
89/0|INFO  User file contains 2 entries (UserManager)
89/0|INFO  Known Users: (UserManager)
89/0|INFO     root (UserManager)
89/0|INFO     sr_team (UserManager)
89/0|INFO  Known Repositories: (RepositoryManager)
89/0|INFO     <none> (RepositoryManager)
89/0|INFO  Starting Block Stream Server... (BlockStreamServer)
89/0|INFO  Registering Ghidra Server... (GhidraServer)
89/0|INFO  Registered Ghidra Server. (GhidraServer)

It's fixed by add -e GHIDRA_IP="0.0.0.0" \, but I can't login

you were unable to login with user root or test with the password changeme ?

What kind of host are you running this one?

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ghidra-server

Thank you for pointing this out to me, the GHIDRA_IP var wasn't getting auto-set like it was supposed to be. The default workflow was to using docker-ized ghidra to connect to docker-ized ghidra-server (which will using the docker networks) and works great, but for just using the docker-ized ghidra-server AND connecting to it from normal GUI clients, that part was broken.

Please pull a fresh image from the #24 fix and see the updated README for how to set the ports.

Then you connect to it from the host's IP, not sure if localhost will work, on macOS I had to use the IP of en0, but docker networking on macOS is weird, on linux it's prob more straight forward.

you were unable to login with user root or test with the password changeme ?

Thanks, with changeme I can connect and change password

The default workflow was to using docker-ized ghidra to connect to docker-ized ghidra-server

My case is docker-ized ghidra-server on VPS and client on my PC and laptop

Then you connect to it from the host's IP, not sure if localhost will work

It's works on Linux with port-forwarding

Please pull a fresh image from the #24 fix and see the updated README

Thanks, now it works without -e GHIDRA_IP="0.0.0.0" \

👍