Add white list policy
This commit is contained in:
parent
b97720cbd7
commit
c1f1cfe066
|
@ -1,21 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cat << EOF > relay.yaml
|
sed \
|
||||||
# this is the path that the object graph will get dumped to (in JSON-LD format),
|
-e "s/__PORT__/${PORT:-5000}/g" \
|
||||||
# you probably shouldn't change it, but you can if you want.
|
-e "s/__HOSTNAME__/$HOSTNAME/g" \
|
||||||
db: files/relay.jsonld
|
relay_template.yaml > relay.yaml
|
||||||
|
|
||||||
# Listener
|
|
||||||
listen: 0.0.0.0
|
|
||||||
port: ${PORT:-5000}
|
|
||||||
|
|
||||||
# Note
|
|
||||||
note: "Make a note about your instance here."
|
|
||||||
|
|
||||||
# this section is for ActivityPub
|
|
||||||
ap:
|
|
||||||
# this is used for generating activitypub messages, as well as instructions for
|
|
||||||
# linking AP identities. it should be an SSL-enabled domain reachable by https.
|
|
||||||
host: '$HOSTNAME'
|
|
||||||
blocked_instances: []
|
|
||||||
EOF
|
|
||||||
|
|
|
@ -35,7 +35,11 @@ from . import app, CONFIG
|
||||||
from .remote_actor import fetch_actor
|
from .remote_actor import fetch_actor
|
||||||
|
|
||||||
|
|
||||||
AP_CONFIG = CONFIG.get('ap', {'host': 'localhost','blocked_instances':[]})
|
AP_CONFIG = CONFIG.get('ap', {
|
||||||
|
'host': 'localhost',
|
||||||
|
'blocked_instances': [],
|
||||||
|
'allowed_instances': [],
|
||||||
|
})
|
||||||
CACHE_SIZE = CONFIG.get('cache-size', 16384)
|
CACHE_SIZE = CONFIG.get('cache-size', 16384)
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,6 +222,10 @@ async def handle_follow(actor, data, request):
|
||||||
if urlsplit(inbox).hostname in AP_CONFIG['blocked_instances']:
|
if urlsplit(inbox).hostname in AP_CONFIG['blocked_instances']:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if AP_CONFIG['allowed_instances'] and\
|
||||||
|
urlsplit(inbox).hostname not in AP_CONFIG['allowed_instances']:
|
||||||
|
return
|
||||||
|
|
||||||
if inbox not in following:
|
if inbox not in following:
|
||||||
following += [inbox]
|
following += [inbox]
|
||||||
DATABASE['relay-list'] = following
|
DATABASE['relay-list'] = following
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
# this is the path that the object graph will get dumped to (in JSON-LD format),
|
||||||
|
# you probably shouldn't change it, but you can if you want.
|
||||||
|
db: files/relay.jsonld
|
||||||
|
|
||||||
|
# Listener
|
||||||
|
listen: 0.0.0.0
|
||||||
|
port: __PORT__
|
||||||
|
|
||||||
|
# Note
|
||||||
|
note: "Make a note about your instance here."
|
||||||
|
|
||||||
|
# this section is for ActivityPub
|
||||||
|
ap:
|
||||||
|
# this is used for generating activitypub messages, as well as instructions for
|
||||||
|
# linking AP identities. it should be an SSL-enabled domain reachable by https.
|
||||||
|
host: '__HOSTNAME__'
|
||||||
|
blocked_instances: []
|
||||||
|
allowed_instances:
|
||||||
|
- edge.twingyeo.kr
|
||||||
|
- planet.moe
|
||||||
|
- qdon.space
|
||||||
|
- twingyeo.kr
|
||||||
|
- uri.life
|
Loading…
Reference in New Issue