nyxnor / onionjuggler

Manage your Onion Services via CLI or TUI on Unix-like operating system with a POSIX compliant shell.
MIT License
34 stars 2 forks source link

Please double-check: grep failing to catch the content of the auth file #7

Closed radio24 closed 2 years ago

radio24 commented 2 years ago

https://github.com/nyxnor/onionservice/blob/a9975390c9cecc2f9c2153941821d13ab596ef60/onionservice-cli#L420

Issue If I'm not wrong, the format of the content of the public key, which is stored on the machine running the Onion Service (server), is the following: <auth-type>:<key-type>:<base32-encoded-public-key> Example: descriptor:x25519:N2NU7BSRL6YODZCYPN4CREB54TYLKGIE2KYOQWLFYC23ZJVCE5DQ

Because grep is searching for :descriptor:x25519:, it will not list the file's content.

Describe the solution you'd like Change the above linked row to the following: printf %s"# Content: $(sudo -u "${TOR_USER}" grep "descriptor:x25519:" "${DATA_DIR_SERVICES}"/"${SERVICE}"/authorized_clients/"${AUTH}")\n"

Additional remarks Would you please double-check if I didn't confuse something? Pull request may follow.

nyxnor commented 2 years ago

It is wrong, I messed with this line here https://github.com/nyxnor/onionservice/blob/a9975390c9cecc2f9c2153941821d13ab596ef60/onionservice-cli#L524

Which could include : at the beggining of the expression, but does not need to. Would work for both, but I was picky that day to include : at the beggining. But if you do that way, it will be accepted (grep "descriptor:x25519:)

auth server

 printf %s"# Content:   $(sudo -u "${TOR_USER}" grep "descriptor:x25519:" "${DATA_DIR_SERVICES}"/"${SERVICE}"/authorized_clients/"${AUTH}")\n"

auth client

printf %s"# Content:   $(sudo -u "${TOR_USER}" grep ":descriptor:x25519:" "${DATA_DIR_AUTH}"/"${AUTH}")"