No internet connection
  1. Home
  2. Technical Support

Voyager 2a changing TLS/SSL listen port via SSH

By Chris Terzian @cterzian
    2023-12-10 07:46:46.526Zassigned to
    • @david

    I'm trying to reach multiple TinyPilot Voyager2a through my firewall from the internet, so need to change the listen port on each device. I found an article that provides the script to set through SSH, however, the "update" command isn't found. "settings.yml" was modified, and the device restarted, but it doesn't change the active listen port. What am I missing?

    My device has firmware 2.4.0,

    • 8 replies
    1. David @david2023-12-11 13:30:11.467Z2023-12-15 16:32:06.103Z

      Hi Chris, I'm sorry you're running into this issue setting the ports on your TinyPilot devices.

      It looks like you also sent over an email with a TinyPilot log. I took a look at the log, and it looks quite odd. You mention your TinyPilot software is at version 2.4.0 (which your log also lists), but the log looks like it's from a TinyPilot on 2.6.1.

      I did a bit of digging, and I think I found the issue. The command in this thread is outdated. It sets the TinyPilot version number to 2.4.0. and runs the update command, which TinyPilot no longer uses.

      We can fix this with some new commands.

      On the first TinyPilot (the one you ran the previous commands on), SSH in and run this snippet to reset the version number and update to 2.6.2 (the update should also correctly set your ports):

      echo "2.6.1" | sudo tee /opt/tinypilot/VERSION && \
        /opt/tinypilot/scripts/upgrade && \
        sudo reboot
      

      On the other TinyPilot devices (the ones that you haven't tried to set the ports on yet), SSH in and run these snippets:

      # Set your port numbers.
      NEW_EXTERNAL_HTTP_PORT=80
      NEW_EXTERNAL_TLS_PORT=443
      
      sudo sed --in-place '/tinypilot_external_port/d' \
          /home/tinypilot/settings.yml && \
        sudo sed --in-place '/tinypilot_external_tls_port/d' \
          /home/tinypilot/settings.yml && \
        echo "tinypilot_external_port: ${NEW_EXTERNAL_HTTP_PORT}" \
          | sudo tee --append /home/tinypilot/settings.yml && \
        echo "tinypilot_external_tls_port: ${NEW_EXTERNAL_TLS_PORT}" \
          | sudo tee --append /home/tinypilot/settings.yml
       
      pushd /opt/tinypilot
      . venv/bin/activate && \
        PYTHONPATH=/opt/tinypilot/app \
          ./scripts/render-template \
        < /usr/share/tinypilot/templates/tinypilot.conf.j2 \
        | sudo tee /etc/nginx/conf.d/tinypilot.conf && \
        deactivate
      popd
       
      sudo service nginx restart
      

      I hope that helps! Please let me know if you have any questions.

      1. CChris Terzian @cterzian
          2023-12-13 02:51:29.243Z

          Hi David, thanks for your help. It kind of worked. I was able to get the first until set to port 8444 and upgrade, however, now there is no video. I've tried troubleshooting in the way that's always been successful, but still not showing video. Here alogs.

          Debug Logs: https://logs.tinypilotkvm.com/eUaGeC5Q

          For the next unit, I tried the new commands. They seemed to set the port properly, but the reboot didn't make the port stick. It also thinks it's on 2.6.1 and running the update doesn't change that. Also, I can't get it to listen on the correct port despite trying the suggested commands. Logs: https://logs.tinypilotkvm.com/WT2SpIB8

          3rd unit, was upgraded to 2.6.2, but using the script to set the port seems to have knocked set the version to 2.6.1, and also doesn't listen on the configured port :8446. Here's the logs: https://logs.tinypilotkvm.com/a5yO2pD3

          Thanks

          1. David @david2023-12-13 13:24:49.624Z

            Thanks for the update, Chris!

            I think it's best if we work on a single device to get that up and running first. Can we focus on the first unit for now and then we'll look at the other devices after?

            After reading the log, I think your first unit is in an odd state. For some reason it can't access the capture device, and the update log has some issues too.

            Could you factory reset your first unit? I understand it's inconvenient, but that would help us return to a working state before we try anything else.

            My colleague also suggested that you may not need to change the port your TinyPilot listens on for port forwarding. Your router should be able to translate on the fly. For example, 111.222.333.444:5555 could forward to 192.168.0.10:443 for TinyPilot-A, and 111.222.333.444:6666 could forward to 192.168.0.20:443 for TinyPilot-B. Is that something you're able to set up?

            Please let me know if you have any questions.

            1. CChris Terzian @cterzian
                2023-12-14 22:39:14.753Z

                Hi David,

                The first unit has been factory reset and is now at 2.6.2. I followed your steps to set the port, but it still is not listening on that port. Here are the logs: https://logs.tinypilotkvm.com/aiIeXRHD

                Thanks,

                Chris

                1. CChris Terzian @cterzian
                    2023-12-15 16:08:32.551Z

                    No longer worried about changing the listening port. Used port forwarding on the router and a combo of DNS A and SRV records to route externally to each with their own URL. Thanks

                    1. David @david2023-12-15 16:41:14.377Z

                      Thanks for the update, Chris!

                      I'm sorry that the previous commands failed to set the listening ports. I did some more testing today, and I found that the snippet I shared didn't set the external ports when running on the very latest TinyPilot version. Forcing an update when one isn't required no longer runs the required script that sets the ports. This explains why the ports weren't set after you re-flashed to 2.6.2. That method did work if the TinyPilot software needed to update (i.e., 2.6.1 to 2.6.2).

                      I've updated the snippet in my previous post with a newer one which should work even on the latest version of TinyPilot Pro. I understand that you no longer need it, but I wanted to clarify what the issue was and to resolve it.

                      Please let me know if you have any questions, and feel free to reach out again in the future.

            2. C
              In reply tocterzian⬆:
              Chris Terzian @cterzian
                2023-12-15 18:08:55.255Z

                Awesome, you've been very helpful. That may help me in the future, and hopefully it will help someone else looking for this answer! Cheers!

                Btw - was looking to see how we could modify the login page look and feel of the TinyPilots. Seems like it would be easy if we could find the HTML. Didn't find any answers on the form, but interestingly, ChatGPT knew where to find the files! Impressive 😅

                1. David @david2023-12-18 12:51:03.431Z2023-12-18 14:29:59.094Z

                  You're welcome!

                  was looking to see how we could modify the login page look and feel of the TinyPilots. Seems like it would be easy if we could find the HTML. Didn't find any answers on the form, but interestingly, ChatGPT knew where to find the files! Impressive 😅

                  Cool! You can always check our Github repository to find most things on the community version of TinyPilot.

                  For the sake of documenting this on the forum, you can edit, /opt/tinypilot/app/static/img/logo.svg to change the logo. /opt/tinypilot/app/templates/ contains the HTML files, and /opt/tinypilot/app/static/css contains the CSS files for editing TinyPilot styling. I should also note that updating TinyPilot will overwrite any changes to these files.