mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-10 00:08:52 +02:00
[GH-ISSUE #595] Ansible URI module and base64 for Auth #450
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#450
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fred-gb on GitHub (Jan 29, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/595
Hi,
I would like to use Ansible URI module to send to my self-hosted server.
username and password are variables
I get a 403 reponse. with in fail message:
But If I do manually in my terminal:
The encoded response is totally different from fail message before, I don't know why.
And If I paste the key generated manually.
It works fine!
I tried another way like this:
The result is little bit weird, beacause, the auth_base64.stdout is near of manually generated auth encoded.
For my exemple, if
BASE64encodedPASTEMANUALLYis my manually generated and working Auth encoded,BASE64encodedPASTE\nMANUALLYis the result of ansible shell module. Why it puts\ninside auth encoded?I don't understand where come from my mistake.
I know there is already a action_plugin for send to ntfy by ansible (thanks a lot to @jpmens, I tried it for testing) but I would like to use URI module.
Thanks
@jpmens commented on GitHub (Jan 30, 2023):
Why are you removing the
=symbols from the base64-encoded value? It's padding and they are part of it, and the HTTP code 403 (Forbidden) seems to corrobare my view.Also in your
shellexample you are double encoding the string ... I don't think that can work.@jpmens commented on GitHub (Jan 30, 2023):
Example:
@fred-gb commented on GitHub (Jan 30, 2023):
Hi,
Yes I removed trailing = by ansible filter replace.
For double encoded base64 is a try. I also try with only one encoded.
Thanks
@fred-gb commented on GitHub (Jan 30, 2023):
Sorry bad read.
In doc, say: remove trailing =
I'm not at my office.
@jpmens commented on GitHub (Jan 30, 2023):
which doc?
@fred-gb commented on GitHub (Jan 30, 2023):
I found solution!
TL;DR:
To found this, thanks @jpmens you give me the way with:
I tried decode with my manually generated b64. And give me something like:
As you can see,
Basic(with space after) appears. It's that why double encode exists.And in NTFY docs # authentification in Query param part. you will find:
So to use the Ansible URI module as simplest example:
Voilà !
Thanks and hope that can help too.
@jpmens commented on GitHub (Jan 30, 2023):
I don't see how that is possible, in spite of the documentation saying so:
Truncating the
=characters renders the password inoperable. The padding is required, and the formula will only work if the username/password combination doesn't produce padding characters.@fred-gb commented on GitHub (Jan 30, 2023):
I found another thing. No needed to truncating
=That works too with:
Symbols
==appear only in the first encoding . And give something like:QmFzaWMgWm5KbFpEcHpaV055WlhRPQ==And after, you can encode again to make it work.
I don't understand really why but now, it's better!
Thanks