开源软件名称(OpenSource Name):bclindner/ivory开源软件地址(OpenSource Url):https://github.com/bclindner/ivory开源编程语言(OpenSource Language):Python 99.8%开源软件介绍(OpenSource Introduction):IvoryIvory is an automoderator and anti-spam tool for Mastodon admins. It automates handling certain trivial reports and new user requests using rules - configurable tests that check reports and pending users for bad usernames, malicious links, and more. Installation GuideThis installation guide assumes you know your way around a Linux terminal, have Python and Git installed, and maybe a little bit about common tech like Python and JSON formatting. InstallingIn a Linux terminal, the following commands will clone and install Ivory to whichever folder you're in. Make sure you have Git and Python installed: git clone https://github.com/bclindner/ivory
cd ivory
python -m venv .
source bin/activate
python -m pip install -r requirements.txt This repo also comes with a Dockerfile, so if you want to deploy with that, that works too: git clone https://github.com/bclindner/ivory
cd ivory
docker build -t ivory .
docker run -v /srv/ivory/ivory_config.json:/app/config.json ivory ConfigurationBefore starting Ivory, you need to create a new application in the Preferences
menu. Don't worry about setting redirect URIs or anything that isn't required -
just make sure you enable all of the Be EXTREMELY careful with handling the access token this generates - this key has a lot of power and in the wrong hands, this could mean someone completely obliterating your instance. Once you've done that, it's time to set up your config file. Configuring Ivory is done with JSON; a sample is below: {
"token": "<YOUR_ACCESS_TOKEN_HERE>",
"instanceURL": "<YOUR_INSTANCE_URL_HERE>",
"waitTime": 300,
"reports": {
"rules": [
{
"name": "No spam links",
"type": "link_resolver",
"blocked": ["evilspam\\.website", "dontmarry\\.com"],
"severity": 2,
"punishment": {
"type": "suspend",
"message": "Your account has been suspended for spamming."
}
},
{
"name": "No link-in-bio spammers",
"type": "bio_content",
"blocked": ["sexie.ru"],
"severity": 1,
"punishment": {
"type": "disable",
"message": "Your account has been disabled for spamming."
}
}
]
},
"pendingAccounts": {
"rules": [
{
"name": "No <a> tags",
"_comment": "Because honestly, you're definitely a bot if you're putting <a> tags into the field",
"type": "message_content",
"blocked": ["<a href=\".*\">.*</a>"],
"severity": 1,
"punishment": {
"type": "reject"
}
},
{
"name": "StopForumSpam test",
"type": "stopforumspam",
"threshold": 95,
"severity": 1,
"punishment": {
"type": "reject"
}
}
]
}
} A more in-depth guide to Ivory configuration and the list of rules and punishments can be found on the wiki. Ideally you only have to change this once in a blue moon, but if you do, you can
use the RunningAfter you've set up a config file, run the following in a Linux terminal:
Hopefully, no errors will be thrown and Ivory will start up and begin its first
moderation pass, reading the first page of active reports and pending users and
applying your set rules. Ivory will handle these queues every 300 seconds,
or 5 minutes. (This is controlled by the If you'd rather run it on some other schedule via a proper task scheduler like
cron or a systemd .timer unit, you can use
Extending (custom rules)You'll notice the The reports and pending accounts that Ivory rules receive are the same as what Mastodon.py provides for reports and admin accounts, respectively. Don't forget to use Once you've finished writing up your custom rule, say as
...
"pendingAccounts": {
"rules": [
{
"name": "An instance of my cool new rule",
"type": "filename_of_your_rule",
"custom_option": true,
"severity": 5,
"punishment": {
"type": "reject"
}
},
]
}
... If you come up with any useful rules and wouldn't mind writing a schema and some tests for it, making a pull request to include it in Ivory's main release would be highly appreciated! The more rules Ivory gets, the more tools are collectively available to other admins for dealing with spammers and other threats to the Fediverse at large. Bugs & ContributingIf you have any issues with Ivory not working as expected, please file a GitHub issue. Contributions are also welcome - send in pull requests if you have anything new to add. If you have any other questions, go ahead and ping me on Mastodon and I might be able to answer them. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论