[MXS-3824] Allow symbolic link for path to directory /usr/share/maxscale/gui Created: 2021-10-21  Updated: 2022-01-13  Resolved: 2021-10-25

Status: Closed
Project: MariaDB MaxScale
Component/s: REST-API
Affects Version/s: None
Fix Version/s: 2.5.17, 6.2.0

Type: Bug Priority: Major
Reporter: Edward Stoever Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None


 Description   

I have offered the variable:

sharedir=/some/other/directory/

Customer wants to use a symbolic link.

Here is an example of what happens when using a symbolic link and no value for sharedir:

root@mxs:~# mkdir /opt/gui
root@mxs:~# mv /usr/share/maxscale/gui/* /opt/gui
root@mxs:~# rmdir /usr/share/maxscale/gui
root@mxs:~# ln -s /opt/gui /usr/share/maxscale/gui
root@mxs:~# ls /usr/share/maxscale/gui/
apple-touch-icon.png  editor.worker.js                favicon-16x16.png  favicon.ico  img         js
css                   f8fbdc474808cb732257.worker.js  favicon-32x32.png  fonts        index.html  safari-pinned-tab.svg
 
root@mxs:~# systemctl restart maxscale
root@mxs:~# curl http://192.168.20.208:8989
{"errors": [ { "detail": "Access denied" } ] }root@mxs:~#



 Comments   
Comment by markus makela [ 2021-10-22 ]

Did you use the literal value sharedir=/some/other/directory/? If so, it's looking for the files in /some/other/directory/gui/ instead of where you expect it to look. Based on the fact that it's a symbolic link, I don't think you even need to add that parameter for it to work.

An additional detail is that if you're using a default REST API configuration then you must provide credentials to curl for it to work: curl -u admin:mariadb http://192.168.20.208:8989.

Comment by markus makela [ 2021-10-22 ]

OK, I think I misunderstood what the actual problem was: there's a security check in the REST API that makes sure only files from the GUI directory are served. If the real path to the file being requested differs from the configured value of sharedir, the request would be rejected and the GUI would not load. I think we can change this so that it only requires the file to reside inside the configured sharedir after all symbolic links have been resolved.

Comment by Edward Stoever [ 2021-10-25 ]

Thank you Markus!

Generated at Thu Feb 08 04:24:13 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.