Bug #13258
closed
Hidden menu option ``100`` incorrectly handles HTTPS detection
Added by → luckman212 over 2 years ago.
Updated almost 2 years ago.
Plus Target Version:
23.01
Description
I was poking around in /etc/rc.initial
to try to fix something else and I noticed a hidden menu item 100
This opens the text-based links browser. Neat.
I guess that could be useful, but the code below looks a little silly and is incorrect. It just greps config.xml
and if the string https
is anywhere in there (which it's likely to be) then the browser tries to open https://localhost which is also very likely to be incorrect (maybe we're running on port 4443?).
65 CONFIG="/cf/conf/config.xml"
66 WORD="https"
...
257 100)
258 if grep "$WORD" "$CONFIG"; then
259 links "https://localhost"
260 else
261 links "http://localhost"
262 fi
263 ;;
I think this should either be removed or changed to open e.g. https://google.com
or https://netgate.com
Files
I can't think of any benefit from fixing it; better to remove it.
I haven't used links
against in the GUI in quite some time so I'm not sure if it still works. If it does we may as well fix the code there. If not we can remove it.
The code can be changed to read the specific tag from the config rather than using grep
, the grep
method is quite outdated.
protocol=`/usr/local/sbin/read_xml_tag.sh string system/webgui/protocol`
if [ "${protocol}" = "https" ]; then
links "https://localhost"
else
links "http://localhost"
fi
Can't use the value of protocol directly as it may not be present in the configuration.
Ok I updated the PR to bring back the hidden option 100 / links browser. I think this is good. Unfortunately when I tested it, I was able to get to a login page, and successfully authenticated (saw that message on the console) but the dashboard never loaded. Regardless, that's for another issue -- hopefully this is good for now.
protocol=$(/usr/local/sbin/read_xml_tag.sh string system/webgui/protocol)
port=$(/usr/local/sbin/read_xml_tag.sh string system/webgui/port)
if [ -z "$port" ]; then
case $protocol in
https) port=443;;
*) port=80;;
esac
fi
links "${protocol}://localhost:${port}"
- Target version set to 2.7.0
- Plus Target Version set to 22.09
- Status changed from New to Pull Request Review
- Assignee set to Jim Pingle
- removed
case 111)
- consistency of single/double quotes
- removed a couple of stray
;
s
- Plus Target Version changed from 22.09 to 22.11
- Plus Target Version changed from 22.11 to 23.01
- Subject changed from secret menu option 100 to Hidden menu option ``100`` incorrectly handles HTTPS detection
- Status changed from Pull Request Review to Feedback
- % Done changed from 0 to 100
running 23.01.a.20221202.0600
- Status changed from Feedback to Resolved
Also available in: Atom
PDF