nfssrv

package
v0.44.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package nfssrv serves NFSv3: filex, mounted as a network drive by anything on the LAN that speaks the NAS protocol.

The identity problem, and what is done about it

NFSv3 cannot authenticate a caller in any way filex can use. Real per-request identity means RPCSEC_GSS → Kerberos → a KDC and a machine keytab on every client, which nobody self-hosting a file server is going to run. AUTH_SYS, what every NAS actually ships, is the client asserting its own uid with nothing to check it against.

So the binding moves: identity belongs to the EXPORT, not the request. Each export path carries 32 bytes of entropy (`/x/<64 hex>`), the mount handshake pins it to one principal, and every operation inside runs under that principal's scope. The uid/gid on each request is discarded rather than trusted, and the permission bits going out are synthesised from the ACL — the same rule the SFTP and FTPS surfaces follow.

⚠⚠ NFSv3 is unencrypted and unauthenticated on the wire. Anyone who can read the traffic, or who already knows the path, can mount it. That is why this listener is OFF by default, why exports carry an optional CIDR allow-list, and why `filex mount` (FUSE over HTTPS) — not this — is the answer for anything off-LAN. NFS is the NAS-on-the-LAN protocol; pretending otherwise would be the dishonest part.

What is borrowed and what is written here

`willscott/go-nfs` (Apache-2.0, the same library `rclone serve nfs` uses) carries XDR, portmap and the RPC loop. What this package writes is the adapter onto filex's storage, the identity model above, and the gates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Enabled — FILEX_NFS kill switch. OFF by default, and more emphatically
	// than the others: NFSv3 has no transport security at all, so switching it
	// on is a decision about the network it sits on.
	Enabled bool
	// Addr is the listen address. 2049 is the registered NFS port and what
	// clients assume; a different one needs `-o port=` on every mount.
	Addr string

	Store    db.Store
	Auth     *protocolauth.Resolver
	ACL      *acl.Resolver
	Resolver func(int64) (storage.Driver, error)
	Body     *filebody.Resolver
	Quota    *quota.Service
	Index    *search.Index
	Thumbs   *thumb.Pipeline
	// SpoolDir is where in-flight writes are spooled.
	SpoolDir string
	// MaxSpool caps one file's spool. 0 uses the package default.
	MaxSpool    int64
	MultiTenant bool
}

Config wires the server to the shared services.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a running NFSv3 endpoint.

func New

func New(cfg Config) (*Server, error)

New builds a server. It does not listen yet.

func (*Server) Addr

func (s *Server) Addr() string

Addr is the address actually bound.

func (*Server) Close

func (s *Server) Close() error

Close stops the listener.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe blocks until Close.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL