ptpb / pb

pb is a formerly-lightweight pastebin and url shortener
Other
549 stars 52 forks source link

IP upload black/whitelist #233

Closed jerbmega closed 5 years ago

jerbmega commented 5 years ago

Is there a way to prevent certain IP's or identities from creating pastes on an instance, while still allowing them to view contents? I'm also wondering if the reverse of this is possible, only allowing whitelisted addresses/keys to upload.

buhman commented 5 years ago

You could do this with nginx.

https://docs.nginx.com/nginx/admin-guide/security-controls/blacklisting-ip-addresses/

It supports whitelist/blacklist depending on how you use allow all/deny all.

only allowing whitelisted addresses/keys to upload

limit_except GET {
    allow 1.2.3.4/32;
    deny all;
}

This reads like "for all methods other than GET, allow $ip, otherwise deny".