If you're setting up a private Nostr relay with strfry, you can use this small plugin to only provide write capabilities for your own pubkeys.
https://github.com/braydonf/strfry-writepolicy
It uses the strfrui library that can do a lot more if that is needed.