ZizzyDizzyMC / linx-server

Self-hosted file/code/media sharing website. ~~~~~~~~~~~~~~~~~~~ Powers https://put.icu
GNU General Public License v3.0
217 stars 33 forks source link

how to add API key ?? #4

Open changchichung opened 3 years ago

changchichung commented 3 years ago

I run linx-server in docker , I can upload in web UI now . but I can not find API key or instructions about how to add keys. so , where can I find/set the API keys?

G-R-A-F-F commented 2 years ago

Download a keygen for your platform:

https://github.com/andreimarcu/linx-server/releases/download/v2.3.8/linx-genkey-v2.3.8_linux-amd64 https://github.com/andreimarcu/linx-server/releases/download/v2.3.8/linx-genkey-v2.3.8_linux-arm64 https://github.com/andreimarcu/linx-server/releases/download/v2.3.8/linx-genkey-v2.3.8_linux-arm

I used AMD version on my PC. It was a pain to run it inside the container. Make executable and run ./linx-genkey*

Type password and copy result into auth.txt as a new line.

You might also want to track these hashes somewhere else in case you want to remove certain ones after.

dotcomUNDERGROUND commented 2 years ago

API keys are same as authfile? Or I need to set it on some other location?

As API ill use the same password I use for basic auth? Or the hash?

G-R-A-F-F commented 2 years ago

Yes. No. Yes. No. authfile.txt is the file to keep all the API tokens that genkey generates. You can use this to generate new tokens: echo 'ABC' | ./linx-genkey-v2.3.8_linux-amd64 | awk -F ' ' '{print $5}'

You can use the ABC key on the basic web GUI auth and using CLI: curl -k -H "Linx-Api-Key: ABC" -T $1 https\://linx-share-url.com\:port/upload/

Hashes are to be kept as a secret.

turbomaster95 commented 1 year ago

Btw I made my authfile.txt using this command: while true; do shuf -n 1 hashes.txt | ./linx-genkey-v2.3.8_linux-arm64 | awk -F ' ' '{print $5}'; done | tee authfile.txt The hashes.txt I generated using ` import os

while True: try: gen = lambda x: os.urandom(x).hex() print(gen(9)) except BrokenPipeError: continue ` This python code

G-R-A-F-F commented 1 year ago

I did something similar using bitwarden cli

for k in {1..10}
do
  pass=$(bw generate -p --words 3)
  hash=$(echo $pass | ./linx-genkey-v2.3.8_linux-amd64 | awk -F ' ' '{print $5}')
  echo -e $pass' '$hash
done