()
| 33 | ) |
| 34 | |
| 35 | func init() { |
| 36 | maddycli.AddSubcommand( |
| 37 | &cli.Command{ |
| 38 | Name: "creds", |
| 39 | Usage: "Local credentials management", |
| 40 | Description: `These commands manipulate credential databases used by |
| 41 | maddy mail server. |
| 42 | |
| 43 | Corresponding credential database should be defined in maddy.conf as |
| 44 | a top-level config block. By default the block name should be local_authdb ( |
| 45 | can be changed using --cfg-block argument for subcommands). |
| 46 | |
| 47 | Note that it is not enough to create user credentials in order to grant |
| 48 | IMAP access - IMAP account should be also created using 'imap-acct create' subcommand. |
| 49 | `, |
| 50 | Subcommands: []*cli.Command{ |
| 51 | { |
| 52 | Name: "list", |
| 53 | Usage: "List created credentials", |
| 54 | Flags: []cli.Flag{ |
| 55 | &cli.StringFlag{ |
| 56 | Name: "cfg-block", |
| 57 | Usage: "Module configuration block to use", |
| 58 | EnvVars: []string{"MADDY_CFGBLOCK"}, |
| 59 | Value: "local_authdb", |
| 60 | }, |
| 61 | }, |
| 62 | Action: func(ctx *cli.Context) error { |
| 63 | be, err := openUserDB(ctx) |
| 64 | if err != nil { |
| 65 | return err |
| 66 | } |
| 67 | defer closeIfNeeded(be) |
| 68 | return usersList(be, ctx) |
| 69 | }, |
| 70 | }, |
| 71 | { |
| 72 | Name: "create", |
| 73 | Usage: "Create user account", |
| 74 | Description: `Reads password from stdin. |
| 75 | |
| 76 | If configuration block uses auth.pass_table, then hash algorithm can be configured |
| 77 | using command flags. Otherwise, these options cannot be used. |
| 78 | `, |
| 79 | ArgsUsage: "USERNAME", |
| 80 | Flags: []cli.Flag{ |
| 81 | &cli.StringFlag{ |
| 82 | Name: "cfg-block", |
| 83 | Usage: "Module configuration block to use", |
| 84 | EnvVars: []string{"MADDY_CFGBLOCK"}, |
| 85 | Value: "local_authdb", |
| 86 | }, |
| 87 | &cli.StringFlag{ |
| 88 | Name: "password", |
| 89 | Aliases: []string{"p"}, |
| 90 | Usage: "Use `PASSWORD instead of reading password from stdin.\n\t\tWARNING: Provided only for debugging convenience. Don't leave your passwords in shell history!", |
| 91 | }, |
| 92 | &cli.StringFlag{ |
nothing calls this directly
no test coverage detected