mirror of
https://github.com/directorz/mailfull-go.git
synced 2025-12-18 10:07:03 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d2183e030 | ||
|
|
3bd25102e4 | ||
|
|
624579aed5 | ||
|
|
0f0a3835fc | ||
|
|
a145712856 | ||
|
|
ad18a41b64 | ||
|
|
ac6a8526b1 | ||
|
|
067c8f6903 | ||
|
|
e7254c6df6 | ||
|
|
8ecd1f0f79 | ||
|
|
de6ddf7e1b | ||
|
|
58b508b7fa | ||
|
|
36f6eb22d2 | ||
|
|
78ba1d2674 | ||
|
|
b4461b66ca | ||
|
|
afb8e4eaf4 | ||
|
|
4c9781ad71 | ||
|
|
e32523d0b2 | ||
|
|
188be4c3e8 | ||
|
|
de4bddc161 | ||
|
|
f618eb24e6 | ||
|
|
096193d93d | ||
|
|
e32ed61771 |
38
Gopkg.lock
generated
38
Gopkg.lock
generated
@@ -4,19 +4,32 @@
|
||||
[[projects]]
|
||||
name = "github.com/BurntSushi/toml"
|
||||
packages = ["."]
|
||||
revision = "99064174e013895bbd9b025c31100bd1d9b590ca"
|
||||
revision = "b26d9c308763d68093482582cea63d69be07a0f0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/armon/go-radix"
|
||||
packages = ["."]
|
||||
revision = "4239b77079c7b5d1243b7b4736304ce8ddb6f0f2"
|
||||
revision = "1fca145dffbcaa8fe914309b1ec0cfc67500fe61"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/bgentry/speakeasy"
|
||||
packages = ["."]
|
||||
revision = "a1ccbf2c40dfc8ce514b5c5c6e6d1429ea6880da"
|
||||
revision = "4aabc24848ce5fd31929f7d1e4ea74d3709c14cd"
|
||||
version = "v0.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/hashicorp/errwrap"
|
||||
packages = ["."]
|
||||
revision = "7554cd9344cec97297fa6649b055a8c98c2a1e55"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/hashicorp/go-multierror"
|
||||
packages = ["."]
|
||||
revision = "b7773ae218740a7be65057fc60b366a49b538a44"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -27,18 +40,31 @@
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-isatty"
|
||||
packages = ["."]
|
||||
revision = "66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8"
|
||||
revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
|
||||
version = "v0.0.3"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/mitchellh/cli"
|
||||
packages = ["."]
|
||||
revision = "fcf521421aa29bde1d93b6920dfce826d7932208"
|
||||
revision = "518dc677a1e1222682f4e7db06721942cb8e9e4c"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/posener/complete"
|
||||
packages = [
|
||||
".",
|
||||
"cmd",
|
||||
"cmd/install",
|
||||
"match"
|
||||
]
|
||||
revision = "98eb9847f27ba2008d380a32c98be474dea55bdf"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
revision = "8f0908ab3b2457e2e15403d3697c9ef5cb4b57a9"
|
||||
revision = "cc7307a45468e49eaf2997c890f14aa03a26917b"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
|
||||
32
Makefile
32
Makefile
@@ -9,10 +9,11 @@ DIR_RELEASE=release
|
||||
VERSION=$(patsubst "%",%,$(lastword $(shell grep 'const Version' version.go)))
|
||||
GITTAG=$(shell git rev-parse --short HEAD)
|
||||
|
||||
.PHONY: build build-linux-amd64 build-linux-386 clean
|
||||
|
||||
default: build
|
||||
|
||||
FORCE:
|
||||
.PHONY: FORCE
|
||||
|
||||
$(DIR_BUILD)/bin/$(THIS_GOOS)_$(THIS_GOARCH)/dep:
|
||||
mkdir -p /tmp/go
|
||||
GOPATH=/tmp/go go get -d -v github.com/golang/dep
|
||||
@@ -21,16 +22,25 @@ $(DIR_BUILD)/bin/$(THIS_GOOS)_$(THIS_GOARCH)/dep:
|
||||
|
||||
dep: $(DIR_BUILD)/bin/$(THIS_GOOS)_$(THIS_GOARCH)/dep
|
||||
|
||||
installdeps: dep
|
||||
$(DIR_BUILD)/bin/$(THIS_GOOS)_$(THIS_GOARCH)/dep ensure -v
|
||||
$(DIR_BUILD)/bin/$(THIS_GOOS)_$(THIS_GOARCH)/ghr:
|
||||
mkdir -p /tmp/go
|
||||
GOPATH=/tmp/go go get -d -v github.com/tcnksm/ghr
|
||||
GOPATH=/tmp/go go build -v -o $(DIR_BUILD)/bin/$(THIS_GOOS)_$(THIS_GOARCH)/ghr github.com/tcnksm/ghr
|
||||
rm -rf /tmp/go
|
||||
|
||||
build:
|
||||
go build -v -i -ldflags "-X main.gittag=$(GITTAG)" -o $(DIR_BUILD)/mailfull_$(GOOS)_$(GOARCH)/mailfull cmd/mailfull/*.go
|
||||
ghr: $(DIR_BUILD)/bin/$(THIS_GOOS)_$(THIS_GOARCH)/ghr
|
||||
|
||||
installdeps: dep
|
||||
$(DIR_BUILD)/bin/$(THIS_GOOS)_$(THIS_GOARCH)/dep ensure -v -vendor-only
|
||||
|
||||
|
||||
build: FORCE
|
||||
go build -v -ldflags "-X main.gittag=$(GITTAG)" -o $(DIR_BUILD)/mailfull_$(GOOS)_$(GOARCH)/mailfull cmd/mailfull/*.go
|
||||
|
||||
.build-docker:
|
||||
docker run --rm -v $(DIR_PKG):/go/pkg -v $(PWD):/go/src/github.com/directorz/mailfull-go -w /go/src/github.com/directorz/mailfull-go \
|
||||
-e GOOS=$(GOOS) -e GOARCH=$(GOARCH) golang:1.8.3 \
|
||||
go build -v -i -ldflags "-X main.gittag=$(GITTAG)" -o $(DIR_BUILD)/mailfull_$(GOOS)_$(GOARCH)/mailfull cmd/mailfull/*.go
|
||||
-e GOOS=$(GOOS) -e GOARCH=$(GOARCH) golang:1.10 \
|
||||
go build -v -ldflags "-X main.gittag=$(GITTAG)" -o $(DIR_BUILD)/mailfull_$(GOOS)_$(GOARCH)/mailfull cmd/mailfull/*.go
|
||||
|
||||
build-linux-amd64:
|
||||
@$(MAKE) .build-docker GOOS=linux GOARCH=amd64
|
||||
@@ -38,6 +48,7 @@ build-linux-amd64:
|
||||
build-linux-386:
|
||||
@$(MAKE) .build-docker GOOS=linux GOARCH=386
|
||||
|
||||
|
||||
release: release-linux-amd64 release-linux-386
|
||||
|
||||
release-linux-amd64: build-linux-amd64
|
||||
@@ -55,12 +66,13 @@ release-targz: dir-$(DIR_RELEASE)
|
||||
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-upload: ghr release-linux-amd64 release-linux-386 release-github-token
|
||||
$(DIR_BUILD)/bin/$(THIS_GOOS)_$(THIS_GOARCH)/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)
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"github.com/directorz/mailfull-go"
|
||||
"github.com/directorz/mailfull-go/cmd"
|
||||
@@ -22,8 +23,9 @@ var (
|
||||
|
||||
func init() {
|
||||
if gittag != "" {
|
||||
version = version + "-" + gittag
|
||||
version += "-" + gittag
|
||||
}
|
||||
version += fmt.Sprintf(" (built with %s)", runtime.Version())
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -3,3 +3,4 @@ Documentation
|
||||
|
||||
- [Configuration](configuration.md)
|
||||
- [Migrating from mailfull](migrating_from_mailfull.md)
|
||||
- [Commands Guide 日本語](commands_guide_ja.md)
|
||||
|
||||
200
doc/commands_guide_ja.md
Normal file
200
doc/commands_guide_ja.md
Normal file
@@ -0,0 +1,200 @@
|
||||
# Mailfull の使い方
|
||||
|
||||
* ユーザは `mailfull` にて実行してください。
|
||||
* すべてのコマンドは、`-h` オプションで簡単な使用方法を出力して終了します。
|
||||
* すべてのコマンドは、`-v` オプションでバージョンを出力して終了します。
|
||||
* `-n` オプションでデータベースをアップデートしません。(直ちに変更を行いません)
|
||||
|
||||
|
||||
## ドメイン
|
||||
|
||||
### ドメインの追加
|
||||
|
||||
$ mailfull2 domainadd example.com
|
||||
|
||||
`example.com` が追加され、`postmaster@example.com` が追加されます。
|
||||
`postmaster@example.com` のパスワードは付与されませんので `userpasswd` コマンドで対応してください。
|
||||
|
||||
### ドメインの削除
|
||||
|
||||
$ mailfull2 domaindel example.com
|
||||
`example.com` が削除されます。
|
||||
ドメインディレクトリは同階層にドット付きでバックアップされます。
|
||||
|
||||
### ドメインのリストアップ
|
||||
|
||||
$ mailfull2 domains
|
||||
|
||||
設定されているドメインがリストアップされます。
|
||||
|
||||
|
||||
## ユーザ
|
||||
|
||||
### ユーザの追加
|
||||
|
||||
$ mailfull2 useradd user@example.com
|
||||
|
||||
`user@example.com` が追加されます。
|
||||
パスワードは付与されませんので `userpasswd` コマンドで対応してください。
|
||||
|
||||
SMTP-AUTH, POP/IMAP のユーザ名は、`user@example.com` となります。
|
||||
|
||||
### ユーザの削除
|
||||
|
||||
$ mailfull2 userdel user@example.com
|
||||
|
||||
`postmaster` は削除できません。
|
||||
ユーザディレクトリは同階層にドット付きバックアップされます。
|
||||
|
||||
### パスワードの変更
|
||||
|
||||
$ mailfull2 userpasswd user@example.com
|
||||
Enter new password for user@example.com:
|
||||
Retype new password:
|
||||
|
||||
`user@example.com` のパスワードを設定、変更します。
|
||||
|
||||
### ユーザのリストアップ
|
||||
|
||||
$ mailfull2 users example.com
|
||||
|
||||
`example.com` のユーザがリストアップされます。
|
||||
|
||||
### パスワードのチェック
|
||||
|
||||
$ mailfull2 usercheckpw user@example.com
|
||||
Enter password for user@example.com:
|
||||
The password you entered is correct.
|
||||
$ echo $?
|
||||
0
|
||||
|
||||
$ mailfull2 usercheckpw user@example.com
|
||||
Enter password for user@example.com:
|
||||
The password you entered is incorrect.
|
||||
$ echo $?
|
||||
1
|
||||
|
||||
パスワードは引数で与えることもできます。
|
||||
パスワードの正誤に応じたメッセージが表示されます。
|
||||
コマンドの戻り値として、正しい場合 0、違う場合 1 が戻ります。
|
||||
|
||||
|
||||
## エイリアス
|
||||
|
||||
### エイリアスの新設
|
||||
|
||||
$ maulfull2 aliasuseradd aliasname@example.com dest@example.org[,...]
|
||||
|
||||
`aliasname@example.com` 宛のメールを `dest@example.org` へ転送するエイリアスを作成します。
|
||||
|
||||
### エイリアスの編集
|
||||
|
||||
$ maulfull2 aliasusermod aliasname@example.com dest2@example.org[,...]
|
||||
|
||||
`aliasname@example.com` 宛のメールを `dest2@example.org` へ転送するエイリアスへ書き換えます。
|
||||
|
||||
### エイリアスの解除
|
||||
|
||||
$ mailfull2 aliasuserdel aliasname@example.com
|
||||
|
||||
`aliasname@example.com` のエイリアス設定を削除します。
|
||||
|
||||
### エイリアスのリストアップ
|
||||
|
||||
$ mailfull2 aliasusers example.com
|
||||
|
||||
ドメインに設定されているエイリアスのリストが出力されます。
|
||||
|
||||
|
||||
## メーリングリスト
|
||||
|
||||
### メーリングリストの一覧
|
||||
|
||||
$ mailfull2 mailinglists example.com
|
||||
|
||||
`example.com` のMLがリストアップされます。
|
||||
|
||||
### メーリングリストの新規作成
|
||||
|
||||
$ mailfull2 mailinglistadd example.com ml user@example.com
|
||||
|
||||
`ml@example.com` というメーリングリストを作成し、メンバーに `user@example.com` を含めます。
|
||||
|
||||
### 既存のメーリングリストに配信先を追加
|
||||
|
||||
$ mailfull2 mailinglistuseradd example.com ml user2@example.com
|
||||
|
||||
`ml@example.com` というメーリングリストに、メンバーに `user2@example.com` を追加します。
|
||||
|
||||
### 既存のメーリングリストの配信先を確認
|
||||
|
||||
$ mailfull2 mailinglistusers example.com ml
|
||||
|
||||
`ml@example.com` というメーリングリストのメンバーを確認します。
|
||||
|
||||
### 既存のメーリングリストから配信先を削除
|
||||
|
||||
$ mailfull2 mailinglistuserdel example.com ml user@example.com
|
||||
|
||||
`ml@example.com` というメーリングリストから、メンバー `user@example.com` を削除します。
|
||||
|
||||
### メーリングリストの削除
|
||||
|
||||
$ mailfull2 mailinglistdel example.com ml
|
||||
|
||||
`ml@example.com` というメーリングリストを削除します。
|
||||
|
||||
## キャッチオール
|
||||
|
||||
### キャッチオールの設定
|
||||
|
||||
$ mailfull2 catchallset example.com user
|
||||
|
||||
`example.com` の全てのユーザ宛のメールを、
|
||||
ユーザが存在しなければ、`user@example.com` が受け取るようになります。
|
||||
|
||||
### キャッチオールの解除
|
||||
|
||||
$ mailfull2 catchalldel example.com
|
||||
|
||||
`example.com` に設定されているキャッチオールを解除します。
|
||||
|
||||
### キャッチオールの取得
|
||||
|
||||
$ mailfull2 catchall example.com
|
||||
|
||||
`example.com` にキャッチオールが設定されていれば、出力します。
|
||||
|
||||
|
||||
## エイリアスドメイン
|
||||
|
||||
### エイリアスドメインの追加
|
||||
|
||||
$ mailfull2 aliasdomainadd alias.example.com example.com
|
||||
|
||||
`example.com` 宛のメールが、`alias.example.com` でも
|
||||
受け取れるようになります。
|
||||
|
||||
### エイリアスドメインの解除
|
||||
|
||||
$ mailfull2 aliasdomaindel alias.example.com
|
||||
|
||||
エイリアスドメインを解除します。
|
||||
|
||||
### エイリアスドメインのリストアップ
|
||||
|
||||
$ mailfull2 aliasdomains example.com
|
||||
|
||||
`example.com` に設定されているエイリアスドメインをリストアップします。
|
||||
|
||||
|
||||
## その他
|
||||
|
||||
### commit
|
||||
|
||||
$ ./commit
|
||||
|
||||
`/home/mailfull/domains` 以下から設定を生成し、
|
||||
`/home/mailfull/etc` 以下の設定ファイルにまとめ、各種データベースを作成します。
|
||||
|
||||
|
||||
3
user.go
3
user.go
@@ -100,6 +100,9 @@ func (r *Repository) Users(domainName string) ([]*User, error) {
|
||||
|
||||
forwards, err := r.userForwards(domainName, name)
|
||||
if err != nil {
|
||||
if err == ErrInvalidUserName {
|
||||
continue
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
8
valid.go
8
valid.go
@@ -33,20 +33,20 @@ func validAliasDomainTarget(target string) bool {
|
||||
|
||||
// validUserName returns true if the input is correct format.
|
||||
func validUserName(name string) bool {
|
||||
return regexp.MustCompile(`^[^\s@]+$`).MatchString(name)
|
||||
return regexp.MustCompile(`^[^\.\s@][^\s@]+$`).MatchString(name)
|
||||
}
|
||||
|
||||
// validAliasUserName returns true if the input is correct format.
|
||||
func validAliasUserName(name string) bool {
|
||||
return regexp.MustCompile(`^[^\s@]+$`).MatchString(name)
|
||||
return regexp.MustCompile(`^[^\.\s@][^\s@]+$`).MatchString(name)
|
||||
}
|
||||
|
||||
// validAliasUserTarget returns true if the input is correct format.
|
||||
func validAliasUserTarget(target string) bool {
|
||||
return regexp.MustCompile(`^[^\s@]+@([A-Za-z0-9\-]+\.)*[A-Za-z]+$`).MatchString(target)
|
||||
return regexp.MustCompile(`^[^\.\s@][^\s@]+@([A-Za-z0-9\-]+\.)*[A-Za-z]+$`).MatchString(target)
|
||||
}
|
||||
|
||||
// validCatchAllUserName returns true if the input is correct format.
|
||||
func validCatchAllUserName(name string) bool {
|
||||
return regexp.MustCompile(`^[^\s@]+$`).MatchString(name)
|
||||
return regexp.MustCompile(`^[^\.\s@][^\s@]+$`).MatchString(name)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package mailfull
|
||||
|
||||
// Version is a version number.
|
||||
const Version = "v1.0.0"
|
||||
const Version = "v1.0.3"
|
||||
|
||||
Reference in New Issue
Block a user