Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:tecdoc:abusenotif [2021/03/17 16:13] jomat created |
en:tecdoc:abusenotif [2021/08/22 10:04] (current) jomat [Content Reports] |
||
---|---|---|---|
Line 2: | Line 2: | ||
<code - nginx.conf> | <code - nginx.conf> | ||
- | location | + | |
- | #limit_req zone=limitregister burst=5; | + | proxy_pass http:// |
- | client_max_body_size 100M; | + | |
- | client_body_buffer_size 100M; | + | |
- | + | ||
- | proxy_pass http:// | + | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
- | proxy_set_header Host | + | proxy_set_header Host $host; |
- | proxy_set_header X-Real-IP $remote_addr; | + | |
- | proxy_set_header X-Forwarded-Proto $scheme; | + | |
- | proxy_set_header X-Forwarded-Ssl on; | + | |
- | proxy_set_header X-SSL 1; | + | |
body_filter_by_lua_block { | body_filter_by_lua_block { | ||
local proc = io.popen('/ | local proc = io.popen('/ | ||
Line 25: | Line 17: | ||
# | # | ||
+ | # access token of @abuse:… | ||
AT=' | AT=' | ||
+ | # admin room to send notifications to | ||
ROOM=' | ROOM=' | ||
- | IP=$1 | + | # ip of the new user, with gdpr redaction to /24 |
+ | IP=`echo $1|cut -d. -f1-3`.0 | ||
+ | |||
+ | #read stdin | ||
SI=`/ | SI=`/ | ||
- | echo `date` $SI >> / | + | #try to retrieve new user id |
U=`echo $SI|jq -r .user_id` | U=`echo $SI|jq -r .user_id` | ||
Line 35: | Line 32: | ||
[ " | [ " | ||
+ | # send notification | ||
curl -X PUT " | curl -X PUT " | ||
+ | </ | ||
+ | |||
+ | ====== Content Reports ====== | ||
+ | <code - nginx.conf> | ||
+ | location ~ ^/ | ||
+ | proxy_pass http:// | ||
+ | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
+ | proxy_set_header Host $host; | ||
+ | rewrite_by_lua ' | ||
+ | if ngx.var.request_method == " | ||
+ | os.execute("/ | ||
+ | end | ||
+ | '; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <code - / | ||
+ | #!/bin/sh | ||
+ | |||
+ | AT=' | ||
+ | ROOM=' | ||
+ | |||
+ | # log abuse reports | ||
+ | echo date $* >> / | ||
+ | |||
+ | # TODO: abuse reports should be forwarded to appropriate admins or | ||
+ | # abuse contacts. since some servers don't implement MSC 1929 | ||
+ | # an idea is to implement a semi automatic filled db of some kind | ||
+ | # | ||
+ | # abuse@matrix.org: | ||
+ | |||
+ | curl -X PUT " | ||
</ | </ |