1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-11-05 11:25:54 +00:00
nyaa/migrations/versions
Nicolas F a38e5d5b53 Implement range bans (#478)
* Implement range bans

People connecting from banned IP ranges are unable to upload
torrents anonymously, and need to manually have their accounts
activated.

This adds a new table "rangebans", and a command line utility,
"rangeban.py", which can be used to add, list and remove rangebans
from the command line.

As an example:

./rangeban.py ban 192.168.0.0/24

This would rangeban anything in this /24.

The temporary_tor column allows automated scripts to clean out and
re-add ever-changing sets of ranges to be banned without affecting
the other ranges.

This has only been tested for IPv4.

* Revise Rangebans

Add an id column, and change "temporary_tor" to "temp". Also
index masked_cidr and mask.

* rangebans: fix enabled and the binary op

kill me

* Add enabling/disabling bans to rangeban.py

* rangebans: fail earlier on garbage arguments

* rangebans: fix linter errors

* rangeban.py: don't shadow builtin keyword 'id'

* rangebans: change temporary ban logic, column

The 'temp' column is now a nullable time column. If the field is
null, the ban is understood to be permanent. If there is a time
in there, it's understood to be the creation time of the ban.

This allows scripts to e.g. delete all temporary bans older than
a certain amount of time.

Also, rename the '_cidr_string' column to 'cidr_string', because
reasons.

* rangeban.py: use ip_address to parse CIDR subnet

* rangebans: fixes to the mask calculation and query

Both were not bugs per-se, but just technically not needed/correct.

* De-meme apparently
2018-06-29 20:15:04 -07:00
..
1add911660a6_admin_log_added.py Admin Log 2.0 (#283) 2017-07-04 23:13:59 -05:00
2bceb2cb4d7c_add_comment_count_to_torrent.py Update comment count migration, calculate initial counts during upgrade 2017-05-27 22:46:35 +03:00
6cc823948c5a_add_trackerapi.py site-specific changes for new tracker (#453) 2018-02-12 15:52:35 -08:00
7f064e009cab_add_report_table.py Add Alembic migration for report tables 2017-05-29 17:05:17 +03:00
97ddefed1834_initial_database_state.py Add initial database state for Alembic, update existing migrations 2017-05-27 18:14:43 +03:00
3001f79b7722_add_torrents.uploader_ip.py API Info (#157) 2017-06-03 23:57:53 +03:00
500117641608_add_bans.py Better bans (#341) 2017-08-25 18:53:35 -04:00
b61e4f6a88cc_del_torrents_info.py fix migration 2018-02-02 20:53:46 +01:00
b79d2fcafd88_comment_text.py Increase maximum comment size from 255 to 1024. 2017-08-14 19:08:36 +02:00
cf7bf6d0e6bd_add_edited_time_to_comments.py [Schema+config change] Comment editing (#396) 2017-11-05 16:26:30 +02:00
d0eeb8049623_add_comments.py Add initial database state for Alembic, update existing migrations 2017-05-27 18:14:43 +03:00
f69d7fec88d6_add_rangebans.py Implement range bans (#478) 2018-06-29 20:15:04 -07:00
ffd23e570f92_add_is_webseed_to_trackers.py [Schema change] Add webseed support (BEP-19) (#317) 2017-07-30 00:00:39 +03:00