This looks like the best guide to setting up a relay to start with
https://github.com/BlockChainCaffe/Nostr-Relay-Setup-Guide
But there's not really any mention of configuration or black/whitelisting. Maybe it's in the code, but it's written in tranny Rust and likely way overcomplicated, so I don't really care to delve into it. Maybe there's a Go relay with similar capabilities.