1
0
mirror of https://github.com/directorz/mailfull-go.git synced 2025-12-20 19:17:02 +00:00

10 Commits

Author SHA1 Message Date
teru
a3d3684fda Merge pull request #16 from directorz/feature/implements
Feature/implements
2016-08-22 15:20:37 +09:00
teru
c183bba7aa Bump version to v0.0.3 2016-08-22 15:19:59 +09:00
teru
b52a7cde7f Add support for creating GitHub Releases page 2016-08-22 15:15:08 +09:00
teru
0926ffd318 Change the path of session cache database 2016-08-18 20:33:19 +09:00
teru
c9201c8fc1 Fix README.md 2016-08-18 19:53:43 +09:00
teru
fe16bb86f9 Disable to delete postmaster #14 2016-08-18 19:53:16 +09:00
teru
bd6228197a cosmetic changes 2016-08-18 19:52:42 +09:00
teru
1329747f54 Merge pull request #15 from directorz/feature/documentation
Feature/documentation
2016-08-18 12:18:11 +09:00
teru
ab3c3315f9 Add configuration guide 2016-08-18 12:11:17 +09:00
teru
a76596c348 Add migration guide from directorz/mailfull #9 2016-08-18 12:09:44 +09:00
13 changed files with 135 additions and 19 deletions

7
.gitignore vendored
View File

@@ -1 +1,6 @@
/cli/mailfull/mailfull
/vendor
/build
/release
/github_token
/cmd/mailfull/mailfull

6
Gomfile Normal file
View File

@@ -0,0 +1,6 @@
gom 'github.com/BurntSushi/toml'
gom 'github.com/armon/go-radix'
gom 'github.com/bgentry/speakeasy'
gom 'github.com/jsimonetti/pwscheme'
gom 'github.com/mattn/go-isatty'
gom 'github.com/mitchellh/cli'

53
Makefile Normal file
View File

@@ -0,0 +1,53 @@
GOVERSION=$(shell go version)
GOOS=$(word 1,$(subst /, ,$(lastword $(GOVERSION))))
GOARCH=$(word 2,$(subst /, ,$(lastword $(GOVERSION))))
DIR_BUILD=build
DIR_RELEASE=release
VERSION=$(patsubst "%",%,$(lastword $(shell grep 'const Version' version.go)))
.PHONY: build build-linux-amd64 build-linux-386 clean
default: build
installdeps:
gom install
build:
go build -ldflags "-X main.gittag=`git rev-parse --short HEAD`" -v -o build/mailfull_$(GOOS)_$(GOARCH)/mailfull cmd/mailfull/main.go
build-linux-amd64:
docker run --rm -v $(PWD):/go/src/github.com/directorz/mailfull-go -w /go/src/github.com/directorz/mailfull-go \
-e GOOS=linux -e GOARCH=amd64 golang:1.7 \
go build -ldflags "-X main.gittag=`git rev-parse --short HEAD`" -v -o "build/mailfull_linux_amd64/mailfull" cmd/mailfull/main.go
build-linux-386:
docker run --rm -v $(PWD):/go/src/github.com/directorz/mailfull-go -w /go/src/github.com/directorz/mailfull-go \
-e GOOS=linux -e GOARCH=386 golang:1.7 \
go build -ldflags "-X main.gittag=`git rev-parse --short HEAD`" -v -o "build/mailfull_linux_386/mailfull" cmd/mailfull/main.go
release: release-linux-amd64 release-linux-386
release-linux-amd64: build-linux-amd64
@$(MAKE) release-doc release-targz GOOS=linux GOARCH=amd64
release-linux-386: build-linux-386
@$(MAKE) release-doc release-targz GOOS=linux GOARCH=386
release-doc:
cp -a README.md doc $(DIR_BUILD)/mailfull_$(GOOS)_$(GOARCH)
release-targz: dir-$(DIR_RELEASE)
tar zcfp $(DIR_RELEASE)/mailfull_$(GOOS)_$(GOARCH).tar.gz -C $(DIR_BUILD) mailfull_$(GOOS)_$(GOARCH)
dir-$(DIR_RELEASE):
mkdir -p $(DIR_RELEASE)
release-upload: release-linux-amd64 release-linux-386 release-github-token
ghr -u directorz -r mailfull-go -t $(shell cat github_token) --replace --draft $(VERSION) $(DIR_RELEASE)
release-github-token: github_token
@echo "file \"github_token\" is required"
clean:
-rm -rf $(DIR_BUILD)
-rm -rf $(DIR_RELEASE)

View File

@@ -39,6 +39,7 @@ Initialize a directory as a Mailfull repository.
```
$ mkdir /path/to/repo && cd /path/to/repo
$ mailfull init
$ mailfull commit
```
Generate configurations for Postfix and Dovecot. (Edit as needed.)
@@ -66,3 +67,8 @@ Add a new domain and user.
```
Enjoy!
More info
---------
See [documentation](doc/README.md)

View File

@@ -81,9 +81,9 @@ func (c *UserCheckPwCommand) Run(args []string) int {
}
if len(args) != 2 {
input, err1 := c.UI.AskSecret(fmt.Sprintf("Enter password for %s:", address))
if err1 != nil {
fmt.Fprintf(c.UI.ErrorWriter, "[ERR] %v\n", err1)
input, err := c.UI.AskSecret(fmt.Sprintf("Enter password for %s:", address))
if err != nil {
fmt.Fprintf(c.UI.ErrorWriter, "[ERR] %v\n", err)
return 1
}

View File

@@ -59,6 +59,11 @@ func (c *UserDelCommand) Run(args []string) int {
return 1
}
if userName == "postmaster" {
fmt.Fprintf(c.UI.ErrorWriter, "[ERR] Cannot delete postmaster.\n")
return 1
}
if err := repo.UserRemove(domainName, userName); err != nil {
fmt.Fprintf(c.UI.ErrorWriter, "[ERR] %v\n", err)
return 1

View File

@@ -81,14 +81,14 @@ func (c *UserPasswdCommand) Run(args []string) int {
}
if len(args) != 2 {
input1, err1 := c.UI.AskSecret(fmt.Sprintf("Enter new password for %s:", address))
if err1 != nil {
fmt.Fprintf(c.UI.ErrorWriter, "[ERR] %v\n", err1)
input1, err := c.UI.AskSecret(fmt.Sprintf("Enter new password for %s:", address))
if err != nil {
fmt.Fprintf(c.UI.ErrorWriter, "[ERR] %v\n", err)
return 1
}
input2, err2 := c.UI.AskSecret("Retype new password:")
if err2 != nil {
fmt.Fprintf(c.UI.ErrorWriter, "[ERR] %v\n", err2)
input2, err := c.UI.AskSecret("Retype new password:")
if err != nil {
fmt.Fprintf(c.UI.ErrorWriter, "[ERR] %v\n", err)
return 1
}
if input1 != input2 {
@@ -100,9 +100,9 @@ func (c *UserPasswdCommand) Run(args []string) int {
hashedPassword := mailfull.NeverMatchHashedPassword
if rawPassword != "" {
str, errHash := ssha.Generate(rawPassword, 4)
if errHash != nil {
fmt.Fprintf(c.UI.ErrorWriter, "[ERR] %v\n", errHash)
str, err := ssha.Generate(rawPassword, 4)
if err != nil {
fmt.Fprintf(c.UI.ErrorWriter, "[ERR] %v\n", err)
return 1
}
hashedPassword = str

5
doc/README.md Normal file
View File

@@ -0,0 +1,5 @@
Documentation
=============
- [Configuration](configuration.md)
- [Migrating from mailfull](migrating_from_mailfull.md)

12
doc/configuration.md Normal file
View File

@@ -0,0 +1,12 @@
Configuration
=============
`.mailfull/config`
| key | type | default | required | description |
|:----|:-----|:--------|:---------|:------------|
| dir_database | string | `"./etc"` | no | A relative path from repository dir (or a absolute path) |
| dir_maildata | string | `"./domains"` | no | A relative path from repository dir (or a absolute path) |
| username | string | The username who executed `mailfull init` | **yes** | It used for setting owner of database files and maildata files. |
| cmd_postalias | string | `"postalias"` | no | Command name or path |
| cmd_postmap | string | `"postmap"` | no | Command name or path |

View File

@@ -0,0 +1,24 @@
Migrating from mailfull
=======================
Migrating from [directorz/mailfull](https://github.com/directorz/mailfull)
Change directory to Mailfull directory.
```
# su - mailfull
$ cd /home/mailfull
```
Initialize a directory as a Mailfull repository.
```
$ mailfull init
```
Delete unnecessary files.
```
$ rm -rf .git .gitignore bin docs lib README.md README.ja.md
$ find domains -maxdepth 2 -name '.vforward' | xargs rm -f
```

View File

@@ -45,7 +45,7 @@ smtpd_sasl_path = private/auth
smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
#smtpd_tls_CAfile =
smtpd_tls_session_cache_database = btree:/etc/postfix/smtpd_scache
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtp_tls_security_level = may

View File

@@ -126,10 +126,10 @@ func OpenRepository(basePath string) (*Repository, error) {
for {
configDirPath := filepath.Join(rootPath, DirNameConfig)
fi, errStat := os.Stat(configDirPath)
if errStat != nil {
if errStat.(*os.PathError).Err != syscall.ENOENT {
return nil, errStat
fi, err := os.Stat(configDirPath)
if err != nil {
if err.(*os.PathError).Err != syscall.ENOENT {
return nil, err
}
} else {
if fi.IsDir() {

View File

@@ -1,4 +1,4 @@
package mailfull
// Version is a version number.
const Version = "0.0.2"
const Version = "v0.0.3"