Skip to main content

pymap-admin

build PyPI PyPI platforms PyPI

The pymap-admin tool can be used to perform various admin functions against a running pymap server. This is a separate grpc service using grpclib listening on a socket.

API Documentation

Connections

By default, the pymap-admin command will attempt to interact with a pymap admin server over a UNIX socket, typically in /tmp/pymap/pymap-admin.sock. See the pymap-admin --help commands for other connection options.

Commands

save-args Command

When administering remote pymap servers, it can be cumbersome to always supply connection arguments every time, such as --host. This command saves the arguments it is given to a config file.

$ pymap-admin --host imap.example.com --port 50051 save-args
Config file written: /home/user/.config/pymap/pymap-admin.conf

login Command

Sends login credentials and gets a bearer token. See Authentication for more information.

$ pymap-admin login -is user@example.com
user@example.com Password:
result {
  response: ". OK Login completed."
}
bearer_token: "MDAwZWxvY2F0aW9uIAowMDMwaWRlbnRpZmllciA0ZmM4MD..."

ping Command

Pings the running server and reports its version string.

$ pymap-admin ping
pymap_version: "0.21.1"
pymap_admin_version: "0.5.2"

append Command

To append a message directly to a mailbox, without using IMAP, use the append admin command. First, check out the help:

$ pymap-admin append --help

As a basic example, you can append a message to a like this:

$ cat <<EOF | pymap-admin append demouser
> From: user@example.com
>
> test message!
> EOF
mailbox: "INBOX"
validity: 1784302999
uid: 101

2.0.0 Message delivered

User Commands

These commands access and manipulate the users on the system:

$ pymap-admin set-user --help
$ pymap-admin change-password --help
$ pymap-admin get-user --help
$ pymap-admin delete-user --help

Passing a username to get-user will display that user's metadata, including the (securely hashed) password string. A username can be deleted with delete-user. The set-user command will create or overwrite a username, its password, and other metadata. The change-password command can update only the password of an existing username.

If using pymap as part of the slimta-docker configuration, see its Address Management documentation for additional options.

Admin Role

The builtin pymap backends use a special role string "admin" to assign admin privileges to existing users. Without the admin role, a user may only use set-user to change their own password. A user with the admin role (or using the admin token) can make any change to any user.

$ pymap-admin set-user --role admin user@example.com

Authentication

Every command except ping requires authentication to perform. Most commands will send a macaroon token to authenticate, except for login which uses the credentials provided.

When running pymap-admin and pymap on the same machine, a temporary file containing an admin token is used by default, allowing unrestricted access to all operations. This token is verified in-memory and is only valid for the current pymap process.

To use this admin token on another machine, copy the PYMAP_ADMIN_TOKEN=... line printed out on pymap startup and prefix it to pymap-admin calls, e.g.:

$ PYMAP_ADMIN_TOKEN=... pymap-admin get-user user@example.com

Permanent Tokens

For a token that is not tied to the current pymap process, use the login with the credentials of a user in the system. The resulting token can be used to authenticate as that user in the future.

$ pymap-admin login -is user@example.com

The -s flag will cause the token to be saved and used on future pymap-admin commands. Use --token-file or $PYMAP_ADMIN_TOKEN_FILE to specify a location, otherwise it is saved to ~/.pymap-admin.token.

If -s is not given, the bearer_token value from the output can provided to future pymap-admin commands with $PYMAP_ADMON_TOKEN.

Metadata

Release files for pymap-admin 0.12.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymap-admin 0.12.1
File Size Uploaded
pymap_admin-0.12.1.tar.gz 31.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymap-admin 0.12.1
File Interpreter ABI Platform
pymap_admin-0.12.1-py3-none-any.whl Python 3 none any Details

Total release size: 72.5 kB

Release files / pymap_admin-0.12.1.tar.gz

Download URL pymap_admin-0.12.1.tar.gz
Size 31.2 kB
Tags Source
SHA-256 checksum
How to use checksums
14b3026d42f226641817c2c91c9b908bd3349072203cc8adcfe3dd76525d8d91
BLAKE2b-256 checksum
How to use checksums
e460df344f4b9fbd703a3afab0a7964d6138bf1d8d293118db2ce00fc3b887d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.24.1

Release files / pymap_admin-0.12.1-py3-none-any.whl

Download URL pymap_admin-0.12.1-py3-none-any.whl
Size 41.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c218b09395c1acc79d829bbb5d335175da652278397e9fdedecab443d9bc12c
BLAKE2b-256 checksum
How to use checksums
4fbfaf4dc7f612b79003ea1c1f590a1aa2df358a9df1687203af8cb2c2196260
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.24.1
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page