Categorygithub.com/fabianwe/mailwebadmin
modulepackage
0.0.0-20170503012336-107e66b9c779
Repository: https://github.com/fabianwe/mailwebadmin.git
Documentation: pkg.go.dev

# README

mailwebadmin

mailwebadmin is a software used to administrate a mailserver (create accounts, delete accounts, administrate aliases, change passwords and so on). It requires a setup as described here, with one important difference: Currently only SHA-512 is supported and not SHA-256, but this is something that should be really easy to fix. If you want to use that feel free to contact me or write the code yourself and use a pull request.

The software is written in Go, but requires the Linux crypt(3). I've tested it on Debian and Ubuntu and it worked fine (sadly enough alpine does not work). It is also possible that it works under Windows, but I've never tested it. The wrapper can be found here.

The preferred way to install it is by using docker, there is a docker file (in this repository) and you can also pull directly from Docker Hub.

Information about the installation can be found on the project Wiki, the source code documentation is also available on GoDoc.

Current Version

The current version is 1.0, it hasn't been properly tested, but it should work (though it would be nice if someone reviews it especially regarding security).

License

The software is distributed under the MIT License, see the license page in the wiki for more information.

# Packages

No description provided by the author

# Functions

AddAlias adds a new alias, it returns the id of the alias in the table and any error that occcurred.
AddMailUser adds a new mail user.
AddVirtualDomain adds the domain to the database.
BootstrapAdminsTemplate is the template for the admins page.
BootstrapAliasesTemplate is the template for the alias page.
BootstrapChangePWTemplate is the template for the change email password site.
BootstrapDomainsTemplate is the template for the domains page.
BootstrapLicenseTemplate is the template for the license template.
BootstrapLoginTemplate is the template for the login page.
BootstrapUsersTemplate is the template for the users page.
ChangeSinglePasswordHandler returns on get the template for changing a single password (RenderChangePWTemplate) and on post calls ChangeSinglePw to update te password.
ChangeSinglePw reads a JSON encoded map from the body, it must have the form: {'mail': <Mail>, 'old_password': <Old>, 'new_password': <New>} It compares the old password with the one in the database, if this is not correct or the email doesn't exist it responds with a 400.
ChangeUserPassword changes the password for the user with the given id, it returns an error != nil if something went wrong.
CheckLogin checks the login data contained in the body of the request.
DelAlias deletes the alias with the given id.
DeleteVirtualDomain deletes the domain.
DelMailUser removes the user with the given id.
GenDovecotSHA512 generates the SHA512 hash of the given password.
GenKeyPair generates a new auth-key, encryption-key pair.
ListAdminsJSON is the main handler for /api/admins.
ListAliasesJSON is the main handler for /api/aliases.
ListAllUsers lists all users for a given domain.
ListDomainsJSON is the main handler for domains.
ListUsersJSON handles the /api/users domains.
ListVirtualAliases lists all virtual aliases given an domainID.
ListVirtualDomains returns a map containing all virtual domains in the form id --> name.
No description provided by the author
LoginPageHandler is a handler that returns the login template for GET and uses CheckLogin for POST.
LoginRequired takes a handler function and returns a new handler function that first checks if the login is correct.
Logout will set the MaxAge of the session to -1 and thus destroy the session.
NewListResultForVirtualAlias creates a new ListUserResult for a virtual alias.
NewListResultForVirtualUser creates a new ListUserResult for a virtual user.
NewMailAppHandler returns a new MailAppHandler.
ParseConfig parses the configuration file (called mailconf in the config dir).
ParseMailParts splits an email address and returns the part before the @, the domain and an error if this is not possible.
ReadKeyPairs reads the key pairs from the key files.
RenderAdminsTemplate renders the template appContext.Templates["admins"].
RenderAliasesTemplate renders the template appContext.Templates["aliases"].
RenderChangePWTemplate renders the template appContext.Templates["change-pw"].
RenderDomainsTemplate renders the template appContext.Templates["domains"].
RenderLicenseTemplate renders the template appContext.Templates["license"].
RenderLoginTemplate renders the template stored in appContext.Templates["login"].
RenderRootTemplate renders the template appContext.Templates["root"].
RenderUsersTemplate renders the template appContext.Templates["users"].
RootBootstrapTemplate is the template for the main page (/).
RootPageHandler is a handler that returns the root page.
StaticHandler is a http handler that serves files in the static directory.
WriteKeyPairs writes the key pairs to the file specified in path.

# Variables

ErrInvalidEmail is the error returned if an string is not a valid email address.

# Structs

Alias stores information about a virtual alias.
ListUserResult stores information about users.
MailAppContext stores all global options for all handlers.
MailAppHandler is the handler class for AppHandleFuncs.
VirtualUser stores information about a virtual user, the mail address and the virtual domain id.

# Type aliases

AppHandleFunc is a type for functions that accept a context as well as the request and response writer.