Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Translate
  3. Lock libretranslate to only users with api keys

Lock libretranslate to only users with api keys

Scheduled Pinned Locked Moved Translate
13 Posts 3 Posters 746 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic was forked from How to create API key? joseph
This topic has been deleted. Only users with topic management privileges can see it.
  • visampV Offline
    visampV Offline
    visamp
    wrote on last edited by
    #4

    So, basically, these codes work:

    Add a new key:

    su - cloudron -c 'source /app/code/.venv/bin/activate; ltmanage keys --api-keys-db-path /app/data/db/api_keys.db add 120'

    Show all created keys:
    su - cloudron -c 'source /app/code/.venv/bin/activate; ltmanage keys --api-keys-db-path /app/data/db/api_keys.db'

    But, the remove key doesn't seem to work for me (I don't understand the formatting) and it would be great to have a character set version as well such as from LibreTranslate: ltmanage keys add 120 --char-limit 5000

    Okay, sorry for the rapid fire.

    1 Reply Last reply
    2
    • nebulonN Offline
      nebulonN Offline
      nebulon
      Staff
      wrote on last edited by
      #5

      @visamp thanks for the hint about the wrong URL, this is fixed now for next package release.

      We will further add the key listing docs then.

      1 Reply Last reply
      2
      • visampV Offline
        visampV Offline
        visamp
        wrote on last edited by visamp
        #6

        Thank you! Do you know off hand what the code would be to remove a certain API key?

        1 Reply Last reply
        0
        • nebulonN Offline
          nebulonN Offline
          nebulon
          Staff
          wrote on last edited by
          #7

          We have also added listing and removing keys commands in the docs page now at https://docs.cloudron.io/apps/libretranslate/#api

          1 Reply Last reply
          2
          • visampV Offline
            visampV Offline
            visamp
            wrote on last edited by
            #8

            Rock on! This is perfect and super helpful.

            1 Reply Last reply
            2
            • visampV Offline
              visampV Offline
              visamp
              wrote on last edited by
              #9

              Do you know if I install a key, do I need to comment out the line below so that it is locked down to only users with api keys?

              0ca09fba-1e20-4f33-a4f7-59458b37370e-image-resized.png

              1 Reply Last reply
              0
              • nebulonN Offline
                nebulonN Offline
                nebulon
                Staff
                wrote on last edited by nebulon
                #10

                From the README it seems Set maximum number of requests per minute per client (outside of limits set by api keys) so maybe yes. But not really sure. Maybe you can ask upstream about this.

                Also below LT_REQUIRE_API_KEY_ORIGIN is set to true, maybe that means the instance is already locked down to only api keys, but also this is not totally clear to me.

                1 Reply Last reply
                2
                • visampV Offline
                  visampV Offline
                  visamp
                  wrote on last edited by
                  #11

                  According to folks on their forum, there's another step to lock down:

                  https://community.libretranslate.com/t/locking-down-api-key-on-self-hosted-through-cloudron/1767/2

                  We may need to update the docs here on cloudron:

                  To configure requirement for api key to use, set --req-limit to 0 and add the --api-keys flag. Requests made without a proper api key will be rejected.

                  1 Reply Last reply
                  2
                  • M Offline
                    M Offline
                    mononym
                    wrote on last edited by
                    #12

                    Hello. When I run the su - cloudron -c 'source /app/code/.venv/bin/activate; ltmanage keys --api-keys-db-path /app/data/db/api_keys.db add 120' command from the docs, I get This account is currently not available. Was there an update of the API ?

                    1 Reply Last reply
                    0
                    • nebulonN Offline
                      nebulonN Offline
                      nebulon
                      Staff
                      wrote on last edited by
                      #13

                      Looks like the correct way to call ltmanage now (probably related to the base image python update), is to first source the pyhton env and then run the command:

                      source /app/code/venv/bin/activate
                      ltmanage keys --api-keys-db-path /app/data/db/api_keys.db
                      
                      1 Reply Last reply
                      1
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Bookmarks
                      • Search