MCPcopy Index your code
hub / github.com/foxcpp/maddy / init

Function init

internal/cli/ctl/users.go:35–167  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33)
34
35func init() {
36 maddycli.AddSubcommand(
37 &cli.Command{
38 Name: "creds",
39 Usage: "Local credentials management",
40 Description: `These commands manipulate credential databases used by
41maddy mail server.
42
43Corresponding credential database should be defined in maddy.conf as
44a top-level config block. By default the block name should be local_authdb (
45can be changed using --cfg-block argument for subcommands).
46
47Note that it is not enough to create user credentials in order to grant
48IMAP 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
76If configuration block uses auth.pass_table, then hash algorithm can be configured
77using 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{

Callers

nothing calls this directly

Calls 6

openUserDBFunction · 0.85
closeIfNeededFunction · 0.85
usersListFunction · 0.85
usersCreateFunction · 0.85
usersRemoveFunction · 0.85
usersPasswordFunction · 0.85

Tested by

no test coverage detected