transport/tcp: support for CIDR-mask based ACLs + client-identities

Co-authored-by: Christian Schwarz <me@cschwarz.com>

fixes #235
close #265
This commit is contained in:
Bruce Smith
2020-01-18 12:53:20 -05:00
committed by Christian Schwarz
parent 18e101a04e
commit 2fbd9d8f8c
7 changed files with 395 additions and 46 deletions
+4 -7
View File
@@ -4,10 +4,10 @@ package transport
import (
"context"
"errors"
"net"
"syscall"
"github.com/pkg/errors"
"github.com/zrepl/zrepl/logger"
"github.com/zrepl/zrepl/rpc/dataconn/timeoutconn"
"github.com/zrepl/zrepl/zfs"
@@ -55,13 +55,10 @@ type Connecter interface {
}
// A client identity must be a single component in a ZFS filesystem path
func ValidateClientIdentity(in string) (err error) {
path, err := zfs.NewDatasetPath(in)
func ValidateClientIdentity(in string) error {
err := zfs.ComponentNamecheck(in)
if err != nil {
return err
}
if path.Length() != 1 {
return errors.New("client identity must be a single path component (not empty, no '/')")
return errors.Wrap(err, "client identity must be usable as a single dataset path component")
}
return nil
}