Project

General

Profile

Actions

Bug #13258

closed

Hidden menu option ``100`` incorrectly handles HTTPS detection

Added by → luckman212 over 2 years ago. Updated almost 2 years ago.

Status:
Resolved
Priority:
Low
Assignee:
Category:
Console Menu
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
23.01
Release Notes:
Default
Affected Version:
Affected Architecture:

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

clipboard-202212031938-mrhwj.png (29.4 KB) clipboard-202212031938-mrhwj.png console_option100 Jordan G, 12/03/2022 07:38 PM
Actions #1

Updated by Marcos M over 2 years ago

I can't think of any benefit from fixing it; better to remove it.

Actions #3

Updated by Jim Pingle over 2 years ago

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.

Actions #4

Updated by → luckman212 over 2 years ago

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}" 
Actions #5

Updated by Jim Pingle over 2 years ago

  • 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
Actions #6

Updated by → luckman212 over 2 years ago

  • removed case 111)
  • consistency of single/double quotes
  • removed a couple of stray ; s
Actions #7

Updated by Jim Pingle over 2 years ago

  • Plus Target Version changed from 22.09 to 22.11
Actions #8

Updated by Jim Pingle about 2 years ago

  • Plus Target Version changed from 22.11 to 23.01
Actions #9

Updated by Jim Pingle about 2 years ago

  • 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

PR merged

Actions #10

Updated by Jordan G almost 2 years ago

running 23.01.a.20221202.0600

console_option100

Actions #11

Updated by Jim Pingle almost 2 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF