{"id":16243695,"url":"https://github.com/mhthies/managevmail","last_synced_at":"2025-04-08T11:00:17.442Z","repository":{"id":95230829,"uuid":"129402649","full_name":"mhthies/managevmail","owner":"mhthies","description":"Command line management interface for virtual mail accounts according to https://thomas-leister.de/mailserver-debian-stretch/ written in Python 3.","archived":false,"fork":false,"pushed_at":"2021-10-25T18:25:26.000Z","size":30,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-14T07:20:21.499Z","etag":null,"topics":["linux-server","mailserver","python","server-management","vmail"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mhthies.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":"2018-04-13T12:58:28.000Z","updated_at":"2021-10-25T18:25:29.000Z","dependencies_parsed_at":"2023-07-24T10:31:16.268Z","dependency_job_id":null,"html_url":"https://github.com/mhthies/managevmail","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhthies%2Fmanagevmail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhthies%2Fmanagevmail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhthies%2Fmanagevmail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhthies%2Fmanagevmail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhthies","download_url":"https://codeload.github.com/mhthies/managevmail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247829473,"owners_count":21002994,"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":["linux-server","mailserver","python","server-management","vmail"],"created_at":"2024-10-10T14:15:58.099Z","updated_at":"2025-04-08T11:00:17.355Z","avatar_url":"https://github.com/mhthies.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Command line management tool for vmail database\n\nThis Python script aims to provide a simple command line interface to manage virtual mail accounts in an MySQL database\nthat is organized as explained in the great tutorial of Thomas Leister:\n\nhttps://thomas-leister.de/mailserver-debian-stretch/\n\nThe database layout, he is proposing, includes a table `accounts` with information (name, password hash, quota, enabled\nflag, sendonly flag) on virtual mail accounts to be used by dovecot and a table `aliases` to be used by postfix for\nredirects. Managing them is somehow compilcated, as it requires dealing with cumbersome SQL queries and the additional\nusage of the `doveadm` command to hash passwords.\n\nThis script provides simple and dialog-oriented command line commands to get a quick overview over accounts and aliases\nand modify them.\n\nManagement of the `domains` and `tlspolicies` tables must (for now) still be done manually, which should be okay, since\nit is required rather rarely.\n\n\n## Install\n\nYou need Python 3 and the Python 3-MySQL-Connector:\n\n```\n$ apt install python3-pymysql\n```\n\nNow download the script (or clone it out from GitHub) and move it to any place you like. Move the configuration file\n`config.ini` to `/etc/managevmail/config.ini` (which is the default location) or any other place you like (which then\nrequires the `-c` parameter to use the script). Chmod the `config.ini` file, if neccessary, to be only readable for\nroot (or any user/group you want to empower to manage the vmail database).\n\n```\n$ install -D -m 640 config.ini /etc/managevmail/config.ini\n```\n\nCreate a MySQL user for the management, grant it SELECT, UPDATE, INSERT and DELETE privileges on the `vmail` database\nand enter the MySQL credentials into the `config.ini`:\n\n```\n\u003e CREATE USER managevmail@localhost IDENTIFIED BY '\u003cyour random password\u003e';\nQuery OK, 0 rows affected (0.08 sec)\n\n\u003e GRANT SELECT, UPDATE, INSERT, DELETE ON vmail.* TO managevmail@localhost;\nQuery OK, 0 rows affected (0.00 sec)\n\n```\n\n\n## Usage\n\nThe script is meant to be executed with root privileges. Actually, they are (by default) only required to fetch the\ncurrent quota usage with `doveadm` and delete mailbox directories of deleted accounts, while all other actions require\nonly access to the database, i.e. to read the config.ini file.\n\nThe basic syntax is:\n\n```\n$ managevmail.py [-c path/to/config.ini] COMMAND [ADDRESS]\n```\n\nThe commands are:\n\n| Command     | Description                                                                                                                                                |\n|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| list        | List all known accounts and aliases. Aliases are displays with their destination, disabled and sendonly addresses are flagged. Does not require an address |\n| show        | Show all relevant information on the account or the alias (or both) to the given address. This even queries the quota usage from Dovecot.                  |\n| add         | Add an account. Queries interactively for quota, enabled flag, sendonly flag and password.                                                                 |\n| change      | Change settings of an account. Queries interactively for quota, enabled flag and sendonly flag.                                                            |\n| pw          | Change password of an account. Queries interactively for the new password.                                                                                 |\n| delete      | Delete an account. Asks for confirmation, asks again for confirmation of mailbox deletion.                                                                 |\n| addalias    | Add an alias. Queries interactively for enabled flag and destination address.                                                                              |\n| changealias | Change settings of an alias. Queries interactively for enabled flag and destination address.                                                               |\n| deletealias | Delete an alias. Asks for confirmation.                                                                                                                    |\n\n\n### Examples\n\n```\n$ managevmail.py list\n                  cms@exmaple.com   [sendonly]\n                 info@example.com   → mail@example.com\n                 mail@example.com\n[dis]             old@example.com\n$\n$ managevmail.py addalias webmaster@example.com\nDestination address: mail@example.com\nEnable Alias? [Y/n] \nAlias has been created.\n$\n$ managevmail.py pw cms@example.com\nNew password: \nType password again: \nStored new password.\n$\n$ managevmail.py delete old@example.com\nDo you really want to delete the account old@example.com? [y/N] y\nAccount has been deleted.\nDo you want to delete the user's mailbox? [y/N] y\nAccount's Mailbox has been deleted.\n$\n$ managevmail.py show mail@example.com\nmail@example.com is an account:\nEnabled:     Yes\nSendonly:    No\nQuota:       512 MiB\nQuota used:  121.3 MiB (23.7 %)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhthies%2Fmanagevmail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhthies%2Fmanagevmail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhthies%2Fmanagevmail/lists"}