{"id":27118053,"url":"https://github.com/royborgen/spamtrain","last_synced_at":"2025-04-07T06:50:03.832Z","repository":{"id":263892846,"uuid":"860081236","full_name":"royborgen/spamtrain","owner":"royborgen","description":"This script automates the process of teaching SpamAssassin to recognize spam and ham (non-spam) messages from users' mailboxes, while allowing for specific home directories to be excluded from processing using a skip list file","archived":false,"fork":false,"pushed_at":"2024-11-20T20:47:44.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-20T21:38:13.610Z","etag":null,"topics":["sa-learning","spam","spamassassin"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/royborgen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-19T19:35:38.000Z","updated_at":"2024-11-20T20:47:47.000Z","dependencies_parsed_at":"2024-11-20T21:52:21.281Z","dependency_job_id":null,"html_url":"https://github.com/royborgen/spamtrain","commit_stats":null,"previous_names":["royborgen/spamtrain"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royborgen%2Fspamtrain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royborgen%2Fspamtrain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royborgen%2Fspamtrain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royborgen%2Fspamtrain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/royborgen","download_url":"https://codeload.github.com/royborgen/spamtrain/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608149,"owners_count":20965950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sa-learning","spam","spamassassin"],"created_at":"2025-04-07T06:50:03.152Z","updated_at":"2025-04-07T06:50:03.781Z","avatar_url":"https://github.com/royborgen.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpamAssassin Learning Script\n\nThis script automates the process of teaching SpamAssassin to recognize spam and ham (non-spam) messages from users' mailboxes, while allowing for specific home directories to be excluded from processing using a skip list file.\n\n## How It Works\n\n1. **Skip List File:**\n   - The script reads a file named `skip_folders.txt`, which should be placed in the same directory as the script.\n   - The `skip_folders.txt` file contains a list of home folder names (one per line) that should be excluded from processing.\n   - If no skip list file is found, the script will process all home directories.\n\n2. **Spam and Ham Classification:**\n   - For each user's home directory (except those listed in the skip list), the script processes two mail folders:\n     - `Maildir/.Junk`: Messages in this folder are learned as spam using `sa-learn --spam`.\n     - `Maildir/cur`: Messages in this folder are learned as ham (non-spam) using `sa-learn --ham`.\n\n3. **Skipped Folders:**\n   - Any home folder listed in the `skip_folders.txt` file is skipped during processing.\n   - After processing, the script outputs a list of skipped folders.\n\n4. **Synchronization:**\n   - After processing all folders, the script synchronizes the SpamAssassin Bayes database using `sa-learn --sync`.\n\n## Example `skip_folders.txt`:\n```\nuser3\nlost+found\n```\n\n\n## Prerequisites\n\n- **SpamAssassin** must be installed and configured on the system.\n- Mail folders should be in the default `Maildir` format under each user's home directory.\n\n## Usage\n\n1. Clone the repository or download the script.\n2. Ensure the `skip_folders.txt` file is in the same directory as the script.\n3. Make the script executable:\n   ```bash\n   chmod +x script_name.sh\n    ```\n4. Run the script as a superuser (root) to process all home directories:\n`sudo ./script_name.sh`\n\n## Output\n- The script prints progress as it processes each folder, including spam/ham learning status.\n- At the end of the run, it lists any folders that were skipped based on the skip_folders.txt file.\n- The script also outputs when the SpamAssassin database is synchronized.\n\n## Example Output  \n```\nEntering /home/user1\nProcessing /home/user1/Maildir/.Junk\nLearning messages as spam\nProcessing /home/user1/Maildir/cur\nLearning messages as ham (non-spam)\n\n\nEntering /home/user2\nProcessing /home/user2/Maildir/.Junk\nLearning messages as spam\nProcessing /home/user2/Maildir/cur\nLearning messages as ham (non-spam)\n\n\nThe following folders were skipped due to exclusion in /path/to/skip_folders.txt:\nuser3\nlost+found\n\nSynchronizing the database and the journal\nDone :)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froyborgen%2Fspamtrain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froyborgen%2Fspamtrain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froyborgen%2Fspamtrain/lists"}