mirror of
https://github.com/D-Modem/bbs.git
synced 2026-11-28 17:38:04 -08:00
[acme] gets certificates from Let's Encrypt, ZeroSSL or any ACME CA and renews them before they run out, in the manner of acme.sh, built on lego (MIT). [acme NAME] adds more. HTTP-01 (its own port 80 listener or the BBS's web server there), TLS-ALPN-01 (any TLS server of the BBS on 443) and DNS-01 (15 providers built in, exec:PROGRAM, or acme.sh's own dnsapi scripts through acmesh:dns_xx) are supported; renewal follows renew_days and the CA's ARI; a hook runs after each new certificate. internal/certs is where every TLS server now gets its certificate: a file pair read again when it changes, or the ACME client's (cert_file = acme or acme:NAME, and by default when a TLS server has no files and [acme] is set). Gemini keeps its pinned certificate and Yahoo its login.yahoo.com one unless told. bbs acme list / renew, bbs check lists them, a Certificates page in the configurator, the sample config, Configuration Reference and a new Certificates wiki page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSjWGPJDHVw7cyWKvE
577 lines
17 KiB
Go
577 lines
17 KiB
Go
// Package ftp serves the BBS's file areas by FTP (and FTPS): users log in
|
|
// with their BBS name and password, each file area is a directory, and they
|
|
// download, upload (where they may) and delete their own files.
|
|
//
|
|
// The protocol is fclairamb/ftpserverlib's; this package is its driver: a
|
|
// file system of the database's areas and files, with nothing of the
|
|
// server's own file system reachable.
|
|
package ftp
|
|
|
|
import (
|
|
"context"
|
|
"crypto/tls"
|
|
"errors"
|
|
"fmt"
|
|
"log/slog"
|
|
"net"
|
|
"os"
|
|
"path"
|
|
"strings"
|
|
"sync"
|
|
"time"
|
|
|
|
ftpserver "github.com/fclairamb/ftpserverlib"
|
|
"github.com/spf13/afero"
|
|
|
|
"github.com/D-Modem/bbs/internal/bbs"
|
|
"github.com/D-Modem/bbs/internal/certs"
|
|
"github.com/D-Modem/bbs/internal/files"
|
|
"github.com/D-Modem/bbs/internal/sockets"
|
|
"github.com/D-Modem/bbs/internal/store"
|
|
)
|
|
|
|
// TLS modes.
|
|
const (
|
|
TLSNo = "no" // plain FTP: passwords in the clear
|
|
TLSOptional = "optional" // AUTH TLS offered
|
|
TLSRequired = "required" // AUTH TLS before USER (explicit FTPS)
|
|
TLSImplicit = "implicit" // TLS from the first byte (port 990 style)
|
|
)
|
|
|
|
// Settings are the [ftp] section's.
|
|
type Settings struct {
|
|
Address string // host:port
|
|
PublicHost string // the address passive replies give, behind NAT ("": the local one)
|
|
PassiveMin int // passive data ports (0: any)
|
|
PassiveMax int
|
|
TLS string
|
|
CertFile string
|
|
KeyFile string
|
|
Anonymous bool // "anonymous" and "ftp" may log in, to download only
|
|
MaxClients int
|
|
MaxPerIP int
|
|
IdleTimeout time.Duration
|
|
Banner string
|
|
}
|
|
|
|
// Server is the FTP server.
|
|
type Server struct {
|
|
B *bbs.BBS
|
|
Set Settings
|
|
|
|
tlsConfig *tls.Config
|
|
inherited net.Listener // the socket handed down for Address, if any
|
|
mu sync.Mutex
|
|
clients int
|
|
perIP map[string]int
|
|
}
|
|
|
|
// New makes the server, loading the certificate if TLS is on.
|
|
func New(b *bbs.BBS, set Settings) (*Server, error) {
|
|
if b.Files == nil {
|
|
return nil, errors.New("ftp: no file store")
|
|
}
|
|
s := &Server{B: b, Set: set, perIP: map[string]int{}}
|
|
if set.TLS != TLSNo {
|
|
cfg, err := certs.Config(set.CertFile, set.KeyFile)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("ftp: certificate: %w", err)
|
|
}
|
|
s.tlsConfig = cfg
|
|
}
|
|
return s, nil
|
|
}
|
|
|
|
// Run serves until ctx is done.
|
|
func (s *Server) Run(ctx context.Context) error {
|
|
s.inherited = sockets.Take("tcp", s.Set.Address)
|
|
if s.inherited != nil && s.Set.TLS == TLSImplicit {
|
|
s.inherited = tls.NewListener(s.inherited, s.tlsConfig)
|
|
}
|
|
srv := ftpserver.NewFtpServer(s)
|
|
srv.Logger = slog.New(slog.NewTextHandler(s.B.Log.Writer(), &slog.HandlerOptions{Level: slog.LevelError}))
|
|
if err := srv.Listen(); err != nil {
|
|
return fmt.Errorf("ftp: %w", err)
|
|
}
|
|
s.B.Log.Printf("ftp: listening on %s (tls %s)", s.Set.Address, s.Set.TLS)
|
|
done := make(chan error, 1)
|
|
go func() { done <- srv.Serve() }()
|
|
select {
|
|
case <-ctx.Done():
|
|
srv.Stop()
|
|
<-done
|
|
return nil
|
|
case err := <-done:
|
|
return err
|
|
}
|
|
}
|
|
|
|
// GetSettings is the library's settings: no active mode (FTP bounce), data
|
|
// connections only from the control connection's address, binary by
|
|
// default, no SITE, no compression.
|
|
func (s *Server) GetSettings() (*ftpserver.Settings, error) {
|
|
set := &ftpserver.Settings{
|
|
ListenAddr: s.Set.Address,
|
|
Listener: s.inherited, // bound before the BBS gave up root (nil: none)
|
|
PublicHost: s.Set.PublicHost,
|
|
Banner: s.Set.Banner,
|
|
IdleTimeout: int(s.Set.IdleTimeout / time.Second),
|
|
ConnectionTimeout: 30,
|
|
DisableActiveMode: true,
|
|
DisableSite: true,
|
|
DisableMFMT: true,
|
|
DefaultTransferType: ftpserver.TransferTypeBinary,
|
|
ActiveConnectionsCheck: ftpserver.IPMatchRequired,
|
|
PasvConnectionsCheck: ftpserver.IPMatchRequired,
|
|
}
|
|
if s.Set.PassiveMin > 0 {
|
|
set.PassiveTransferPortRange = ftpserver.PortRange{Start: s.Set.PassiveMin, End: s.Set.PassiveMax}
|
|
}
|
|
switch s.Set.TLS {
|
|
case TLSRequired:
|
|
set.TLSRequired = ftpserver.MandatoryEncryption
|
|
case TLSImplicit:
|
|
set.TLSRequired = ftpserver.ImplicitEncryption
|
|
default:
|
|
set.TLSRequired = ftpserver.ClearOrEncrypted
|
|
}
|
|
return set, nil
|
|
}
|
|
|
|
// GetTLSConfig is the certificate's.
|
|
func (s *Server) GetTLSConfig() (*tls.Config, error) {
|
|
if s.tlsConfig == nil {
|
|
return nil, errors.New("TLS is not set up")
|
|
}
|
|
return s.tlsConfig, nil
|
|
}
|
|
|
|
// host is a TCP address's IP, as text ("" for any other address).
|
|
func host(a net.Addr) string {
|
|
if t, ok := a.(*net.TCPAddr); ok {
|
|
return t.IP.String()
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// ClientConnected greets a client, or turns it away over the limits.
|
|
func (s *Server) ClientConnected(cc ftpserver.ClientContext) (string, error) {
|
|
if s.B.Refuse("ftp", cc.RemoteAddr()) {
|
|
return "Not here.", errors.New("refused")
|
|
}
|
|
h := host(cc.RemoteAddr())
|
|
s.mu.Lock()
|
|
defer s.mu.Unlock()
|
|
if s.Set.MaxClients > 0 && s.clients >= s.Set.MaxClients {
|
|
return "Too many users; try again later.", errors.New("too many clients")
|
|
}
|
|
if s.Set.MaxPerIP > 0 && s.perIP[h] >= s.Set.MaxPerIP {
|
|
return "Too many connections from your address.", errors.New("too many from one address")
|
|
}
|
|
s.clients++
|
|
s.perIP[h]++
|
|
cc.SetExtra(h)
|
|
return s.B.Conf().Name + " file areas. Log in with your BBS name and password.", nil
|
|
}
|
|
|
|
// ClientDisconnected counts the client out.
|
|
func (s *Server) ClientDisconnected(cc ftpserver.ClientContext) {
|
|
h, ok := cc.Extra().(string)
|
|
if !ok {
|
|
// a client turned away by ClientConnected was never counted;
|
|
// one that logged in carries its fs as extra (see AuthUser)
|
|
if fs, isFS := cc.Extra().(*fileSystem); isFS {
|
|
h = fs.host
|
|
} else {
|
|
return
|
|
}
|
|
}
|
|
s.mu.Lock()
|
|
defer s.mu.Unlock()
|
|
s.clients--
|
|
if s.perIP[h]--; s.perIP[h] <= 0 {
|
|
delete(s.perIP, h)
|
|
}
|
|
}
|
|
|
|
// AuthUser checks the BBS name and password.
|
|
func (s *Server) AuthUser(cc ftpserver.ClientContext, name, pass string) (ftpserver.ClientDriver, error) {
|
|
h := host(cc.RemoteAddr())
|
|
// a local client's address is everyone's: its failures count against
|
|
// the account named
|
|
source := bbs.LocalSource("ftp", name)
|
|
if a, ok := cc.RemoteAddr().(*net.TCPAddr); ok && !a.IP.IsLoopback() {
|
|
source = "ip:" + h
|
|
}
|
|
who := fmt.Sprintf("ftp %d", cc.ID())
|
|
var u *store.User
|
|
if s.Set.Anonymous && (strings.EqualFold(name, "anonymous") || strings.EqualFold(name, "ftp")) {
|
|
u = &store.User{Name: "anonymous"} // no ID: may not upload or delete
|
|
} else {
|
|
var err error
|
|
u, err = s.B.Authenticate(who, source, name, pass)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
tls := ""
|
|
if cc.HasTLSForControl() {
|
|
tls = ", TLS"
|
|
}
|
|
s.B.Log.Printf("%s: %s logged in from %s%s", who, u.Name, h, tls)
|
|
fs := &fileSystem{s: s, user: u, host: h, who: who}
|
|
cc.SetExtra(fs)
|
|
return fs, nil
|
|
}
|
|
|
|
// fileSystem is a user's view of the file areas: / has a directory for
|
|
// each area, each area its files. It is all there is.
|
|
type fileSystem struct {
|
|
s *Server
|
|
user *store.User
|
|
host string
|
|
who string
|
|
|
|
packet *bbs.QWKOut // the user's QWK packet, as made last
|
|
made time.Time
|
|
}
|
|
|
|
var (
|
|
_ ftpserver.ClientDriver = (*fileSystem)(nil)
|
|
_ ftpserver.ClientDriverExtensionFileList = (*fileSystem)(nil)
|
|
_ ftpserver.ClientDriverExtentionFileTransfer = (*fileSystem)(nil)
|
|
_ ftpserver.ClientDriverExtensionRemoveDir = (*fileSystem)(nil)
|
|
)
|
|
|
|
// anonymous: the user logged in as anonymous, with no account (download only).
|
|
func (fs *fileSystem) anonymous() bool { return fs.user.ID == 0 }
|
|
|
|
// sees: an area the user may download from or upload into
|
|
func (fs *fileSystem) sees(a *store.FileArea) bool {
|
|
return fs.s.B.CanDownload(fs.user, a) || !fs.anonymous() && fs.s.B.CanUpload(fs.user, a)
|
|
}
|
|
|
|
// resolve splits a path into its area and file (nil for /, file nil for an
|
|
// area's directory).
|
|
func (fs *fileSystem) resolve(name string) (*store.FileArea, *store.File, error) {
|
|
p := strings.Trim(path.Clean("/"+name), "/")
|
|
if p == "" {
|
|
return nil, nil, nil
|
|
}
|
|
parts := strings.Split(p, "/")
|
|
if len(parts) > 2 {
|
|
return nil, nil, os.ErrNotExist
|
|
}
|
|
a, err := fs.s.B.Store.FileAreaByName(parts[0])
|
|
if errors.Is(err, store.ErrNotFound) || err == nil && !fs.sees(a) {
|
|
return nil, nil, os.ErrNotExist
|
|
} else if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
if len(parts) == 1 {
|
|
return a, nil, nil
|
|
}
|
|
f, err := fs.s.B.Store.FileByName(a.ID, parts[1])
|
|
if errors.Is(err, store.ErrNotFound) {
|
|
return a, nil, os.ErrNotExist
|
|
} else if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
return a, f, nil
|
|
}
|
|
|
|
// info is what a listing says of an entry.
|
|
type info struct {
|
|
name string
|
|
size int64
|
|
dir bool
|
|
mtime time.Time
|
|
}
|
|
|
|
// Name is the entry's name.
|
|
func (i info) Name() string { return i.name }
|
|
|
|
// Size is a file's size in bytes.
|
|
func (i info) Size() int64 { return i.size }
|
|
|
|
// ModTime is when a file was uploaded (the epoch for a directory).
|
|
func (i info) ModTime() time.Time { return i.mtime }
|
|
|
|
// IsDir: the entry is / or an area.
|
|
func (i info) IsDir() bool { return i.dir }
|
|
|
|
// Sys is nil: there is nothing underneath.
|
|
func (i info) Sys() any { return nil }
|
|
|
|
// Mode is read-only: r-x for a directory, r-- for a file.
|
|
func (i info) Mode() os.FileMode {
|
|
if i.dir {
|
|
return os.ModeDir | 0o555
|
|
}
|
|
return 0o444
|
|
}
|
|
|
|
// areaInfo is an area's entry: a directory, dated the epoch.
|
|
func areaInfo(a *store.FileArea) info { return info{name: a.Name, dir: true, mtime: time.Unix(0, 0)} }
|
|
|
|
// fileInfo is a file's entry: its size, dated its upload.
|
|
func fileInfo(f *store.File) info { return info{name: f.Name, size: f.Size, mtime: f.Created} }
|
|
|
|
// Stat describes an entry.
|
|
func (fs *fileSystem) Stat(name string) (os.FileInfo, error) {
|
|
if q, ok := fs.qwkPath(name); ok {
|
|
return fs.qwkStat(q)
|
|
}
|
|
a, f, err := fs.resolve(name)
|
|
switch {
|
|
case err != nil:
|
|
return nil, err
|
|
case a == nil:
|
|
return info{name: "/", dir: true, mtime: time.Unix(0, 0)}, nil
|
|
case f == nil:
|
|
return areaInfo(a), nil
|
|
}
|
|
return fileInfo(f), nil
|
|
}
|
|
|
|
// ReadDir lists / (the areas) or an area (its files).
|
|
func (fs *fileSystem) ReadDir(name string) ([]os.FileInfo, error) {
|
|
if q, ok := fs.qwkPath(name); ok {
|
|
if q != "" {
|
|
return nil, errors.New("not a directory")
|
|
}
|
|
i, err := fs.qwkStat(fs.s.B.BBSID() + ".QWK")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return []os.FileInfo{i}, nil
|
|
}
|
|
a, f, err := fs.resolve(name)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if f != nil {
|
|
return nil, errors.New("not a directory")
|
|
}
|
|
var out []os.FileInfo
|
|
if a == nil {
|
|
areas, err := fs.s.B.Store.FileAreas()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
for _, a := range areas {
|
|
if fs.sees(a) && (fs.anonymous() || !strings.EqualFold(a.Name, qwkDir)) {
|
|
out = append(out, areaInfo(a))
|
|
}
|
|
}
|
|
if !fs.anonymous() {
|
|
out = append(out, info{name: qwkDir, dir: true, mtime: time.Unix(0, 0)})
|
|
}
|
|
return out, nil
|
|
}
|
|
list, err := fs.s.B.Store.Files(a.ID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
for _, f := range list {
|
|
out = append(out, fileInfo(f))
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// GetHandle opens a file to download, or a new one to upload.
|
|
func (fs *fileSystem) GetHandle(name string, flags int, offset int64) (ftpserver.FileTransfer, error) {
|
|
if q, ok := fs.qwkPath(name); ok {
|
|
return fs.qwkHandle(q, flags, offset)
|
|
}
|
|
a, f, err := fs.resolve(name)
|
|
write := flags&(os.O_WRONLY|os.O_RDWR) != 0
|
|
if !write {
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if f == nil {
|
|
return nil, errors.New("not a file")
|
|
}
|
|
// a download resumed (REST) of the file counted today needs no
|
|
// downloads left, and is not counted again
|
|
resume := offset > 0 && fs.s.B.Resuming(fs.user, f)
|
|
if resume {
|
|
if !fs.s.B.CanDownload(fs.user, a) {
|
|
return nil, os.ErrPermission
|
|
}
|
|
} else if err := fs.s.B.MayDownload(fs.user, a); err != nil {
|
|
return nil, fmt.Errorf("%w: %v", os.ErrPermission, err)
|
|
}
|
|
r, err := fs.s.B.Files.OpenFile(f)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &download{file: r, fs: fs, f: f, resume: resume}, nil
|
|
}
|
|
// an upload: a new file in an area, from its start
|
|
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
|
return nil, err
|
|
}
|
|
if a == nil || (f == nil && err == nil) {
|
|
// the root, an area that is not there, or an area's directory
|
|
return nil, os.ErrPermission
|
|
}
|
|
if f != nil {
|
|
return nil, fmt.Errorf("%w: %s", os.ErrExist, files.ErrExists)
|
|
}
|
|
if offset != 0 || flags&os.O_APPEND != 0 {
|
|
return nil, fmt.Errorf("%w: uploads cannot be resumed or appended to", os.ErrPermission)
|
|
}
|
|
if fs.anonymous() || !fs.s.B.CanUpload(fs.user, a) {
|
|
return nil, os.ErrPermission
|
|
}
|
|
up, err := fs.s.B.Files.Upload(fs.user, a, path.Base(path.Clean("/"+name)), "")
|
|
if errors.Is(err, files.ErrDenied) {
|
|
return nil, os.ErrPermission
|
|
}
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &upload{Upload: up, fs: fs, area: a}, nil
|
|
}
|
|
|
|
// download is a file being downloaded. The file is not embedded: its
|
|
// WriteTo would let the copy go around Read, and the download uncounted.
|
|
type download struct {
|
|
file *os.File
|
|
fs *fileSystem
|
|
f *store.File
|
|
read int64 // bytes sent
|
|
pos int64 // where in the file
|
|
resume bool // a download counted already, resumed
|
|
}
|
|
|
|
// Read reads the file, counting what has gone.
|
|
func (d *download) Read(p []byte) (int, error) {
|
|
n, err := d.file.Read(p)
|
|
d.read += int64(n)
|
|
d.pos += int64(n)
|
|
return n, err
|
|
}
|
|
|
|
// Seek moves in the file (for a resumed download).
|
|
func (d *download) Seek(offset int64, whence int) (int64, error) {
|
|
pos, err := d.file.Seek(offset, whence)
|
|
if err == nil {
|
|
d.pos = pos
|
|
}
|
|
return pos, err
|
|
}
|
|
|
|
// Write is refused: a download is read only.
|
|
func (d *download) Write([]byte) (int, error) { return 0, os.ErrPermission }
|
|
|
|
// Close closes the file, counting it downloaded if the transfer reached its
|
|
// end (a resumed one counted already is not counted again), and logging
|
|
// what was sent, a transfer cut short as partial.
|
|
func (d *download) Close() error {
|
|
switch {
|
|
case (d.read > 0 || d.f.Size == 0) && d.pos >= d.f.Size:
|
|
if !d.resume {
|
|
d.fs.s.B.Downloaded(d.fs.user, d.f)
|
|
}
|
|
d.fs.s.B.Log.Printf("%s: %s downloaded %q (%d bytes)", d.fs.who, d.fs.user.Name, d.f.Name, d.read)
|
|
case d.read > 0:
|
|
d.fs.s.B.Log.Printf("%s: %s downloaded %q in part (%d of %d bytes): not counted", d.fs.who,
|
|
d.fs.user.Name, d.f.Name, d.read, d.f.Size)
|
|
}
|
|
return d.file.Close()
|
|
}
|
|
|
|
// upload is a file being uploaded: kept only if it all came.
|
|
type upload struct {
|
|
*files.Upload
|
|
fs *fileSystem
|
|
area *store.FileArea
|
|
failed error
|
|
}
|
|
|
|
// Read is refused: an upload is written only.
|
|
func (u *upload) Read([]byte) (int, error) { return 0, os.ErrPermission }
|
|
|
|
// Seek is refused: an upload is from its start.
|
|
func (u *upload) Seek(offset int64, whence int) (int64, error) { return 0, os.ErrPermission }
|
|
|
|
// TransferError is told of a transfer that failed.
|
|
func (u *upload) TransferError(err error) { u.failed = err }
|
|
|
|
// Close keeps the file if the transfer went well (Commit), else throws it
|
|
// away and gives the transfer's error.
|
|
func (u *upload) Close() error {
|
|
if u.failed != nil {
|
|
u.Abort()
|
|
return u.failed
|
|
}
|
|
f, err := u.Commit()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
u.fs.s.B.Log.Printf("%s: %s uploaded %q to %s (%d bytes, sha256 %s)", u.fs.who, u.fs.user.Name,
|
|
f.Name, u.area.Name, f.Size, f.SHA256)
|
|
return nil
|
|
}
|
|
|
|
// Remove deletes a file, if the user uploaded it (or is a sysop).
|
|
func (fs *fileSystem) Remove(name string) error {
|
|
_, f, err := fs.resolve(name)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if f == nil {
|
|
return os.ErrPermission
|
|
}
|
|
if err := fs.s.B.Files.Delete(fs.user, f); err != nil {
|
|
if errors.Is(err, files.ErrDenied) {
|
|
return os.ErrPermission
|
|
}
|
|
return err
|
|
}
|
|
fs.s.B.Log.Printf("%s: %s deleted %q", fs.who, fs.user.Name, f.Name)
|
|
return nil
|
|
}
|
|
|
|
// What the file areas do not do over FTP: areas are made with the bbs
|
|
// command, files are not renamed, opened otherwise or changed.
|
|
func (fs *fileSystem) RemoveDir(string) error { return os.ErrPermission }
|
|
|
|
// RemoveAll is refused.
|
|
func (fs *fileSystem) RemoveAll(string) error { return os.ErrPermission }
|
|
|
|
// Mkdir is refused.
|
|
func (fs *fileSystem) Mkdir(string, os.FileMode) error { return os.ErrPermission }
|
|
|
|
// MkdirAll is refused.
|
|
func (fs *fileSystem) MkdirAll(string, os.FileMode) error { return os.ErrPermission }
|
|
|
|
// Rename is refused.
|
|
func (fs *fileSystem) Rename(string, string) error { return os.ErrPermission }
|
|
|
|
// Chmod is refused.
|
|
func (fs *fileSystem) Chmod(string, os.FileMode) error { return os.ErrPermission }
|
|
|
|
// Chown is refused.
|
|
func (fs *fileSystem) Chown(string, int, int) error { return os.ErrPermission }
|
|
|
|
// Chtimes is refused.
|
|
func (fs *fileSystem) Chtimes(string, time.Time, time.Time) error { return os.ErrPermission }
|
|
|
|
// Create is refused: uploads go through GetHandle.
|
|
func (fs *fileSystem) Create(string) (afero.File, error) { return nil, os.ErrPermission }
|
|
|
|
// Open is refused: downloads go through GetHandle.
|
|
func (fs *fileSystem) Open(string) (afero.File, error) { return nil, os.ErrPermission }
|
|
|
|
// Name is the file system's name, "bbs".
|
|
func (fs *fileSystem) Name() string { return "bbs" }
|
|
|
|
// OpenFile is refused: transfers go through GetHandle.
|
|
func (fs *fileSystem) OpenFile(string, int, os.FileMode) (afero.File, error) {
|
|
return nil, os.ErrPermission
|
|
}
|