Package: pymap-admin
pymap-adminThepymap-admintool can be used to perform various admin functions against a
running pymap server. This is a separategrpcservice usinggrpcliblistening on a socket.API DocumentationConnectionsBy default, thepymap-admincommand will attempt to interact with a pymap
admin server over a UNIX socket, typically in/tmp/pymap/pymap-admin.sock.
See thepymap-admin --helpcommands for other connection options.Commandssave-argsCommandWhen 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--hostimap.example.com--port50051save-argsConfig file written: /home/user/.config/pymap/pymap-admin.confloginCommandSends login credentials and gets a bearer token. SeeAuthenticationfor more information.$pymap-adminlogin-isuser@example.comuser@example.com Password:result {response: ". OK Login completed."}bearer_token: "MDAwZWxvY2F0aW9uIAowMDMwaWRlbnRpZmllciA0ZmM4MD..."pingCommandPings the running server and reports its version string.$pymap-adminpingpymap_version: "0.21.1"pymap_admin_version: "0.5.2"appendCommandTo append a message directly to a mailbox, without using IMAP, use theappendadmin command. First, check out the help:$pymap-adminappend--helpAs a basic example, you can append a message to a like this:$cat<<EOF|pymap-adminappenddemouser> From: user@example.com>> test message!> EOFmailbox: "INBOX"validity: 1784302999uid: 1012.0.0 Message deliveredUser CommandsThese commands access and manipulate the users on the system:$pymap-adminset-user--help$pymap-adminchange-password--help$pymap-adminget-user--help$pymap-admindelete-user--helpPassing a username toget-userwill display that user's metadata, including
the (securely hashed) password string. A username can be deleted withdelete-user. Theset-usercommand will create or overwrite a username, its
password, and other metadata. Thechange-passwordcommand can update only the
password of an existing username.If using pymap as part of theslimta-dockerconfiguration, see itsAddress Managementdocumentation for additional options.Admin RoleThe builtin pymap backends use a special role string "admin" to assign admin
privileges to existing users. Without the admin role, a user may only useset-userto change their own password. A user with the admin role (or using
the admin token) can make any change to any user.$pymap-adminset-user--roleadminuser@example.comAuthenticationEvery command exceptpingrequires authentication to
perform. Most commands will send amacaroontoken to authenticate, except
forloginwhich uses the credentials provided.When runningpymap-adminandpymapon 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 thecurrentpymapprocess.To use this admin token on another machine, copy thePYMAP_ADMIN_TOKEN=...line printed out onpymapstartup and prefix it topymap-admincalls, e.g.:$PYMAP_ADMIN_TOKEN=...pymap-adminget-useruser@example.comPermanent TokensFor a token that is not tied to the currentpymapprocess, use theloginwith the credentials of a user in the system. The
resulting token can be used to authenticate as that user in the future.$pymap-adminlogin-isuser@example.comThe-sflag will cause the token to be saved and used on futurepymap-admincommands. Use--token-fileor$PYMAP_ADMIN_TOKEN_FILEto specify a
location, otherwise it is saved to~/.pymap-admin.token.If-sis not given, thebearer_tokenvalue from the output can provided to
futurepymap-admincommands with$PYMAP_ADMON_TOKEN.