Have server.py automatically configure Magma .env when build flag set#2977
Conversation
|
Tested successfully on Ubuntu on Chrome and Firefox. |
I did test before merging with remote hosting on a cloud VM, with port 8888 on the remote VM forwarded to localhost. To make it work with these changes, I had to change the The changes set the URL that the Vue UI sends requests to from the host and port values of the Caldera config. With the default values in the Caldera config the UI will attempt to send requests to We added a corresponding paragraph to the documentation to note the required remediation: https://caldera.readthedocs.io/en/latest/Server-Configuration.html#configuration-file If this doesn't get towards addressing the issue for you, I'm happy to continue the discussion on fixing this problem in a way that supports remote hosting more generally. |
|
Thanks for the details @djlawren . What about TLS support with this new PR? Did you test this out and what are users to do if they want to run magma with SSL support? I see what it is doing now and I"m able to build and run with http and port 8888. However, my system was built for SSL on port 8443. It looks here like your --build with server.py is hard-coding to build the Would be good to have an option to make this configurable for https or http just like host and port variables on local.yml. https://github.com/mitre/caldera/blob/master/server.py#L155 Cc @prcabral |
Description
These changes modify
server.pyto set the contents of./plugins/magma/.envwhen--buildis used. The contents of Magma'sVITE_CALDERA_URLenvironment variable is set to thehostandportvalues set in the Caldera config.A discrepancy between the URL used by Magma's router and the location of the Caldera server was noted as the cause of multiple issues: #2901, #2944, #2955
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
The change was manually verified by starting the Caldera server and noting through browser developer tools that the URL used for Caldera's requests changed when the Caldera config values changed, and the UI was rebuilt.
It should be noted that the inciting bug was still present the first time I tested. In testing, I used Caldera by running on a cloud VM and port forwarding to my local machine. The Caldera config's default host value of
0.0.0.0caused the login screen to be impassable. In my specific situation, I had to change the config's host value tolocalhostor the VM's domain name to get past the login screen.Checklist: