Skip to content

Unable to set WebGoat port except via environment variable #1910

@MBradbury

Description

@MBradbury

I already have a web server running on 8080, so I need to run WebGoat on a different port.

$ netstat -ano
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       Timer
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      off (0.00/0/0)
tcp        0     52 192.168.1.87:22         192.168.1.1:49766       ESTABLISHED on (0.23/0/0)
tcp6       0      0 :::8080                 :::*                    LISTEN      off (0.00/0/0)
tcp6       0      0 :::445                  :::*                    LISTEN      off (0.00/0/0)
tcp6       0      0 :::3000                 :::*                    LISTEN      off (0.00/0/0)
tcp6       0      0 :::139                  :::*                    LISTEN      off (0.00/0/0)
tcp6       0      0 :::22                   :::*                    LISTEN      off (0.00/0/0)
tcp6       0      0 :::21                   :::*                    LISTEN      off (0.00/0/0)
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      off (0.00/0/0)
tcp6       0      0 :::80                   :::*                    LISTEN      off (0.00/0/0)

If I follow the documentation here to set the ports, it will successfully set the WebWolf port, but then fail to change the WebGoat port from 8080.

java -Dfile.encoding=UTF-8 -Dwebgoat.port=6060 -Dwebwolf.port=7070 -jar /opt/webgoat/webgoat-2023.8.jar --server.address 0.0.0.0
2024-09-26T20:01:46.388Z  INFO 1793 --- [           main] o.s.b.w.e.undertow.UndertowWebServer     : Undertow started on port(s) 7070 (http) with context path '/WebWolf'

....

***************************
APPLICATION FAILED TO START
***************************

Description:

Web server failed to start. Port 8080 was already in use.

If I instead set server.port

java -Dfile.encoding=UTF-8 -Dserver.port=6060 -Dwebwolf.port=7070 -jar /opt/webgoat/webgoat-2023.8.jar --server.address 0.0.0.0

Then WebWolf is started on 6060 and WebGoat is attempted to start on 6060.

2024-09-26T20:05:19.568Z  INFO 1880 --- [           main] o.s.b.w.e.undertow.UndertowWebServer     : Undertow started on port(s) 6060 (http) with context path '/WebWolf'

...

***************************
APPLICATION FAILED TO START
***************************

Description:

Web server failed to start. Port 6060 was already in use.

My solution to this has been to specify WEBGOAT_PORT=6060 as an environment variable before the command.

WEBGOAT_PORT=6060 java -Dfile.encoding=UTF-8 -Dwebwolf.port=7070 -jar /opt/webgoat/webgoat-2023.8.jar --server.address 0.0.0.0

Would be useful for either -Dwebgoat.port to work or the environment variable documented.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions