Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitelist / Blacklist pubkeys #15

Closed
pjv opened this issue Feb 5, 2023 · 12 comments
Closed

Whitelist / Blacklist pubkeys #15

pjv opened this issue Feb 5, 2023 · 12 comments

Comments

@pjv
Copy link

pjv commented Feb 5, 2023

Is there, or could there be, a way to configure strfry for whitelisting or blacklisting pubkeys allowing or disallowing posting to the instance?

@hoytech
Copy link
Owner

hoytech commented Feb 5, 2023

Currently there is not, but there should be, and I am working on it! I will update this ticket ASAP when this is ready.

@jb55
Copy link
Contributor

jb55 commented Feb 10, 2023

I want to build a paid damus relay and I would like to use strfry. would love if this was a thing! and a way to dynamically add users so I can create a payment interface.

@hoytech
Copy link
Owner

hoytech commented Feb 10, 2023

Nice! We're working on plugin system that will allow this. It's currently in the beta branch and a few people are testing it out, but probably not ready for serious production yet.

Here are the docs for plugins including an example of a whitelist:

https://github.com/hoytech/strfry/blob/beta/docs/plugins.md

@pjv
Copy link
Author

pjv commented Feb 10, 2023

Thanks @hoytech

let’s say I’m running strfry via docker-compose. Should bind mounting that plugin to the same path (/etc) as strfry.conf work?

@hoytech
Copy link
Owner

hoytech commented Feb 10, 2023

Hmm good question. I think that should probably work, as long as the container has all the dependencies it needs to execute the plugin script. For example, if your plugin is in node, you'll need the node binary and all npm modules you use to exist inside the container.

@pjv
Copy link
Author

pjv commented Feb 10, 2023

I’ll probably re-write it in python. Since the Dockerfile in this repo looks to be stock ubuntu, I assume it will have python3. Maybe I’ll put the plugin in /app instead of having an executable sitting in /etc which is kinda bad form.

@hoytech
Copy link
Owner

hoytech commented Feb 10, 2023

Makes sense. Yep I assume it will have a system python available so it should "just work". Let me know if not though!

@pjv
Copy link
Author

pjv commented Feb 12, 2023

@hoytech in fact, not. I guess the ubuntu:jammy docker image is pretty stripped down (which makes sense). I had to modify the Dockerfile like so:

SCR-20230212-be7

I have a lightly tested and seemingly working python adaptation of your whitelist.js example. After I get it tested better, maybe I’ll put it in a gist along with the modified Dockerfile and relevant strfry config to make it work under docker as I am running it.

@pjv
Copy link
Author

pjv commented Feb 12, 2023

Now running the beta [decc3ae] live as my semi-private relay with just a few hand-picked pubkeys allowed to post. The whitelist is rejecting lots of spam. So far, so good.

@hoytech
Copy link
Owner

hoytech commented Feb 13, 2023

Glad to hear it's working -- thanks for letting us know. A gist of instructions we can link to would be great!

@pjv
Copy link
Author

pjv commented Mar 30, 2023

@hoytech Took me a while to work out all the kinks, but here’s my repo that implements a docker-based personal relay server with strfry using the write policy plugin I developed. This may currently be the fastest, easiest way to get a nostr relay up and running.

@Giszmo
Copy link

Giszmo commented Jun 10, 2023

Is this issue up to date? docs/plugins.md is on master and https://gitlab.com/soapbox-pub/strfry-policies/ makes good use of it. With the latter, black- and white lists are easy to do.

@pjv pjv closed this as completed Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants