Compare commits
43
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e982ff3666 | ||
|
|
53b2d7aaf2 | ||
|
|
17ebd339da | ||
|
|
e3c400f583 | ||
|
|
5c5a3199d7 | ||
|
|
37b306d5d1 | ||
|
|
b000741c98 | ||
|
|
c0bf21991e | ||
|
|
9aba8e4e41 | ||
|
|
8d0b08d125 | ||
|
|
2fc95aef84 | ||
|
|
0c6e76b6b3 | ||
|
|
b2dc0e3931 | ||
|
|
544758e553 | ||
|
|
7b29032d4d | ||
|
|
b4659519df | ||
|
|
866e7ac577 | ||
|
|
f6ca72fabb | ||
|
|
a3c6bb2a32 | ||
|
|
7c60060d4c | ||
|
|
2b4cb5f85b | ||
|
|
84bdebae77 | ||
|
|
c7a34b80d3 | ||
|
|
5ecc9f685b | ||
|
|
545936b681 | ||
|
|
1a319f2191 | ||
|
|
5930441699 | ||
|
|
bbf4a983d7 | ||
|
|
cf93478f87 | ||
|
|
b3d0b38694 | ||
|
|
3ca4fd99b6 | ||
|
|
5c143c89bf | ||
|
|
d1c54c4e5d | ||
|
|
2ff2bfee8f | ||
|
|
2fb0f2c58c | ||
|
|
5795966909 | ||
|
|
334e7046e3 | ||
|
|
89f2a613ab | ||
|
|
2b1eabe992 | ||
|
|
47fb4879a4 | ||
|
|
e74889ec87 | ||
|
|
c9a5f106a4 | ||
|
|
918f5a68ee |
No files matched your search
@@ -177,9 +177,12 @@ jobs:
|
||||
# https://github.com/Homebrew/brew/issues/15621#issuecomment-1619266788
|
||||
# https://github.com/orgs/Homebrew/discussions/4612#discussioncomment-6319008
|
||||
unset HOMEBREW_NO_INSTALL_FROM_API
|
||||
brew untap --force homebrew/core
|
||||
brew untap --force homebrew/cask
|
||||
brew untap --force aws/tap
|
||||
# brew untap fails if the tap isn't installed, which varies between runner images
|
||||
for tap in homebrew/core homebrew/cask aws/tap; do
|
||||
if brew tap | grep -qx "$tap"; then
|
||||
brew untap --force "$tap"
|
||||
fi
|
||||
done
|
||||
brew update
|
||||
brew install --cask macfuse
|
||||
brew install git-annex git-annex-remote-rclone
|
||||
|
||||
Generated
+7688
-2672
File diff suppressed because it is too large.
Load diff
Generated
+5730
-1334
File diff suppressed because it is too large.
Load diff
@@ -73,6 +73,8 @@ directories to and from different cloud storage providers.
|
||||
- Jottacloud [:page_facing_up:](https://rclone.org/jottacloud/)
|
||||
- IBM COS S3 [:page_facing_up:](https://rclone.org/s3/#ibm-cos-s3)
|
||||
- Impossible Cloud [:page_facing_up:](https://rclone.org/s3/#impossible-cloud)
|
||||
- Infomaniak Swiss Backup (S3) [:page_facing_up:](https://rclone.org/s3/#infomaniak)
|
||||
- Infomaniak Swiss Backup (Swift) [:page_facing_up:](https://rclone.org/swift/)
|
||||
- Intercolo Object Storage [:page_facing_up:](https://rclone.org/s3/#intercolo)
|
||||
- IONOS Cloud [:page_facing_up:](https://rclone.org/s3/#ionos)
|
||||
- kDrive [:page_facing_up:](https://rclone.org/kdrive/)
|
||||
@@ -91,6 +93,7 @@ directories to and from different cloud storage providers.
|
||||
- Microsoft Azure Files Storage [:page_facing_up:](https://rclone.org/azurefiles/)
|
||||
- Microsoft OneDrive [:page_facing_up:](https://rclone.org/onedrive/)
|
||||
- Minio [:page_facing_up:](https://rclone.org/s3/#minio)
|
||||
- Neon Object Storage [:page_facing_up:](https://rclone.org/s3/#neon)
|
||||
- Nextcloud [:page_facing_up:](https://rclone.org/webdav/#nextcloud)
|
||||
- Blomp Cloud Storage [:page_facing_up:](https://rclone.org/swift/)
|
||||
- OpenDrive [:page_facing_up:](https://rclone.org/opendrive/)
|
||||
|
||||
@@ -79,7 +79,7 @@ This is required and is the name of the share to access.
|
||||
Help: `Upload chunk size.
|
||||
|
||||
Note that this is stored in memory and there may be up to
|
||||
"--transfers" * "--azurefile-upload-concurrency" chunks stored at once
|
||||
"--transfers" * "--azurefiles-upload-concurrency" chunks stored at once
|
||||
in memory.`,
|
||||
Default: defaultChunkSize,
|
||||
Advanced: true,
|
||||
@@ -95,7 +95,7 @@ links and these uploads do not fully utilize your bandwidth, then
|
||||
increasing this may help to speed up the transfers.
|
||||
|
||||
Note that chunks are stored in memory and there may be up to
|
||||
"--transfers" * "--azurefile-upload-concurrency" chunks stored at once
|
||||
"--transfers" * "--azurefiles-upload-concurrency" chunks stored at once
|
||||
in memory.`,
|
||||
Default: 16,
|
||||
Advanced: true,
|
||||
|
||||
+2
-2
@@ -277,7 +277,7 @@ See: [rclone backend lifecycle](#lifecycle) for setting lifecycles after bucket
|
||||
Name: "sse_customer_key",
|
||||
Help: `To use SSE-C, you may provide the secret encryption key encoded in a UTF-8 compatible string to encrypt/decrypt your data
|
||||
|
||||
Alternatively you can provide --sse-customer-key-base64.`,
|
||||
Alternatively you can provide --b2-sse-customer-key-base64.`,
|
||||
Advanced: true,
|
||||
Examples: []fs.OptionExample{{
|
||||
Value: "",
|
||||
@@ -288,7 +288,7 @@ Alternatively you can provide --sse-customer-key-base64.`,
|
||||
Name: "sse_customer_key_base64",
|
||||
Help: `To use SSE-C, you may provide the secret encryption key encoded in Base64 format to encrypt/decrypt your data
|
||||
|
||||
Alternatively you can provide --sse-customer-key.`,
|
||||
Alternatively you can provide --b2-sse-customer-key.`,
|
||||
Advanced: true,
|
||||
Examples: []fs.OptionExample{{
|
||||
Value: "",
|
||||
|
||||
@@ -568,7 +568,7 @@ recommended usage is using the flag form --drive-size-as-quota when
|
||||
doing rclone ls/lsl/lsf/lsjson/etc only.
|
||||
|
||||
If you do use this flag for syncing (not recommended) then you will
|
||||
need to use --ignore size also.`,
|
||||
need to use --ignore-size also.`,
|
||||
Advanced: true,
|
||||
Hide: fs.OptionHideConfigurator,
|
||||
}, {
|
||||
|
||||
@@ -145,7 +145,7 @@ func (f *Fs) dbImport(ctx context.Context, hashName, sumRemote string, sticky bo
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot open sum file: %w", err)
|
||||
}
|
||||
hashes, err := operations.ParseSumFile(ctx, sumObj, hashType)
|
||||
hashes, err := operations.ParseSumFile(ctx, sumObj)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse sum file: %w", err)
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ The headers are only sent to the host in the configured URL. If the
|
||||
server redirects to another host (including a subdomain or a different
|
||||
port) the headers are not sent to it, or to any further hop in that
|
||||
redirect chain. When headers are set, a redirect from https to http is
|
||||
refused as it would send them in cleartext.`,
|
||||
refused as it would send them in cleartext, even with
|
||||
--allow-https-downgrade.`,
|
||||
Default: fs.CommaSepList{},
|
||||
Advanced: true,
|
||||
}, {
|
||||
@@ -315,8 +316,9 @@ func (f *Fs) httpConnection(ctx context.Context, opt *Options) (isFile bool, err
|
||||
}
|
||||
|
||||
client := fshttp.NewClient(ctx)
|
||||
// Without configured headers keep the default policy which
|
||||
// public mirrors that redirect from https to http rely on.
|
||||
// Without configured headers keep the default policy so
|
||||
// --allow-https-downgrade can follow public mirrors that
|
||||
// redirect from https to http.
|
||||
if len(opt.Headers) > 0 {
|
||||
client.CheckRedirect = checkRedirect(opt)
|
||||
}
|
||||
|
||||
@@ -688,7 +688,7 @@ func TestRedirectRefusesHTTPSDowngrade(t *testing.T) {
|
||||
|
||||
// open makes a remote pointing at ts with or without headers
|
||||
// and opens file.txt on it
|
||||
open := func(t *testing.T, withHeaders bool) (io.ReadCloser, error) {
|
||||
open := func(t *testing.T, withHeaders, allowDowngrade bool) (io.ReadCloser, error) {
|
||||
configfile.Install()
|
||||
m := configmap.Simple{
|
||||
"type": "http",
|
||||
@@ -700,6 +700,7 @@ func TestRedirectRefusesHTTPSDowngrade(t *testing.T) {
|
||||
}
|
||||
ctx, ci := fs.AddConfig(context.Background())
|
||||
ci.InsecureSkipVerify = true
|
||||
ci.AllowHTTPSDowngrade = allowDowngrade
|
||||
f, err := NewFs(ctx, remoteName, "", m)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -711,13 +712,25 @@ func TestRedirectRefusesHTTPSDowngrade(t *testing.T) {
|
||||
|
||||
t.Run("WithHeaders", func(t *testing.T) {
|
||||
// Headers could leak so the downgrade must be refused
|
||||
_, err := open(t, true)
|
||||
_, err := open(t, true, false)
|
||||
require.ErrorIs(t, err, rest.ErrHTTPSDowngrade)
|
||||
})
|
||||
|
||||
t.Run("WithHeadersAllowDowngrade", func(t *testing.T) {
|
||||
// Headers could leak so the downgrade is refused even when allowed
|
||||
_, err := open(t, true, true)
|
||||
require.ErrorIs(t, err, rest.ErrHTTPSDowngrade)
|
||||
})
|
||||
|
||||
t.Run("WithoutHeaders", func(t *testing.T) {
|
||||
// Nothing to leak so the downgrade is followed
|
||||
fd, err := open(t, false)
|
||||
// The transport refuses downgrades by default
|
||||
_, err := open(t, false, false)
|
||||
require.ErrorIs(t, err, rest.ErrHTTPSDowngrade)
|
||||
})
|
||||
|
||||
t.Run("WithoutHeadersAllowDowngrade", func(t *testing.T) {
|
||||
// Nothing to leak so the downgrade is followed when allowed
|
||||
fd, err := open(t, false, true)
|
||||
require.NoError(t, err)
|
||||
data, err := io.ReadAll(fd)
|
||||
require.NoError(t, err)
|
||||
|
||||
+65
-15
@@ -960,13 +960,13 @@ func (f *Fs) MkdirMetadata(ctx context.Context, dir string, metadata fs.Metadata
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fi, err := f.lstat(localPath)
|
||||
fi, err := f.lstatRoot(localPath)
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
err := f.Mkdir(ctx, dir)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("mkdir metadata: failed make directory: %w", err)
|
||||
}
|
||||
fi, err = f.lstat(localPath)
|
||||
fi, err = f.lstatRoot(localPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("mkdir metadata: failed to read info: %w", err)
|
||||
}
|
||||
@@ -998,20 +998,34 @@ func (f *Fs) MkdirMetadata(ctx context.Context, dir string, metadata fs.Metadata
|
||||
// Rmdir removes the directory
|
||||
//
|
||||
// If it isn't empty it will return an error
|
||||
func (f *Fs) Rmdir(ctx context.Context, dir string) error {
|
||||
func (f *Fs) Rmdir(ctx context.Context, dir string) (err error) {
|
||||
localPath, err := f.localPath(dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if fi, err := os.Stat(localPath); err != nil {
|
||||
// When translating symlinks go through os.Root so a symlink planted at
|
||||
// any parent can't redirect the removal out of the destination, and
|
||||
// don't follow the leaf as a symlink is a file in this mode. The root
|
||||
// itself is the trusted destination and is removed directly.
|
||||
stat, removeFn, chmod := os.Stat, os.Remove, os.Chmod
|
||||
if f.opt.TranslateSymlinks && localPath != f.root {
|
||||
var root *os.Root
|
||||
root, localPath, err = f.osRoot(localPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer fs.CheckClose(root, &err)
|
||||
stat, removeFn, chmod = root.Lstat, root.Remove, root.Chmod
|
||||
}
|
||||
if fi, err := stat(localPath); err != nil {
|
||||
return err
|
||||
} else if !fi.IsDir() {
|
||||
return fs.ErrorIsFile
|
||||
}
|
||||
err = os.Remove(localPath)
|
||||
err = removeFn(localPath)
|
||||
if runtime.GOOS == "windows" && errors.Is(err, iofs.ErrPermission) { // https://github.com/golang/go/issues/26295
|
||||
if os.Chmod(localPath, 0o600) == nil {
|
||||
err = os.Remove(localPath)
|
||||
if chmod(localPath, 0o600) == nil {
|
||||
err = removeFn(localPath)
|
||||
}
|
||||
}
|
||||
return err
|
||||
@@ -1188,9 +1202,14 @@ func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string
|
||||
return fs.ErrorDirExists
|
||||
}
|
||||
|
||||
// Create parent of destination
|
||||
// Create parent of destination. The root itself is the trusted
|
||||
// destination so its parent, which lies outside it, is created directly.
|
||||
dstParentPath := filepath.Dir(dstPath)
|
||||
err = file.MkdirAll(dstParentPath, 0777)
|
||||
if dstPath == f.root {
|
||||
err = file.MkdirAll(dstParentPath, 0777)
|
||||
} else {
|
||||
err = f.mkdirAll(dstParentPath)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1607,10 +1626,26 @@ func (f *Fs) mkdirAll(localPath string) (err error) {
|
||||
return root.MkdirAll(rel, 0777)
|
||||
}
|
||||
|
||||
// openFile opens localPath for writing. When translating symlinks it goes
|
||||
// through os.Root so a symlink planted at the path, or at any parent, is never
|
||||
// followed out of the destination. The returned file is independent of the
|
||||
// root, which is closed before returning.
|
||||
// lstatRoot returns the info for localPath without following a symlink at
|
||||
// the leaf. When translating symlinks it goes through os.Root so a symlink
|
||||
// planted at any parent can't make a path outside the destination look like
|
||||
// it exists, which would let its metadata be written there.
|
||||
func (f *Fs) lstatRoot(localPath string) (fi os.FileInfo, err error) {
|
||||
if !f.opt.TranslateSymlinks {
|
||||
return f.lstat(localPath)
|
||||
}
|
||||
root, rel, err := f.osRoot(localPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer fs.CheckClose(root, &err)
|
||||
return root.Lstat(rel)
|
||||
}
|
||||
|
||||
// openFile opens localPath with the given flags and perm. When translating
|
||||
// symlinks it goes through os.Root so a symlink planted at the path, or at any
|
||||
// parent, is never followed out of the destination. The returned file is
|
||||
// independent of the root, which is closed before returning.
|
||||
func (f *Fs) openFile(localPath string, flags int, perm os.FileMode) (fi *os.File, err error) {
|
||||
if !f.opt.TranslateSymlinks {
|
||||
return file.OpenFile(localPath, flags, perm)
|
||||
@@ -1679,6 +1714,21 @@ func (f *Fs) chtimes(localPath string, atime, mtime time.Time) (err error) {
|
||||
return root.Chtimes(rel, atime, mtime)
|
||||
}
|
||||
|
||||
// remove removes the file, symlink or empty directory at localPath. When
|
||||
// translating symlinks it goes through os.Root so a symlink planted at any
|
||||
// parent can't redirect the removal out of the destination.
|
||||
func (f *Fs) remove(localPath string) (err error) {
|
||||
if !f.opt.TranslateSymlinks {
|
||||
return remove(localPath, os.Remove)
|
||||
}
|
||||
root, rel, err := f.osRoot(localPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer fs.CheckClose(root, &err)
|
||||
return remove(rel, root.Remove)
|
||||
}
|
||||
|
||||
// mkdirAll makes all the directories needed to store the object
|
||||
func (o *Object) mkdirAll() error {
|
||||
return o.fs.mkdirAll(filepath.Dir(o.path))
|
||||
@@ -1803,7 +1853,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
||||
|
||||
if err != nil {
|
||||
fs.Logf(o, "Removing partially written file on error: %v", err)
|
||||
if removeErr := os.Remove(o.path); removeErr != nil {
|
||||
if removeErr := o.fs.remove(o.path); removeErr != nil {
|
||||
fs.Errorf(o, "Failed to remove partially written file: %v", removeErr)
|
||||
}
|
||||
return err
|
||||
@@ -1951,7 +2001,7 @@ func (o *Object) lstat() error {
|
||||
// Remove an object
|
||||
func (o *Object) Remove(ctx context.Context) error {
|
||||
o.clearHashCache()
|
||||
return remove(o.path)
|
||||
return o.fs.remove(o.path)
|
||||
}
|
||||
|
||||
// Metadata returns metadata for an object
|
||||
|
||||
@@ -560,6 +560,109 @@ func TestDirBTimeThroughPlantedSymlinkBlocked(t *testing.T) {
|
||||
require.Equal(t, before, readBTime(), "btime escaped through planted symlink to %q", evilDir)
|
||||
}
|
||||
|
||||
// TestMkdirMetadataThroughPlantedSymlinkBlocked checks MkdirMetadata can't
|
||||
// be fooled into treating a directory outside the root, reached through a
|
||||
// planted symlink, as the directory to apply metadata to.
|
||||
func TestMkdirMetadataThroughPlantedSymlinkBlocked(t *testing.T) {
|
||||
skipIfNoSymlinks(t)
|
||||
ctx := context.Background()
|
||||
|
||||
evil := t.TempDir()
|
||||
evilDir := filepath.Join(evil, "secret.d")
|
||||
require.NoError(t, os.Mkdir(evilDir, 0700))
|
||||
require.NoError(t, os.Mkdir(filepath.Join(evilDir, "sub"), 0700))
|
||||
|
||||
r := fstest.NewRun(t)
|
||||
f := r.Flocal.(*Fs)
|
||||
linksMode(f)
|
||||
|
||||
// Control: an existing in-tree directory is found as normal.
|
||||
require.NoError(t, f.Mkdir(ctx, "sub"))
|
||||
_, err := f.MkdirMetadata(ctx, "sub", nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
// The planted symlink dst/pwn -> outside, faithfully reproduced by --links.
|
||||
require.NoError(t, putLink(ctx, f, "pwn", evilDir))
|
||||
|
||||
// "pwn/sub" exists outside the root but must not be found through the
|
||||
// planted symlink, and must not be created there either.
|
||||
_, err = f.MkdirMetadata(ctx, "pwn/sub", nil)
|
||||
require.Error(t, err, "finding a directory through a planted symlink should be refused")
|
||||
_, err = f.MkdirMetadata(ctx, "pwn/new", nil)
|
||||
require.Error(t, err, "making a directory through a planted symlink should be refused")
|
||||
_, err = os.Lstat(filepath.Join(evilDir, "new"))
|
||||
require.True(t, os.IsNotExist(err), "a directory escaped the destination into %q", evilDir)
|
||||
}
|
||||
|
||||
// TestRemoveThroughPlantedSymlinkBlocked checks Remove and Rmdir can't
|
||||
// delete anything outside the root through a planted symlink.
|
||||
func TestRemoveThroughPlantedSymlinkBlocked(t *testing.T) {
|
||||
skipIfNoSymlinks(t)
|
||||
ctx := context.Background()
|
||||
|
||||
evil := t.TempDir()
|
||||
evilFile := filepath.Join(evil, "secret.txt")
|
||||
require.NoError(t, os.WriteFile(evilFile, []byte("keep me"), 0600))
|
||||
evilDir := filepath.Join(evil, "secret.d")
|
||||
require.NoError(t, os.Mkdir(evilDir, 0700))
|
||||
|
||||
r := fstest.NewRun(t)
|
||||
f := r.Flocal.(*Fs)
|
||||
linksMode(f)
|
||||
|
||||
// Control: in-tree removals work as normal.
|
||||
require.NoError(t, putFile(ctx, f, "file.txt", "data"))
|
||||
o, err := f.NewObject(ctx, "file.txt")
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, o.Remove(ctx))
|
||||
require.NoError(t, f.Mkdir(ctx, "dir"))
|
||||
require.NoError(t, f.Rmdir(ctx, "dir"))
|
||||
|
||||
// The planted symlink dst/pwn -> outside, faithfully reproduced by --links.
|
||||
require.NoError(t, putLink(ctx, f, "pwn", evil))
|
||||
|
||||
// Removing the outside file and directory named through the planted
|
||||
// symlink must be refused.
|
||||
o, err = f.NewObject(ctx, "pwn/secret.txt")
|
||||
require.NoError(t, err)
|
||||
err = o.Remove(ctx)
|
||||
require.Error(t, err, "removing through a planted symlink should be refused")
|
||||
_, err = os.Lstat(evilFile)
|
||||
require.NoError(t, err, "a file was removed outside the destination at %q", evilFile)
|
||||
|
||||
err = f.Rmdir(ctx, "pwn/secret.d")
|
||||
require.Error(t, err, "removing a directory through a planted symlink should be refused")
|
||||
_, err = os.Lstat(evilDir)
|
||||
require.NoError(t, err, "a directory was removed outside the destination at %q", evilDir)
|
||||
}
|
||||
|
||||
// TestDirMoveThroughPlantedSymlinkBlocked checks DirMove can't move a
|
||||
// directory out of the root through a planted symlink.
|
||||
func TestDirMoveThroughPlantedSymlinkBlocked(t *testing.T) {
|
||||
skipIfNoSymlinks(t)
|
||||
ctx := context.Background()
|
||||
|
||||
evil := t.TempDir()
|
||||
|
||||
r := fstest.NewRun(t)
|
||||
f := r.Flocal.(*Fs)
|
||||
linksMode(f)
|
||||
|
||||
// Control: an in-tree directory move works as normal.
|
||||
require.NoError(t, f.Mkdir(ctx, "dir"))
|
||||
require.NoError(t, f.DirMove(ctx, f, "dir", "sub/moved"))
|
||||
|
||||
// The planted symlink dst/pwn -> outside, faithfully reproduced by --links.
|
||||
require.NoError(t, putLink(ctx, f, "pwn", evil))
|
||||
|
||||
err := f.DirMove(ctx, f, "sub/moved", "pwn/moved")
|
||||
require.Error(t, err, "moving a directory through a planted symlink should be refused")
|
||||
_, err = os.Lstat(filepath.Join(evil, "moved"))
|
||||
require.True(t, os.IsNotExist(err), "a directory escaped the destination into %q", evil)
|
||||
_, err = os.Lstat(filepath.Join(f.root, "sub", "moved"))
|
||||
require.NoError(t, err, "the directory should still be in the destination")
|
||||
}
|
||||
|
||||
// TestEncodingEscapeBlocked checks that a name from a malicious source can't
|
||||
// be decoded into path syntax which writes outside the destination.
|
||||
func TestEncodingEscapeBlocked(t *testing.T) {
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
package local
|
||||
|
||||
import "os"
|
||||
|
||||
// Removes name, retrying on a sharing violation
|
||||
func remove(name string) error {
|
||||
return os.Remove(name)
|
||||
// remove removes name with removeFn, retrying on a sharing violation
|
||||
func remove(name string, removeFn func(string) error) error {
|
||||
return removeFn(name)
|
||||
}
|
||||
@@ -38,7 +38,7 @@ func TestRemove(t *testing.T) {
|
||||
require.NoError(t, fd.Close())
|
||||
})
|
||||
// delete the open file
|
||||
err = remove(name)
|
||||
err = remove(name, os.Remove)
|
||||
require.NoError(t, err)
|
||||
// check it no longer exists
|
||||
assert.False(t, exists())
|
||||
|
||||
@@ -10,12 +10,12 @@ import (
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
// Removes name, retrying on a sharing violation
|
||||
func remove(name string) (err error) {
|
||||
// remove removes name with removeFn, retrying on a sharing violation
|
||||
func remove(name string, removeFn func(string) error) (err error) {
|
||||
const maxTries = 10
|
||||
var sleepTime = 1 * time.Millisecond
|
||||
for i := range maxTries {
|
||||
err = os.Remove(name)
|
||||
err = removeFn(name)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
|
||||
+26
-2
@@ -4,6 +4,7 @@ package local
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
@@ -95,6 +96,11 @@ func (o *Object) setXattr(metadata fs.Metadata) (err error) {
|
||||
if !xattrSupported || o.fs.xattrSupported.Load() == 0 {
|
||||
return nil
|
||||
}
|
||||
// When translating symlinks (-l/--links) write the xattrs through a
|
||||
// descriptor opened under os.Root so a symlink planted in the destination
|
||||
// can't redirect the write outside it (CWE-59). A translated link is
|
||||
// itself the leaf, so it keeps the non-following path based write.
|
||||
var fd *os.File
|
||||
for k, value := range metadata {
|
||||
k = strings.ToLower(k)
|
||||
if _, found := systemMetadataInfo[k]; found {
|
||||
@@ -102,9 +108,27 @@ func (o *Object) setXattr(metadata fs.Metadata) (err error) {
|
||||
}
|
||||
k = xattrPrefix + k
|
||||
v := []byte(value)
|
||||
if o.fs.opt.FollowSymlinks {
|
||||
switch {
|
||||
case o.fs.opt.TranslateSymlinks && !o.translatedLink:
|
||||
if fd == nil {
|
||||
fd, err = o.fs.openFile(o.path, os.O_RDONLY, 0)
|
||||
if os.IsPermission(err) {
|
||||
// A write only file can't be opened for reading but its
|
||||
// owner may still set xattrs on it, so try opening it for
|
||||
// writing instead (which can't succeed for a directory).
|
||||
if wfd, werr := o.fs.openFile(o.path, os.O_WRONLY, 0); werr == nil {
|
||||
fd, err = wfd, nil
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open for xattr: %w", err)
|
||||
}
|
||||
defer fs.CheckClose(fd, &err)
|
||||
}
|
||||
err = xattr.FSet(fd, k, v)
|
||||
case o.fs.opt.FollowSymlinks:
|
||||
err = xattr.Set(o.path, k, v)
|
||||
} else {
|
||||
default:
|
||||
err = xattr.LSet(o.path, k, v)
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
//go:build !openbsd && !plan9
|
||||
|
||||
package local
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/xattr"
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fstest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// TestXattrThroughPlantedSymlinkBlocked checks user metadata (xattrs)
|
||||
// can't be written outside the root through a planted symlink with
|
||||
// --links, while in-tree writes still work.
|
||||
func TestXattrThroughPlantedSymlinkBlocked(t *testing.T) {
|
||||
if !xattrSupported {
|
||||
t.Skip("xattrs not supported on this OS")
|
||||
}
|
||||
skipIfNoSymlinks(t)
|
||||
ctx := context.Background()
|
||||
|
||||
r := fstest.NewRun(t)
|
||||
f := r.Flocal.(*Fs)
|
||||
linksMode(f)
|
||||
|
||||
metadata := fs.Metadata{
|
||||
"pwned": "attacker-controlled-value",
|
||||
}
|
||||
|
||||
// Control: an in-tree directory gets the xattr as normal.
|
||||
_, err := f.MkdirMetadata(ctx, "sub", metadata)
|
||||
require.NoError(t, err)
|
||||
if f.xattrSupported.Load() == 0 {
|
||||
t.Skip("xattrs not supported on this filesystem")
|
||||
}
|
||||
v, err := xattr.LGet(filepath.Join(f.root, "sub"), "user.pwned")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "attacker-controlled-value", string(v))
|
||||
|
||||
// A directory outside the destination, with a pre-existing child,
|
||||
// whose xattrs the attacker targets.
|
||||
evil := t.TempDir()
|
||||
evilDir := filepath.Join(evil, "secret.d")
|
||||
require.NoError(t, os.Mkdir(evilDir, 0700))
|
||||
evilSub := filepath.Join(evilDir, "sub")
|
||||
require.NoError(t, os.Mkdir(evilSub, 0700))
|
||||
|
||||
// The planted symlink dst/pwn -> outside, faithfully reproduced by --links.
|
||||
require.NoError(t, putLink(ctx, f, "pwn", evilDir))
|
||||
|
||||
// The source now presents "pwn/sub" as a directory with attacker-chosen
|
||||
// user metadata. Applying it must not reach through the planted symlink.
|
||||
_, err = f.MkdirMetadata(ctx, "pwn/sub", metadata)
|
||||
require.Error(t, err, "applying metadata through a planted symlink should be refused")
|
||||
|
||||
_, err = xattr.LGet(evilSub, "user.pwned")
|
||||
require.Error(t, err, "xattr escaped through planted symlink to %q", evilSub)
|
||||
}
|
||||
|
||||
// TestXattrWriteOnlyFile checks user metadata can still be set on a
|
||||
// write-only file with --links, where the confined open can't read it.
|
||||
func TestXattrWriteOnlyFile(t *testing.T) {
|
||||
if !xattrSupported {
|
||||
t.Skip("xattrs not supported on this OS")
|
||||
}
|
||||
skipIfNoSymlinks(t)
|
||||
ctx := context.Background()
|
||||
|
||||
r := fstest.NewRun(t)
|
||||
f := r.Flocal.(*Fs)
|
||||
linksMode(f)
|
||||
|
||||
require.NoError(t, putFile(ctx, f, "wo.txt", "write only"))
|
||||
path := filepath.Join(f.root, "wo.txt")
|
||||
require.NoError(t, os.Chmod(path, 0200))
|
||||
|
||||
obj, err := f.NewObject(ctx, "wo.txt")
|
||||
require.NoError(t, err)
|
||||
o := obj.(*Object)
|
||||
err = o.setXattr(fs.Metadata{"potato": "chips"})
|
||||
require.NoError(t, err)
|
||||
if f.xattrSupported.Load() == 0 {
|
||||
t.Skip("xattrs not supported on this filesystem")
|
||||
}
|
||||
// Reading xattrs needs read permission
|
||||
require.NoError(t, os.Chmod(path, 0600))
|
||||
v, err := xattr.LGet(path, "user.potato")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "chips", string(v))
|
||||
}
|
||||
@@ -208,6 +208,24 @@ func (d Du) GetName() xml.Name {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// apiHeaders are the NetStorage API request headers which carry the
|
||||
// account name, the request signature and the signed action. They must
|
||||
// not be forwarded when a redirect leaves the configured host.
|
||||
//
|
||||
// The action header is sent uncanonicalised, hence the "*" prefix.
|
||||
var apiHeaders = []string{"X-Akamai-ACS-Auth-Data", "X-Akamai-ACS-Auth-Sign", "*X-Akamai-ACS-Action"}
|
||||
|
||||
// newClient makes the http client used for all NetStorage requests.
|
||||
//
|
||||
// The signer adds the API headers to every request, so the client
|
||||
// strips them on cross host redirects and refuses an HTTPS to HTTP
|
||||
// downgrade.
|
||||
func newClient(ctx context.Context) *http.Client {
|
||||
client := fshttp.NewClient(ctx)
|
||||
client.CheckRedirect = rest.StripHeadersOnCrossHostRedirectFn(apiHeaders...)
|
||||
return client
|
||||
}
|
||||
|
||||
// NewFs creates a new Fs object from the name and root. It connects to
|
||||
// the host specified in the config file.
|
||||
//
|
||||
@@ -240,7 +258,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := fshttp.NewClient(ctx)
|
||||
client := newClient(ctx)
|
||||
|
||||
f := &Fs{
|
||||
name: name,
|
||||
|
||||
@@ -4,12 +4,17 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/config/configmap"
|
||||
"github.com/rclone/rclone/fs/config/obscure"
|
||||
"github.com/rclone/rclone/fs/object"
|
||||
"github.com/rclone/rclone/lib/rest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -59,3 +64,142 @@ func TestListResumeCannotChangeHost(t *testing.T) {
|
||||
assert.Equal(t, 1, listRequests, "list request sent to the configured host")
|
||||
assert.Equal(t, 0, requests, "request sent to the other host")
|
||||
}
|
||||
|
||||
// apiTestHeaders is a deliberately literal copy of apiHeaders, without
|
||||
// the "*" prefix, so that a header dropped from the production list
|
||||
// shows up as a leak in the cross host tests rather than silently
|
||||
// losing coverage.
|
||||
var apiTestHeaders = []string{"X-Akamai-ACS-Auth-Data", "X-Akamai-ACS-Auth-Sign", "X-Akamai-ACS-Action"}
|
||||
|
||||
// statXML is a minimal stat response saying the root is a directory
|
||||
const statXML = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<stat directory="/dir"><file type="dir" name="dir" mtime="1"/></stat>`
|
||||
|
||||
// newTestFs makes an Fs via NewFs pointing at serverURL.
|
||||
//
|
||||
// NewFs makes a stat request for the root and treats any failure as
|
||||
// the root not existing, so callers check what the servers received
|
||||
// or make a further request rather than relying on its error.
|
||||
func newTestFs(ctx context.Context, t *testing.T, serverURL string) *Fs {
|
||||
u, err := url.Parse(serverURL)
|
||||
require.NoError(t, err)
|
||||
m := configmap.Simple{
|
||||
"type": "netstorage",
|
||||
"protocol": u.Scheme,
|
||||
"host": u.Host + "/dir",
|
||||
"account": "test-account",
|
||||
"secret": obscure.MustObscure("test-secret"),
|
||||
}
|
||||
f, err := NewFs(ctx, "netstorage-test", "", m)
|
||||
require.NoError(t, err)
|
||||
return f.(*Fs)
|
||||
}
|
||||
|
||||
// assertAPIHeaders checks all the API headers are present (want) or
|
||||
// absent (!want) in r.
|
||||
func assertAPIHeaders(t *testing.T, r *http.Request, want bool) {
|
||||
for _, header := range apiTestHeaders {
|
||||
if want {
|
||||
assert.NotEmpty(t, r.Header.Get(header), "%s should be sent", header)
|
||||
} else {
|
||||
assert.Empty(t, r.Header.Get(header), "%s should have been stripped", header)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestRedirectStripsAPIHeadersOnCrossHost checks the API headers are
|
||||
// sent to the configured host but not to another host it redirects to.
|
||||
func TestRedirectStripsAPIHeadersOnCrossHost(t *testing.T) {
|
||||
var otherHits atomic.Int32
|
||||
other := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
otherHits.Add(1)
|
||||
assertAPIHeaders(t, r, false)
|
||||
_, _ = w.Write([]byte(statXML))
|
||||
}))
|
||||
defer other.Close()
|
||||
|
||||
var originHits atomic.Int32
|
||||
origin := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
originHits.Add(1)
|
||||
assertAPIHeaders(t, r, true)
|
||||
http.Redirect(w, r, other.URL+r.URL.Path, http.StatusTemporaryRedirect)
|
||||
}))
|
||||
defer origin.Close()
|
||||
|
||||
newTestFs(context.Background(), t, origin.URL)
|
||||
assert.Equal(t, int32(1), originHits.Load())
|
||||
assert.Equal(t, int32(1), otherHits.Load())
|
||||
}
|
||||
|
||||
// TestUploadStripsAPIHeadersOnCrossHost checks an upload, which
|
||||
// carries the API headers on the PUT as well as in the trailers, does
|
||||
// not send them to another host the configured host redirects to.
|
||||
func TestUploadStripsAPIHeadersOnCrossHost(t *testing.T) {
|
||||
var otherHits atomic.Int32
|
||||
other := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
otherHits.Add(1)
|
||||
assertAPIHeaders(t, r, false)
|
||||
_, _ = w.Write([]byte(statXML))
|
||||
}))
|
||||
defer other.Close()
|
||||
|
||||
var originHits atomic.Int32
|
||||
origin := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
originHits.Add(1)
|
||||
assertAPIHeaders(t, r, true)
|
||||
http.Redirect(w, r, other.URL+r.URL.Path, http.StatusMovedPermanently)
|
||||
}))
|
||||
defer origin.Close()
|
||||
|
||||
ctx := context.Background()
|
||||
f := newTestFs(ctx, t, origin.URL)
|
||||
o := &Object{fs: f, remote: "file"}
|
||||
src := object.NewStaticObjectInfo("file", time.Now(), 4, true, nil, f)
|
||||
err := o.netStorageUploadRequest(ctx, strings.NewReader("data"), src)
|
||||
require.NoError(t, err)
|
||||
// NewFs stat, PUT and the stat after the upload
|
||||
assert.Equal(t, int32(3), originHits.Load())
|
||||
assert.Equal(t, int32(3), otherHits.Load())
|
||||
}
|
||||
|
||||
// TestRedirectKeepsAPIHeadersOnSameHost checks the API headers are
|
||||
// still sent after a redirect which stays on the configured host.
|
||||
func TestRedirectKeepsAPIHeadersOnSameHost(t *testing.T) {
|
||||
var hits atomic.Int32
|
||||
origin := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
hits.Add(1)
|
||||
assertAPIHeaders(t, r, true)
|
||||
if !strings.HasSuffix(r.URL.Path, "/moved") {
|
||||
http.Redirect(w, r, r.URL.Path+"/moved", http.StatusTemporaryRedirect)
|
||||
return
|
||||
}
|
||||
_, _ = w.Write([]byte(statXML))
|
||||
}))
|
||||
defer origin.Close()
|
||||
|
||||
newTestFs(context.Background(), t, origin.URL)
|
||||
assert.Equal(t, int32(2), hits.Load())
|
||||
}
|
||||
|
||||
// TestRedirectRefusesHTTPSDowngrade checks a redirect from HTTPS to
|
||||
// plaintext HTTP is not followed.
|
||||
func TestRedirectRefusesHTTPSDowngrade(t *testing.T) {
|
||||
var targetHits atomic.Int32
|
||||
target := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
targetHits.Add(1)
|
||||
_, _ = w.Write([]byte(statXML))
|
||||
}))
|
||||
defer target.Close()
|
||||
|
||||
origin := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, target.URL+r.URL.Path, http.StatusTemporaryRedirect)
|
||||
}))
|
||||
defer origin.Close()
|
||||
|
||||
ctx, ci := fs.AddConfig(context.Background())
|
||||
ci.InsecureSkipVerify = true
|
||||
f := newTestFs(ctx, t, origin.URL)
|
||||
_, err := f.netStorageStatRequest(ctx, f.url(""), true)
|
||||
require.ErrorIs(t, err, rest.ErrHTTPSDowngrade)
|
||||
assert.Equal(t, int32(0), targetHits.Load())
|
||||
}
|
||||
+273
-40
@@ -41,6 +41,7 @@ import (
|
||||
"github.com/rclone/rclone/lib/oauthutil"
|
||||
"github.com/rclone/rclone/lib/pacer"
|
||||
"github.com/rclone/rclone/lib/rest"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -844,19 +845,33 @@ type Options struct {
|
||||
|
||||
// Fs represents a remote OneDrive
|
||||
type Fs struct {
|
||||
name string // name of this remote
|
||||
root string // the path we are working on
|
||||
opt Options // parsed options
|
||||
ci *fs.ConfigInfo // global config
|
||||
features *fs.Features // optional features
|
||||
srv *rest.Client // the connection to the OneDrive server
|
||||
unAuth *rest.Client // no authentication connection to the OneDrive server
|
||||
dirCache *dircache.DirCache // Map of directory path to directory id
|
||||
pacer *fs.Pacer // pacer for API calls
|
||||
tokenRenewer *oauthutil.Renew // renew the token on expiry
|
||||
driveID string // ID to use for querying Microsoft Graph
|
||||
driveType string // https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/drive
|
||||
hashType hash.Type // type of the hash we are using
|
||||
name string // name of this remote
|
||||
root string // the path we are working on
|
||||
opt Options // parsed options
|
||||
ci *fs.ConfigInfo // global config
|
||||
features *fs.Features // optional features
|
||||
srv *rest.Client // the connection to the OneDrive server
|
||||
unAuth *rest.Client // no authentication connection to the OneDrive server
|
||||
dirCache *dircache.DirCache // Map of directory path to directory id
|
||||
pacer *fs.Pacer // pacer for API calls
|
||||
tokenRenewer *oauthutil.Renew // renew the token on expiry
|
||||
tokenSource *oauthutil.TokenSource // source of the API token
|
||||
sharePoint *sharePointClients // authenticated clients for SharePoint hosts
|
||||
driveID string // ID to use for querying Microsoft Graph
|
||||
driveType string // https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/drive
|
||||
hashType hash.Type // type of the hash we are using
|
||||
}
|
||||
|
||||
// sharePointClients holds the clients authenticated for SharePoint hosts
|
||||
type sharePointClients struct {
|
||||
mu sync.Mutex
|
||||
hosts map[string]sharePointAuth
|
||||
}
|
||||
|
||||
// sharePointAuth is a client authenticated for a SharePoint host
|
||||
type sharePointAuth struct {
|
||||
client *rest.Client
|
||||
tokenSource oauth2.TokenSource
|
||||
}
|
||||
|
||||
// Object describes a OneDrive object
|
||||
@@ -1076,6 +1091,154 @@ func errorHandler(resp *http.Response) error {
|
||||
return errResponse
|
||||
}
|
||||
|
||||
// errPreauthRetired explains an authentication failure on a URL which
|
||||
// SharePoint used to return pre-authenticated.
|
||||
var errPreauthRetired = errors.New("SharePoint refused to authenticate a request - Microsoft is retiring pre-authenticated (tempauth) URLs, see https://rclone.org/onedrive/#pre-authenticated-urls")
|
||||
|
||||
// sharePointDomains are the domains of SharePoint Online in the
|
||||
// different Microsoft clouds
|
||||
var sharePointDomains = []string{".sharepoint.com", ".sharepoint.us", ".sharepoint-mil.us", ".sharepoint.cn", ".sharepoint.de"}
|
||||
|
||||
// stripTempauth removes the tempauth parameter from the URLs the API
|
||||
// returns, which simulates the retirement of pre-authenticated URLs
|
||||
// in tests.
|
||||
var stripTempauth = false
|
||||
|
||||
// returnedURL processes a URL returned by the API before use
|
||||
func returnedURL(rawURL string) string {
|
||||
if !stripTempauth {
|
||||
return rawURL
|
||||
}
|
||||
u, err := url.Parse(rawURL)
|
||||
if err != nil {
|
||||
return rawURL
|
||||
}
|
||||
q := u.Query()
|
||||
q.Del("tempauth")
|
||||
u.RawQuery = q.Encode()
|
||||
return u.String()
|
||||
}
|
||||
|
||||
// urlAuth says how a URL returned by the API is authenticated
|
||||
type urlAuth int
|
||||
|
||||
const (
|
||||
urlAuthNone urlAuth = iota // call without authentication
|
||||
urlAuthAPI // call with the API token
|
||||
urlAuthSharePoint // call with a token for the SharePoint host
|
||||
)
|
||||
|
||||
// apiHost returns the host the API calls made with f.srv go to.
|
||||
func (f *Fs) apiHost() string {
|
||||
endpoint := graphAPIEndpoint[f.opt.Region]
|
||||
if f.opt.TenantURL != "" {
|
||||
endpoint = f.opt.TenantURL
|
||||
}
|
||||
u, err := url.Parse(endpoint)
|
||||
if err != nil || u.Scheme != "https" {
|
||||
return ""
|
||||
}
|
||||
return u.Host
|
||||
}
|
||||
|
||||
// urlAuthFor returns how to authenticate a URL returned by the API,
|
||||
// such as an upload session or an async job monitor.
|
||||
//
|
||||
// Pre-authenticated URLs fail if they are sent an Authorization
|
||||
// header and tokens must not be sent to other hosts, so only HTTPS
|
||||
// URLs without tempauth on the API host or a SharePoint host are
|
||||
// authenticated.
|
||||
func (f *Fs) urlAuthFor(rawURL string) urlAuth {
|
||||
u, err := url.Parse(rawURL)
|
||||
if err != nil || u.Scheme != "https" || u.Query().Has("tempauth") {
|
||||
return urlAuthNone
|
||||
}
|
||||
if apiHost := f.apiHost(); apiHost != "" && strings.EqualFold(u.Host, apiHost) {
|
||||
return urlAuthAPI
|
||||
}
|
||||
if isSharePointHost(u.Hostname()) {
|
||||
return urlAuthSharePoint
|
||||
}
|
||||
return urlAuthNone
|
||||
}
|
||||
|
||||
// isSharePointHost returns true if host is in a SharePoint Online domain.
|
||||
func isSharePointHost(host string) bool {
|
||||
host = strings.ToLower(host)
|
||||
for _, domain := range sharePointDomains {
|
||||
if strings.HasSuffix(host, domain) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// checkSharePointRedirect stops the SharePoint token being sent to a
|
||||
// host which isn't SharePoint, as the token is added to every request
|
||||
// the client makes.
|
||||
func checkSharePointRedirect(req *http.Request, via []*http.Request) error {
|
||||
if len(via) >= 10 {
|
||||
return errors.New("stopped after 10 redirects")
|
||||
}
|
||||
if req.URL.Scheme != "https" || !isSharePointHost(req.URL.Hostname()) {
|
||||
return fmt.Errorf("refusing to send a SharePoint token on a redirect to %s://%s", req.URL.Scheme, req.URL.Host)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// clientForURL returns the client to call a URL returned by the API with.
|
||||
func (f *Fs) clientForURL(ctx context.Context, rawURL string) (*rest.Client, error) {
|
||||
switch f.urlAuthFor(rawURL) {
|
||||
case urlAuthAPI:
|
||||
return f.srv, nil
|
||||
case urlAuthSharePoint:
|
||||
u, _ := url.Parse(rawURL)
|
||||
return f.sharePointClient(ctx, u.Host)
|
||||
}
|
||||
return f.unAuth, nil
|
||||
}
|
||||
|
||||
// sharePointClient returns a client authenticated for the SharePoint
|
||||
// host, which upload session and async job monitor URLs need once
|
||||
// they are no longer pre-authenticated.
|
||||
//
|
||||
// The token is got from the existing credentials, which Entra ID
|
||||
// allows for SharePoint as the user has consented to the Graph file
|
||||
// scopes.
|
||||
func (f *Fs) sharePointClient(ctx context.Context, host string) (*rest.Client, error) {
|
||||
if f.tokenSource == nil || f.sharePoint == nil {
|
||||
return nil, fmt.Errorf("%w: no credentials to get a SharePoint token with", errPreauthRetired)
|
||||
}
|
||||
host = strings.ToLower(host)
|
||||
f.sharePoint.mu.Lock()
|
||||
defer f.sharePoint.mu.Unlock()
|
||||
sp, ok := f.sharePoint.hosts[host]
|
||||
if !ok {
|
||||
tokenSource := f.tokenSource.ScopedTokenSource([]string{"https://" + host + "/.default"})
|
||||
client := oauth2.NewClient(oauthutil.Context(ctx, fshttp.NewClient(ctx)), tokenSource)
|
||||
client.CheckRedirect = checkSharePointRedirect
|
||||
sp = sharePointAuth{client: rest.NewClient(client), tokenSource: tokenSource}
|
||||
f.sharePoint.hosts[host] = sp
|
||||
fs.Debugf(f, "Using a SharePoint token for %s", host)
|
||||
}
|
||||
// Get the token now so failures are reported before the client is used
|
||||
if _, err := sp.tokenSource.Token(); err != nil {
|
||||
return nil, fmt.Errorf("%w: failed to get a SharePoint token: %w", errPreauthRetired, err)
|
||||
}
|
||||
return sp.client, nil
|
||||
}
|
||||
|
||||
// checkPreauthRetired adds an explanation to a 401 error from a URL
|
||||
// returned by the API which needs a SharePoint token, as these were
|
||||
// pre-authenticated until Microsoft retired them.
|
||||
func (f *Fs) checkPreauthRetired(rawURL string, resp *http.Response, err error) error {
|
||||
if err == nil || resp == nil || resp.StatusCode != http.StatusUnauthorized ||
|
||||
f.driveType == driveTypePersonal || errors.Is(err, errPreauthRetired) || f.urlAuthFor(rawURL) != urlAuthSharePoint {
|
||||
return err
|
||||
}
|
||||
return fmt.Errorf("%w: %w", errPreauthRetired, err)
|
||||
}
|
||||
|
||||
func checkUploadChunkSize(cs fs.SizeSuffix) error {
|
||||
const minChunkSize = fs.SizeSuffixBase
|
||||
if cs%chunkSizeMultiple != 0 {
|
||||
@@ -1144,16 +1307,18 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||
|
||||
ci := fs.GetConfig(ctx)
|
||||
f := &Fs{
|
||||
name: name,
|
||||
root: root,
|
||||
opt: *opt,
|
||||
ci: ci,
|
||||
driveID: opt.DriveID,
|
||||
driveType: opt.DriveType,
|
||||
srv: rest.NewClient(oAuthClient).SetRoot(rootURL),
|
||||
unAuth: rest.NewClient(client).SetRoot(rootURL),
|
||||
pacer: fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant))),
|
||||
hashType: QuickXorHashType,
|
||||
name: name,
|
||||
root: root,
|
||||
opt: *opt,
|
||||
ci: ci,
|
||||
driveID: opt.DriveID,
|
||||
driveType: opt.DriveType,
|
||||
srv: rest.NewClient(oAuthClient).SetRoot(rootURL),
|
||||
tokenSource: ts,
|
||||
sharePoint: &sharePointClients{hosts: make(map[string]sharePointAuth)},
|
||||
unAuth: rest.NewClient(client).SetRoot(rootURL),
|
||||
pacer: fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant))),
|
||||
hashType: QuickXorHashType,
|
||||
}
|
||||
f.features = (&fs.Features{
|
||||
CaseInsensitive: true,
|
||||
@@ -1725,17 +1890,25 @@ func (f *Fs) waitForJob(ctx context.Context, location string, o *Object) error {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
var body []byte
|
||||
var redirected bool
|
||||
err = f.pacer.Call(func() (bool, error) {
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, location, nil)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
// The monitor URL needs no authentication, but it should still
|
||||
// go through the configured transport and honour ctx
|
||||
resp, err = f.unAuth.Do(req)
|
||||
client, err := f.clientForURL(ctx, location)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
resp, err = client.Do(req)
|
||||
if err != nil {
|
||||
return fserrors.ShouldRetry(err), err
|
||||
}
|
||||
redirected = resp.Request.URL.String() != req.URL.String()
|
||||
if resp.StatusCode == http.StatusUnauthorized {
|
||||
_ = resp.Body.Close()
|
||||
return false, f.checkPreauthRetired(location, resp, fmt.Errorf("async job monitor: HTTP error %s", resp.Status))
|
||||
}
|
||||
body, err = rest.ReadBody(resp)
|
||||
return fserrors.ShouldRetry(err), err
|
||||
})
|
||||
@@ -1748,6 +1921,11 @@ func (f *Fs) waitForJob(ctx context.Context, location string, o *Object) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("async status result not JSON: %q: %w", body, err)
|
||||
}
|
||||
// An authenticated monitor redirects to the new item when the
|
||||
// job has finished instead of returning its status
|
||||
if status.Status == "" && redirected {
|
||||
status.Status = "completed"
|
||||
}
|
||||
|
||||
switch status.Status {
|
||||
case "failed":
|
||||
@@ -1847,7 +2025,7 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (dst fs.Obj
|
||||
}
|
||||
|
||||
// read location header
|
||||
location := resp.Header.Get("Location")
|
||||
location := returnedURL(resp.Header.Get("Location"))
|
||||
if location == "" {
|
||||
return nil, errors.New("didn't receive location header in copy response")
|
||||
}
|
||||
@@ -1858,6 +2036,10 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (dst fs.Obj
|
||||
fs.Debugf(src, "Server-side copy failed - file not shared between drives")
|
||||
return nil, fs.ErrorCantCopy
|
||||
}
|
||||
if errors.Is(err, errPreauthRetired) {
|
||||
fs.Debugf(src, "Server-side copy can't be monitored - copying another way: %v", err)
|
||||
return nil, fs.ErrorCantCopy
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -2532,16 +2714,23 @@ func (o *Object) openContentPrefer(ctx context.Context, options ...fs.OpenOption
|
||||
return o.openWithRedirect(ctx, &opts)
|
||||
}
|
||||
|
||||
// openWithRedirect downloads via /content style endpoints that 302 to a preauthenticated URL.
|
||||
// openWithRedirect downloads via /content style endpoints that 302 to
|
||||
// a download URL, which is pre-authenticated or needs a SharePoint
|
||||
// token.
|
||||
func (o *Object) openWithRedirect(ctx context.Context, opts *rest.Opts) (in io.ReadCloser, err error) {
|
||||
var resp *http.Response
|
||||
// Make a note of the redirect target as we need to call it without Auth
|
||||
// Make a note of the redirect target as it needs different auth
|
||||
var redirectReq *http.Request
|
||||
opts.CheckRedirect = func(req *http.Request, via []*http.Request) error {
|
||||
if len(via) >= 10 {
|
||||
return errors.New("stopped after 10 redirects")
|
||||
}
|
||||
// Preauthenticated download URLs must not carry the Graph Authorization header.
|
||||
if stripTempauth {
|
||||
if u, err := url.Parse(returnedURL(req.URL.String())); err == nil {
|
||||
req.URL = u
|
||||
}
|
||||
}
|
||||
// Download URLs must not carry the Graph Authorization header.
|
||||
req.Header.Del("Authorization")
|
||||
// Keep Prefer on the redirect when forcing infected download; some SharePoint
|
||||
// endpoints honor it only on the final download request.
|
||||
@@ -2580,17 +2769,24 @@ func (o *Object) openWithRedirect(ctx context.Context, opts *rest.Opts) (in io.R
|
||||
return nil, err
|
||||
}
|
||||
if redirectReq != nil {
|
||||
redirectURL := redirectReq.URL.String()
|
||||
var client *rest.Client
|
||||
client, err = o.fs.clientForURL(ctx, redirectURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = o.fs.pacer.Call(func() (bool, error) {
|
||||
resp, err = o.fs.unAuth.Do(redirectReq)
|
||||
resp, err = client.Do(redirectReq)
|
||||
if err != nil {
|
||||
return shouldRetry(ctx, resp, err)
|
||||
}
|
||||
// unAuth.Do does not check status; treat non-2xx as failure so a malware
|
||||
// Do does not check status; treat non-2xx as failure so a malware
|
||||
// JSON body is not written out as file content.
|
||||
if resp.StatusCode < 200 || resp.StatusCode > 299 {
|
||||
body, _ := io.ReadAll(io.LimitReader(resp.Body, 512))
|
||||
_ = resp.Body.Close()
|
||||
err = fmt.Errorf("HTTP error %d (%s) %s", resp.StatusCode, resp.Status, strings.TrimSpace(string(body)))
|
||||
err = o.fs.checkPreauthRetired(redirectURL, resp, err)
|
||||
if strings.Contains(string(body), "malwareDetected") || resp.Header.Get("X-Virus-Infected") != "" {
|
||||
err = malwareDownloadError(o.fs.opt.AVOverride, err)
|
||||
}
|
||||
@@ -2612,7 +2808,19 @@ func (o *Object) openWithRedirect(ctx context.Context, opts *rest.Opts) (in io.R
|
||||
// Overwrite size with actual size since size readings from Onedrive is unreliable.
|
||||
o.size = resp.ContentLength
|
||||
}
|
||||
return resp.Body, err
|
||||
return o.checkRange(resp, opts.Options)
|
||||
}
|
||||
|
||||
// checkRange returns the body of a download, checking it is the range
|
||||
// requested in options.
|
||||
func (o *Object) checkRange(resp *http.Response, options []fs.OpenOption) (in io.ReadCloser, err error) {
|
||||
// The size isn't passed as it is unreliable on OneDrive
|
||||
err = rest.CheckContentRange(resp, options, -1)
|
||||
if err != nil {
|
||||
_ = resp.Body.Close()
|
||||
return nil, err
|
||||
}
|
||||
return resp.Body, nil
|
||||
}
|
||||
|
||||
// malwareDownloadError formats an error when the server blocks a malware-flagged file.
|
||||
@@ -2652,12 +2860,16 @@ func (o *Object) getPosition(ctx context.Context, url string) (pos int64, err er
|
||||
}
|
||||
var info api.UploadFragmentResponse
|
||||
var resp *http.Response
|
||||
client, err := o.fs.clientForURL(ctx, url)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
err = o.fs.pacer.Call(func() (bool, error) {
|
||||
resp, err = o.fs.srv.CallJSON(ctx, &opts, nil, &info)
|
||||
resp, err = client.CallJSON(ctx, &opts, nil, &info)
|
||||
return shouldRetry(ctx, resp, err)
|
||||
})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return 0, o.fs.checkPreauthRetired(url, resp, err)
|
||||
}
|
||||
if len(info.NextExpectedRanges) != 1 {
|
||||
return 0, fmt.Errorf("bad number of ranges in upload position: %v", info.NextExpectedRanges)
|
||||
@@ -2681,6 +2893,10 @@ func (o *Object) uploadFragment(ctx context.Context, url string, start int64, to
|
||||
var resp *http.Response
|
||||
var body []byte
|
||||
skip := int64(0)
|
||||
client, err := o.fs.clientForURL(ctx, url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = o.fs.pacer.Call(func() (bool, error) {
|
||||
toSend := chunkSize - skip
|
||||
opts := rest.Opts{
|
||||
@@ -2692,7 +2908,7 @@ func (o *Object) uploadFragment(ctx context.Context, url string, start int64, to
|
||||
Options: options,
|
||||
}
|
||||
_, _ = chunk.Seek(skip, io.SeekStart)
|
||||
resp, err = o.fs.unAuth.Call(ctx, &opts)
|
||||
resp, err = client.Call(ctx, &opts)
|
||||
if err != nil && resp != nil && resp.StatusCode == http.StatusRequestedRangeNotSatisfiable {
|
||||
fs.Debugf(o, "Received 416 error - reading current position from server: %v", err)
|
||||
pos, posErr := o.getPosition(ctx, url)
|
||||
@@ -2731,7 +2947,7 @@ func (o *Object) uploadFragment(ctx context.Context, url string, start int64, to
|
||||
}
|
||||
return false, nil
|
||||
})
|
||||
return info, err
|
||||
return info, o.fs.checkPreauthRetired(url, resp, err)
|
||||
}
|
||||
|
||||
// cancelUploadSession cancels an upload session
|
||||
@@ -2742,11 +2958,15 @@ func (o *Object) cancelUploadSession(ctx context.Context, url string) (err error
|
||||
NoResponse: true,
|
||||
}
|
||||
var resp *http.Response
|
||||
client, err := o.fs.clientForURL(ctx, url)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = o.fs.pacer.Call(func() (bool, error) {
|
||||
resp, err = o.fs.unAuth.Call(ctx, &opts)
|
||||
resp, err = client.Call(ctx, &opts)
|
||||
return shouldRetry(ctx, resp, err)
|
||||
})
|
||||
return
|
||||
return o.fs.checkPreauthRetired(url, resp, err)
|
||||
}
|
||||
|
||||
// uploadMultipart uploads a file using multipart upload
|
||||
@@ -2764,7 +2984,20 @@ func (o *Object) uploadMultipart(ctx context.Context, in io.Reader, src fs.Objec
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uploadURL := session.UploadURL
|
||||
uploadURL := returnedURL(session.UploadURL)
|
||||
|
||||
// Check a session which needs SharePoint authentication can get it
|
||||
// before reading any data, so it can be uploaded in a single part
|
||||
// instead if it can't.
|
||||
if o.fs.urlAuthFor(uploadURL) == urlAuthSharePoint {
|
||||
if _, err = o.getPosition(ctx, uploadURL); err != nil {
|
||||
if !errors.Is(err, errPreauthRetired) || size >= int64(maxSinglePartSize) {
|
||||
return nil, err
|
||||
}
|
||||
fs.Debugf(o, "Uploading in a single part as the upload session can't be used: %v", err)
|
||||
return o.uploadSinglepart(ctx, in, src, options...)
|
||||
}
|
||||
}
|
||||
|
||||
// Cancel the session if something went wrong
|
||||
defer atexit.OnError(&err, func() {
|
||||
|
||||
@@ -3,6 +3,7 @@ package onedrive
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
@@ -44,6 +45,10 @@ const (
|
||||
// https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_invite?view=odsp-graph-online#http-request-1
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.BoolVar(&stripTempauth, "strip-tempauth", false, "Remove tempauth from URLs the API returns to simulate the retirement of pre-authenticated URLs")
|
||||
}
|
||||
|
||||
// TestMain drives the tests
|
||||
func TestMain(m *testing.M) {
|
||||
fstest.TestMain(m)
|
||||
@@ -818,3 +823,49 @@ func TestWaitForJobCancel(t *testing.T) {
|
||||
t.Fatal("waitForJob did not return after the context was cancelled")
|
||||
}
|
||||
}
|
||||
|
||||
// TestWaitForJobUnauthorized checks that a monitor URL which refuses
|
||||
// the request fails straight away instead of polling until the timeout.
|
||||
func TestWaitForJobUnauthorized(t *testing.T) {
|
||||
var polls atomic.Int32
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
polls.Add(1)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusUnauthorized)
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{"error": map[string]any{"code": "unauthenticated", "message": "no token"}})
|
||||
}))
|
||||
t.Cleanup(server.Close)
|
||||
f, _ := newChangeNotifyTestFs(t, http.NotFoundHandler())
|
||||
f.unAuth = rest.NewClient(fshttp.NewClient(context.Background()))
|
||||
f.driveType = driveTypeBusiness
|
||||
|
||||
err := f.waitForJob(context.Background(), server.URL+"/monitor", &Object{remote: "file.txt"})
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "401")
|
||||
assert.Equal(t, int32(1), polls.Load())
|
||||
}
|
||||
|
||||
// TestWaitForJobRedirectCompleted checks that a monitor which
|
||||
// redirects to the new item, as it does when authenticated, is taken
|
||||
// to mean the job has finished.
|
||||
func TestWaitForJobRedirectCompleted(t *testing.T) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case "/monitor":
|
||||
http.Redirect(w, r, "/item", http.StatusSeeOther)
|
||||
case "/item":
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = fmt.Fprint(w, `{"id":"newid","name":"file.txt","size":5,"file":{}}`)
|
||||
default:
|
||||
t.Errorf("unexpected request %s", r.URL)
|
||||
}
|
||||
}))
|
||||
t.Cleanup(server.Close)
|
||||
f, _ := newChangeNotifyTestFs(t, http.NotFoundHandler())
|
||||
f.unAuth = rest.NewClient(fshttp.NewClient(context.Background()))
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
err := f.waitForJob(ctx, server.URL+"/monitor", &Object{remote: "file.txt", hasMetaData: true})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -13,11 +14,14 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/config/configmap"
|
||||
"github.com/rclone/rclone/fs/object"
|
||||
"github.com/rclone/rclone/lib/oauthutil"
|
||||
"github.com/rclone/rclone/lib/pacer"
|
||||
"github.com/rclone/rclone/lib/rest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
// fragmentServer is a fake OneDrive upload session which records the
|
||||
@@ -66,6 +70,8 @@ func (s *fragmentServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
_, _ = fmt.Fprintf(w, `{"nextExpectedRanges":["%d-%d"]}`, len(s.received), s.size-1)
|
||||
case r.Method == "DELETE" && r.URL.Path == "/upload":
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
default:
|
||||
s.t.Errorf("unexpected request %s %s", r.Method, r.URL.Path)
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
@@ -118,3 +124,327 @@ func TestUploadMultipartSkip(t *testing.T) {
|
||||
assert.Equal(t, 2, s.fragments)
|
||||
assert.Equal(t, 3, s.attempts, "expected one 416, a partial re-send and the final fragment")
|
||||
}
|
||||
|
||||
// TestURLAuthFor checks that tokens are only sent to HTTPS URLs on
|
||||
// the API host or a SharePoint host which aren't pre-authenticated.
|
||||
func TestURLAuthFor(t *testing.T) {
|
||||
const tenant = "https://contoso-my.sharepoint.com/_api"
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
region string
|
||||
tenantURL string
|
||||
url string
|
||||
want urlAuth
|
||||
}{
|
||||
{"graph", "global", "", "https://graph.microsoft.com/v1.0/drives/x/items/y/uploadSession", urlAuthAPI},
|
||||
{"graph case", "global", "", "https://Graph.Microsoft.com/v1.0/monitor/abc", urlAuthAPI},
|
||||
{"graph tempauth", "global", "", "https://graph.microsoft.com/v1.0/upload?tempauth=abc", urlAuthNone},
|
||||
{"graph http", "global", "", "http://graph.microsoft.com/v1.0/upload", urlAuthNone},
|
||||
{"graph other region", "global", "", "https://graph.microsoft.us/v1.0/upload", urlAuthNone},
|
||||
{"graph us", "us", "", "https://graph.microsoft.us/v1.0/upload", urlAuthAPI},
|
||||
{"graph lookalike", "global", "", "https://graph.microsoft.com.example.com/upload", urlAuthNone},
|
||||
{"sharepoint tempauth", "global", "", "https://contoso-my.sharepoint.com/_api/v2.0/upload?guid=x&tempauth=abc", urlAuthNone},
|
||||
{"sharepoint", "global", "", "https://contoso-my.sharepoint.com/_api/v2.0/upload?guid=x", urlAuthSharePoint},
|
||||
{"sharepoint case", "global", "", "https://Contoso.SharePoint.com/_api/v2.0/monitor/abc", urlAuthSharePoint},
|
||||
{"sharepoint us", "us", "", "https://contoso.sharepoint.us/_api/v2.0/upload", urlAuthSharePoint},
|
||||
{"sharepoint cn", "cn", "", "https://contoso.sharepoint.cn/_api/v2.0/upload", urlAuthSharePoint},
|
||||
{"sharepoint http", "global", "", "http://contoso-my.sharepoint.com/_api/v2.0/upload", urlAuthNone},
|
||||
{"sharepoint lookalike", "global", "", "https://contoso.sharepoint.com.example.com/upload", urlAuthNone},
|
||||
{"sharepoint suffix only", "global", "", "https://evilsharepoint.com/upload", urlAuthNone},
|
||||
{"personal", "global", "", "https://api.onedrive.com/rup/abc", urlAuthNone},
|
||||
{"personal upload", "global", "", "https://my.microsoftpersonalcontent.com/personal/abc/_api/v2.0/drive/items/x/uploadSession", urlAuthNone},
|
||||
{"unparseable", "global", "", "https://graph.microsoft.com/%zz", urlAuthNone},
|
||||
{"tenant", "global", tenant, "https://contoso-my.sharepoint.com/_api/v2.0/monitor/abc", urlAuthAPI},
|
||||
{"tenant tempauth", "global", tenant, "https://contoso-my.sharepoint.com/_api/v2.0/upload?tempauth=abc", urlAuthNone},
|
||||
{"tenant graph", "global", tenant, "https://graph.microsoft.com/v1.0/upload", urlAuthNone},
|
||||
{"tenant other sharepoint", "global", tenant, "https://contoso.sharepoint.com/_api/v2.0/upload", urlAuthSharePoint},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
f := &Fs{}
|
||||
f.opt.Region = tc.region
|
||||
f.opt.TenantURL = tc.tenantURL
|
||||
assert.Equal(t, tc.want, f.urlAuthFor(tc.url))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestCheckSharePointRedirect checks the SharePoint token is only
|
||||
// sent on redirects to SharePoint over HTTPS.
|
||||
func TestCheckSharePointRedirect(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
url string
|
||||
ok bool
|
||||
}{
|
||||
{"https://contoso-my.sharepoint.com/download.aspx", true},
|
||||
{"https://205807-ipv4v6.gr.global.aa-rt.sharepoint.com/download.aspx?tempauth=x", true},
|
||||
{"https://contoso.sharepoint.us/download.aspx", true},
|
||||
{"http://contoso-my.sharepoint.com/download.aspx", false},
|
||||
{"https://contoso.sharepoint.com.example.com/download.aspx", false},
|
||||
{"https://graph.microsoft.com/v1.0/me", false},
|
||||
{"https://example.com/", false},
|
||||
} {
|
||||
req, err := http.NewRequest("GET", tc.url, nil)
|
||||
require.NoError(t, err)
|
||||
err = checkSharePointRedirect(req, nil)
|
||||
if tc.ok {
|
||||
assert.NoError(t, err, tc.url)
|
||||
} else {
|
||||
assert.Error(t, err, tc.url)
|
||||
}
|
||||
}
|
||||
req, err := http.NewRequest("GET", "https://contoso-my.sharepoint.com/", nil)
|
||||
require.NoError(t, err)
|
||||
assert.Error(t, checkSharePointRedirect(req, make([]*http.Request, 10)), "too many redirects")
|
||||
}
|
||||
|
||||
// TestCheckPreauthRetired checks which 401 errors get the explanation.
|
||||
func TestCheckPreauthRetired(t *testing.T) {
|
||||
const sharePointURL = "https://contoso-my.sharepoint.com/_api/v2.0/upload?guid=x"
|
||||
errBase := errors.New("HTTP error 401")
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
driveType string
|
||||
url string
|
||||
status int
|
||||
want bool
|
||||
}{
|
||||
{"sharepoint 401", driveTypeBusiness, sharePointURL, http.StatusUnauthorized, true},
|
||||
{"library 401", driveTypeSharepoint, sharePointURL, http.StatusUnauthorized, true},
|
||||
{"personal 401", driveTypePersonal, sharePointURL, http.StatusUnauthorized, false},
|
||||
{"sharepoint 403", driveTypeBusiness, sharePointURL, http.StatusForbidden, false},
|
||||
{"tempauth 401", driveTypeBusiness, sharePointURL + "&tempauth=abc", http.StatusUnauthorized, false},
|
||||
{"graph 401", driveTypeBusiness, "https://graph.microsoft.com/v1.0/upload", http.StatusUnauthorized, false},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
f := &Fs{driveType: tc.driveType}
|
||||
f.opt.Region = "global"
|
||||
err := f.checkPreauthRetired(tc.url, &http.Response{StatusCode: tc.status}, errBase)
|
||||
assert.ErrorIs(t, err, errBase)
|
||||
assert.Equal(t, tc.want, errors.Is(err, errPreauthRetired), "err = %v", err)
|
||||
})
|
||||
}
|
||||
f := &Fs{driveType: driveTypeBusiness}
|
||||
assert.NoError(t, f.checkPreauthRetired(sharePointURL, &http.Response{StatusCode: http.StatusUnauthorized}, nil))
|
||||
assert.ErrorIs(t, f.checkPreauthRetired(sharePointURL, nil, errBase), errBase)
|
||||
}
|
||||
|
||||
// TestSharePointClient checks that the client for a SharePoint host
|
||||
// is authenticated with a token for that host got from the existing
|
||||
// refresh token, which is fetched once and not stored.
|
||||
func TestSharePointClient(t *testing.T) {
|
||||
var scopes []string
|
||||
var auths []string
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case "/token":
|
||||
_ = r.ParseForm()
|
||||
assert.Equal(t, "refresh_token", r.PostForm.Get("grant_type"))
|
||||
assert.Equal(t, "refresh", r.PostForm.Get("refresh_token"))
|
||||
scopes = append(scopes, r.PostForm.Get("scope"))
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = fmt.Fprint(w, `{"access_token":"sharepoint_token","token_type":"Bearer","expires_in":3600}`)
|
||||
case "/upload":
|
||||
auths = append(auths, r.Header.Get("Authorization"))
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = fmt.Fprint(w, `{"nextExpectedRanges":["0-"]}`)
|
||||
case "/redirect":
|
||||
http.Redirect(w, r, "/upload", http.StatusFound)
|
||||
default:
|
||||
t.Errorf("unexpected request %s %s", r.Method, r.URL)
|
||||
}
|
||||
}))
|
||||
t.Cleanup(server.Close)
|
||||
|
||||
storedToken := `{"access_token":"graph_token","token_type":"Bearer","refresh_token":"refresh","expiry":"2099-01-01T00:00:00Z"}`
|
||||
m := configmap.Simple{"token": storedToken}
|
||||
ctx := context.Background()
|
||||
_, ts, err := oauthutil.NewClientWithBaseClient(ctx, "remote", m, &oauthutil.Config{
|
||||
ClientID: "client_id",
|
||||
ClientSecret: "client_secret",
|
||||
TokenURL: server.URL + "/token",
|
||||
}, server.Client())
|
||||
require.NoError(t, err)
|
||||
f := &Fs{tokenSource: ts, sharePoint: &sharePointClients{hosts: make(map[string]sharePointAuth)}}
|
||||
|
||||
for range 2 {
|
||||
client, err := f.sharePointClient(ctx, "Contoso-my.sharepoint.com")
|
||||
require.NoError(t, err)
|
||||
_, err = client.Call(ctx, &rest.Opts{Method: "GET", RootURL: server.URL + "/upload"})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
assert.Equal(t, []string{"https://contoso-my.sharepoint.com/.default"}, scopes, "token should be fetched once for the host")
|
||||
assert.Equal(t, []string{"Bearer sharepoint_token", "Bearer sharepoint_token"}, auths)
|
||||
assert.Equal(t, storedToken, m["token"], "the stored token must not change")
|
||||
|
||||
// The token isn't sent on a redirect to a host which isn't SharePoint
|
||||
client, err := f.sharePointClient(ctx, "contoso-my.sharepoint.com")
|
||||
require.NoError(t, err)
|
||||
_, err = client.Call(ctx, &rest.Opts{Method: "GET", RootURL: server.URL + "/redirect"})
|
||||
assert.ErrorContains(t, err, "refusing to send a SharePoint token")
|
||||
assert.Len(t, auths, 2)
|
||||
|
||||
// Without credentials there is no client and the error explains why
|
||||
_, err = (&Fs{}).sharePointClient(ctx, "contoso-my.sharepoint.com")
|
||||
assert.ErrorIs(t, err, errPreauthRetired)
|
||||
}
|
||||
|
||||
// TestUploadSessionFallback checks that an upload session which needs
|
||||
// SharePoint authentication which can't be got is replaced by a single
|
||||
// part upload before any data is read.
|
||||
func TestUploadSessionFallback(t *testing.T) {
|
||||
content := bytes.Repeat([]byte("onedrive"), 1024)
|
||||
var requests []string
|
||||
var uploaded []byte
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
requests = append(requests, r.Method+" "+r.URL.Path)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
switch {
|
||||
case r.Method == "POST" && r.URL.Path == "/root/createUploadSession":
|
||||
_, _ = fmt.Fprint(w, `{"uploadUrl":"https://contoso-my.sharepoint.com/_api/v2.0/upload?guid=x","nextExpectedRanges":["0-"]}`)
|
||||
case r.Method == "PUT" && r.URL.Path == "/root/content":
|
||||
var err error
|
||||
uploaded, err = io.ReadAll(r.Body)
|
||||
require.NoError(t, err)
|
||||
_, _ = fmt.Fprintf(w, `{"id":"fake-id","name":"remote","size":%d,"file":{}}`, len(uploaded))
|
||||
case r.Method == "PATCH":
|
||||
_, _ = fmt.Fprintf(w, `{"id":"fake-id","name":"remote","size":%d,"file":{}}`, len(uploaded))
|
||||
default:
|
||||
t.Errorf("unexpected request %s %s", r.Method, r.URL)
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
}))
|
||||
t.Cleanup(server.Close)
|
||||
client := rest.NewClient(server.Client()).SetRoot(server.URL)
|
||||
f := &Fs{
|
||||
ci: fs.GetConfig(context.Background()),
|
||||
srv: client,
|
||||
unAuth: client,
|
||||
driveType: driveTypeBusiness,
|
||||
pacer: fs.NewPacer(context.Background(), pacer.NewDefault(pacer.MinSleep(time.Millisecond), pacer.MaxSleep(10*time.Millisecond))),
|
||||
}
|
||||
f.opt.Region = "global"
|
||||
f.opt.ChunkSize = fs.SizeSuffix(len(content) / 2)
|
||||
o := &Object{fs: f}
|
||||
|
||||
src := object.NewStaticObjectInfo("remote", time.Now(), int64(len(content)), true, nil, nil)
|
||||
_, err := o.uploadMultipart(context.Background(), bytes.NewReader(content), src)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, content, uploaded)
|
||||
assert.Equal(t, []string{"POST /root/createUploadSession", "PUT /root/content"}, requests[:2])
|
||||
}
|
||||
|
||||
// redirectTransport sends every request to the test server, so URLs
|
||||
// on other hosts can be tested.
|
||||
type redirectTransport struct {
|
||||
server *httptest.Server
|
||||
}
|
||||
|
||||
func (t redirectTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
req = req.Clone(req.Context())
|
||||
req.URL.Scheme = "http"
|
||||
req.URL.Host = t.server.Listener.Addr().String()
|
||||
return t.server.Client().Transport.RoundTrip(req)
|
||||
}
|
||||
|
||||
// newDownloadTest returns an Object which downloads content from a
|
||||
// server which handles the /content call with contentHandler and
|
||||
// serves download.aspx with Range support, recording the
|
||||
// Authorization header of each download.
|
||||
func newDownloadTest(t *testing.T, content []byte, contentHandler http.HandlerFunc) (o *Object, auths *[]string) {
|
||||
auths = new([]string)
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case "/items/fake/content":
|
||||
contentHandler(w, r)
|
||||
case "/download.aspx":
|
||||
*auths = append(*auths, r.Header.Get("Authorization"))
|
||||
http.ServeContent(w, r, "", time.Time{}, bytes.NewReader(content))
|
||||
default:
|
||||
t.Errorf("unexpected request %s %s", r.Method, r.URL)
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
}))
|
||||
t.Cleanup(server.Close)
|
||||
transport := redirectTransport{server: server}
|
||||
sharePointToken := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: "sharepoint_token"})
|
||||
sharePointHTTP := &http.Client{Transport: &oauth2.Transport{Source: sharePointToken, Base: transport}}
|
||||
f := &Fs{
|
||||
ci: fs.GetConfig(context.Background()),
|
||||
srv: rest.NewClient(server.Client()).SetRoot(server.URL),
|
||||
unAuth: rest.NewClient(&http.Client{Transport: transport}),
|
||||
driveType: driveTypeBusiness,
|
||||
tokenSource: &oauthutil.TokenSource{},
|
||||
sharePoint: &sharePointClients{hosts: map[string]sharePointAuth{
|
||||
"contoso-my.sharepoint.com": {client: rest.NewClient(sharePointHTTP), tokenSource: sharePointToken},
|
||||
}},
|
||||
pacer: fs.NewPacer(context.Background(), pacer.NewDefault(pacer.MinSleep(time.Millisecond), pacer.MaxSleep(10*time.Millisecond))),
|
||||
}
|
||||
f.opt.Region = "global"
|
||||
return &Object{fs: f, id: "fake", size: int64(len(content))}, auths
|
||||
}
|
||||
|
||||
// TestOpenRedirectAuth checks that downloads are redirected to a
|
||||
// pre-authenticated URL without authentication and to a SharePoint
|
||||
// URL with a SharePoint token.
|
||||
func TestOpenRedirectAuth(t *testing.T) {
|
||||
content := []byte("0123456789abcdefghij")
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
location string
|
||||
wantAuth string
|
||||
}{
|
||||
{"tempauth", "https://contoso-my.sharepoint.com/download.aspx?UniqueId=x&tempauth=v1.secret", ""},
|
||||
{"sharepoint", "https://contoso-my.sharepoint.com/download.aspx?UniqueId=x", "Bearer sharepoint_token"},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
o, auths := newDownloadTest(t, content, func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, test.location, http.StatusFound)
|
||||
})
|
||||
in, err := o.Open(context.Background(), &fs.RangeOption{Start: 5, End: 9})
|
||||
require.NoError(t, err)
|
||||
got, err := io.ReadAll(in)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, in.Close())
|
||||
assert.Equal(t, "56789", string(got))
|
||||
assert.Equal(t, []string{test.wantAuth}, *auths)
|
||||
})
|
||||
}
|
||||
|
||||
// Without credentials the error explains why
|
||||
o, auths := newDownloadTest(t, content, func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "https://contoso-my.sharepoint.com/download.aspx?UniqueId=x", http.StatusFound)
|
||||
})
|
||||
o.fs.tokenSource = nil
|
||||
_, err := o.Open(context.Background())
|
||||
assert.ErrorIs(t, err, errPreauthRetired)
|
||||
assert.Empty(t, *auths)
|
||||
}
|
||||
|
||||
// TestOpenRangeCheck checks that a download which doesn't return the
|
||||
// requested range is an error rather than wrong data.
|
||||
func TestOpenRangeCheck(t *testing.T) {
|
||||
content := []byte("0123456789abcdefghij")
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
handler http.HandlerFunc
|
||||
wantErr error
|
||||
}{
|
||||
{"ignored", func(w http.ResponseWriter, r *http.Request) {
|
||||
_, _ = w.Write(content)
|
||||
}, fs.ErrorRangeIgnored},
|
||||
{"wrong range", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Range", "bytes 0-4/20")
|
||||
w.WriteHeader(http.StatusPartialContent)
|
||||
_, _ = w.Write(content[:5])
|
||||
}, nil},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
o, _ := newDownloadTest(t, content, test.handler)
|
||||
_, err := o.Open(context.Background(), &fs.RangeOption{Start: 5, End: 9})
|
||||
require.Error(t, err)
|
||||
if test.wantErr != nil {
|
||||
assert.ErrorIs(t, err, test.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -126,6 +126,10 @@ func shouldRetry(ctx context.Context, resp *http.Response, err error) (bool, err
|
||||
if ociError.GetCode() == "RequestTimeout" {
|
||||
return true, err
|
||||
}
|
||||
// Parallel part uploads can collide on the same object
|
||||
if ociError.GetHTTPStatusCode() == http.StatusConflict && ociError.GetCode() == "ConcurrentObjectUpdate" {
|
||||
return true, err
|
||||
}
|
||||
}
|
||||
// Ok, not an oci error, check for generic failure conditions
|
||||
return fserrors.ShouldRetry(err) || fserrors.ShouldRetryHTTP(resp, retryErrorCodes), err
|
||||
|
||||
@@ -102,3 +102,34 @@ func TestGzipEncoding(t *testing.T) {
|
||||
assert.Equal(t, "", md5sum)
|
||||
})
|
||||
}
|
||||
|
||||
// serviceError is a minimal common.ServiceError for shouldRetry
|
||||
type serviceError struct {
|
||||
status int
|
||||
code string
|
||||
}
|
||||
|
||||
func (e serviceError) Error() string { return e.code }
|
||||
func (e serviceError) GetHTTPStatusCode() int { return e.status }
|
||||
func (e serviceError) GetMessage() string { return e.code }
|
||||
func (e serviceError) GetCode() string { return e.code }
|
||||
func (e serviceError) GetOpcRequestID() string { return "" }
|
||||
|
||||
func TestShouldRetryServiceError(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
for _, test := range []struct {
|
||||
status int
|
||||
code string
|
||||
want bool
|
||||
}{
|
||||
{http.StatusConflict, "ConcurrentObjectUpdate", true},
|
||||
{http.StatusConflict, "BucketAlreadyExists", false},
|
||||
{http.StatusRequestTimeout, "RequestTimeout", true},
|
||||
{http.StatusNotFound, "ObjectNotFound", false},
|
||||
} {
|
||||
err := serviceError{status: test.status, code: test.code}
|
||||
retry, gotErr := shouldRetry(ctx, nil, err)
|
||||
assert.Equal(t, test.want, retry, test.code)
|
||||
assert.Equal(t, error(err), gotErr)
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,73 @@
|
||||
name: HuaweiOBS
|
||||
description: Huawei Object Storage Service
|
||||
region:
|
||||
af-north-1: AF-Cairo
|
||||
af-south-1: AF-Johannesburg
|
||||
ap-southeast-1: CN-Hong Kong
|
||||
ap-southeast-2: AP-Bangkok
|
||||
ap-southeast-3: AP-Singapore
|
||||
cn-east-3: CN East-Shanghai1
|
||||
ap-southeast-4: AP-Jakarta
|
||||
ap-southeast-5: AP-Manila
|
||||
cn-east-2: CN East-Shanghai2
|
||||
cn-east-3: CN East-Shanghai1
|
||||
cn-east-4: CN East-Qingdao
|
||||
cn-east-5: CN East-Suzhou
|
||||
cn-north-1: CN North-Beijing1
|
||||
cn-north-2: CN North-Beijing2
|
||||
cn-north-4: CN North-Beijing4
|
||||
cn-north-9: CN North-Ulanqab
|
||||
cn-north-11: CN North-Hebei
|
||||
cn-north-12: CN North-Hohhot
|
||||
cn-south-1: CN South-Guangzhou
|
||||
ap-southeast-1: CN-Hong Kong
|
||||
sa-argentina-1: LA-Buenos Aires1
|
||||
sa-peru-1: LA-Lima1
|
||||
cn-south-2: CN South-Shenzhen
|
||||
cn-south-4: CN South-Guangzhou-InvitationOnly
|
||||
cn-southwest-2: CN Southwest-Guiyang1
|
||||
cn-southwest-3: CN Southwest-Chongqing
|
||||
eu-west-101: EU-Dublin
|
||||
la-north-2: LA-Mexico City2
|
||||
la-south-2: LA-Santiago
|
||||
me-east-1: ME-Riyadh
|
||||
na-mexico-1: LA-Mexico City1
|
||||
sa-chile-1: LA-Santiago2
|
||||
sa-brazil-1: LA-Sao Paulo1
|
||||
ru-northwest-2: RU-Moscow2
|
||||
sa-argentina-1: LA-Buenos Aires1
|
||||
sa-brazil-1: LA-Sao Paulo1
|
||||
sa-chile-1: LA-Santiago2
|
||||
sa-peru-1: LA-Lima1
|
||||
tr-west-1: TR-Istanbul
|
||||
endpoint:
|
||||
obs.af-north-1.myhuaweicloud.com: AF-Cairo
|
||||
obs.af-south-1.myhuaweicloud.com: AF-Johannesburg
|
||||
obs.ap-southeast-1.myhuaweicloud.com: CN-Hong Kong
|
||||
obs.ap-southeast-2.myhuaweicloud.com: AP-Bangkok
|
||||
obs.ap-southeast-3.myhuaweicloud.com: AP-Singapore
|
||||
obs.cn-east-3.myhuaweicloud.com: CN East-Shanghai1
|
||||
obs.ap-southeast-4.myhuaweicloud.com: AP-Jakarta
|
||||
obs.ap-southeast-5.myhuaweicloud.com: AP-Manila
|
||||
obs.cn-east-2.myhuaweicloud.com: CN East-Shanghai2
|
||||
obs.cn-east-3.myhuaweicloud.com: CN East-Shanghai1
|
||||
obs.cn-east-4.myhuaweicloud.com: CN East-Qingdao
|
||||
obs.cn-east-5.myhuaweicloud.com: CN East-Suzhou
|
||||
obs.cn-north-1.myhuaweicloud.com: CN North-Beijing1
|
||||
obs.cn-north-2.myhuaweicloud.com: CN North-Beijing2
|
||||
obs.cn-north-4.myhuaweicloud.com: CN North-Beijing4
|
||||
obs.cn-north-9.myhuaweicloud.com: CN North-Ulanqab
|
||||
obs.cn-north-11.myhuaweicloud.com: CN North-Hebei
|
||||
obs.cn-north-12.myhuaweicloud.com: CN North-Hohhot
|
||||
obs.cn-south-1.myhuaweicloud.com: CN South-Guangzhou
|
||||
obs.ap-southeast-1.myhuaweicloud.com: CN-Hong Kong
|
||||
obs.sa-argentina-1.myhuaweicloud.com: LA-Buenos Aires1
|
||||
obs.sa-peru-1.myhuaweicloud.com: LA-Lima1
|
||||
obs.cn-south-2.myhuaweicloud.com: CN South-Shenzhen
|
||||
obs.cn-south-4.myhuaweicloud.com: CN South-Guangzhou-InvitationOnly
|
||||
obs.cn-southwest-2.myhuaweicloud.com: CN Southwest-Guiyang1
|
||||
obs.cn-southwest-3.myhuaweicloud.com: CN Southwest-Chongqing
|
||||
obs.eu-west-101.myhuaweicloud.eu: EU-Dublin
|
||||
obs.la-north-2.myhuaweicloud.com: LA-Mexico City2
|
||||
obs.la-south-2.myhuaweicloud.com: LA-Santiago
|
||||
obs.me-east-1.myhuaweicloud.com: ME-Riyadh
|
||||
obs.na-mexico-1.myhuaweicloud.com: LA-Mexico City1
|
||||
obs.sa-chile-1.myhuaweicloud.com: LA-Santiago2
|
||||
obs.sa-brazil-1.myhuaweicloud.com: LA-Sao Paulo1
|
||||
obs.ru-northwest-2.myhuaweicloud.com: RU-Moscow2
|
||||
obs.sa-argentina-1.myhuaweicloud.com: LA-Buenos Aires1
|
||||
obs.sa-brazil-1.myhuaweicloud.com: LA-Sao Paulo1
|
||||
obs.sa-chile-1.myhuaweicloud.com: LA-Santiago2
|
||||
obs.sa-peru-1.myhuaweicloud.com: LA-Lima1
|
||||
obs.tr-west-1.myhuaweicloud.com: TR-Istanbul
|
||||
acl: {}
|
||||
bucket_acl: true
|
||||
quirks:
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Infomaniak
|
||||
description: Infomaniak Swiss Backup
|
||||
region:
|
||||
us-east-1: |-
|
||||
Default region for compatibility.
|
||||
All data is stored in Switzerland.
|
||||
endpoint:
|
||||
s3.swiss-backup01.infomaniak.com: Swiss Backup Location 01
|
||||
s3.swiss-backup02.infomaniak.com: Swiss Backup Location 02
|
||||
s3.swiss-backup03.infomaniak.com: Swiss Backup Location 03
|
||||
s3.swiss-backup04.infomaniak.com: Swiss Backup Location 04
|
||||
location_constraint: {}
|
||||
acl: {}
|
||||
bucket_acl: true
|
||||
quirks:
|
||||
force_path_style: true
|
||||
use_multipart_etag: false
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
name: Neon
|
||||
description: Neon Object Storage
|
||||
region:
|
||||
us-east-1: US East (N. Virginia)
|
||||
us-east-2: US East (Ohio)
|
||||
eu-central-1: Europe (Frankfurt)
|
||||
ap-southeast-1: Asia Pacific (Singapore)
|
||||
endpoint: {}
|
||||
quirks:
|
||||
force_path_style: true # virtual-hosted style requests are not supported
|
||||
object_lock_supported: false # object lock config is stored but enforcement is limited
|
||||
+9
-4
@@ -190,7 +190,7 @@ header is added and the default (private) will be used.
|
||||
Name: "sse_customer_key",
|
||||
Help: `To use SSE-C you may provide the secret encryption key used to encrypt/decrypt your data.
|
||||
|
||||
Alternatively you can provide --sse-customer-key-base64.`,
|
||||
Alternatively you can provide --s3-sse-customer-key-base64.`,
|
||||
Advanced: true,
|
||||
Examples: []fs.OptionExample{{
|
||||
Value: "",
|
||||
@@ -201,7 +201,7 @@ Alternatively you can provide --sse-customer-key-base64.`,
|
||||
Name: "sse_customer_key_base64",
|
||||
Help: `If using SSE-C you must provide the secret encryption key encoded in base64 format to encrypt/decrypt your data.
|
||||
|
||||
Alternatively you can provide --sse-customer-key.`,
|
||||
Alternatively you can provide --s3-sse-customer-key.`,
|
||||
Advanced: true,
|
||||
Examples: []fs.OptionExample{{
|
||||
Value: "",
|
||||
@@ -1446,10 +1446,15 @@ func fixupRequest(o *s3.Options, opt *Options) {
|
||||
)
|
||||
|
||||
o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
|
||||
if err := stack.Finalize.Insert(fixup, "Signing", middleware.Before); err != nil {
|
||||
// Presigning replaces the "Signing" middleware before APIOptions run
|
||||
signing := "Signing"
|
||||
if _, ok := stack.Finalize.Get(signing); !ok {
|
||||
signing = "PresignHTTPRequest"
|
||||
}
|
||||
if err := stack.Finalize.Insert(fixup, signing, middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := stack.Finalize.Insert(restore, "Signing", middleware.After); err != nil {
|
||||
if err := stack.Finalize.Insert(restore, signing, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -225,3 +225,31 @@ func TestPublicLink(t *testing.T) {
|
||||
_, err = f.PublicLink(context.Background(), "missing", fs.DurationOff, false)
|
||||
assert.ErrorIs(t, err, fs.ErrorObjectNotFound)
|
||||
}
|
||||
|
||||
func TestPublicLinkRequestFixups(t *testing.T) {
|
||||
for _, tt := range []struct {
|
||||
name string
|
||||
useXID bool
|
||||
signAcceptEncoding bool
|
||||
}{
|
||||
{"no x-id", false, true},
|
||||
{"unsigned Accept-Encoding", true, false},
|
||||
{"no x-id and unsigned Accept-Encoding", false, false},
|
||||
} {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
f := newLinkTestFs(t)
|
||||
f.opt.UseXID = fs.Tristate{Value: tt.useXID, Valid: true}
|
||||
f.opt.SignAcceptEncoding = fs.Tristate{Value: tt.signAcceptEncoding, Valid: true}
|
||||
c, _, err := s3Connection(f.ctx, &f.opt, getClient(f.ctx, &f.opt))
|
||||
require.NoError(t, err)
|
||||
f.c = c
|
||||
link, err := f.PublicLink(context.Background(), "file", fs.Duration(time.Hour), false)
|
||||
require.NoError(t, err)
|
||||
u, err := url.Parse(link)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, tt.useXID, u.Query().Has("x-id"))
|
||||
assert.Equal(t, "host", u.Query().Get("X-Amz-SignedHeaders"))
|
||||
assert.Equal(t, u.Query().Get("X-Amz-Signature"), linkSignature(t, u))
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -206,7 +206,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||
opt: *opt,
|
||||
endpoint: u,
|
||||
endpointURL: u.String(),
|
||||
srv: rest.NewClient(fshttp.NewClient(ctx)).SetRoot(u.String()),
|
||||
srv: rest.NewClient(newClient(ctx)).SetRoot(u.String()),
|
||||
pacer: getPacer(ctx, opt.URL),
|
||||
}
|
||||
f.features = (&fs.Features{
|
||||
@@ -370,10 +370,10 @@ func Config(ctx context.Context, name string, m configmap.Mapper, config fs.Conf
|
||||
|
||||
// Create rest client for getAuthorizationToken
|
||||
url := u.String()
|
||||
if !strings.HasPrefix(url, "/") {
|
||||
if !strings.HasSuffix(url, "/") {
|
||||
url += "/"
|
||||
}
|
||||
srv := rest.NewClient(fshttp.NewClient(ctx)).SetRoot(url)
|
||||
srv := rest.NewClient(newClient(ctx)).SetRoot(url)
|
||||
|
||||
// We loop asking for a 2FA code
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
@@ -401,6 +401,17 @@ func Config(ctx context.Context, name string, m configmap.Mapper, config fs.Conf
|
||||
return nil, fmt.Errorf("unknown state %q", config.State)
|
||||
}
|
||||
|
||||
// newClient returns the HTTP client used to talk to the Seafile API.
|
||||
//
|
||||
// It refuses redirects which downgrade HTTPS to plaintext HTTP as
|
||||
// following one would send the authorization token, or the password
|
||||
// during configuration, in cleartext.
|
||||
func newClient(ctx context.Context) *http.Client {
|
||||
client := fshttp.NewClient(ctx)
|
||||
client.CheckRedirect = rest.RefuseHTTPSDowngradeRedirectFn
|
||||
return client
|
||||
}
|
||||
|
||||
// Shutdown the Fs
|
||||
func (f *Fs) Shutdown(ctx context.Context) error {
|
||||
if f.renew == nil {
|
||||
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"path"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -289,3 +291,106 @@ func TestUploadErrorReleasesSource(t *testing.T) {
|
||||
t.Fatal("source still in use after upload returned")
|
||||
}
|
||||
}
|
||||
|
||||
// testPassword is the password the downgrade tests look for on the
|
||||
// plaintext hop. It is distinctive so that it can't match the JSON
|
||||
// field names of the authentication request.
|
||||
const testPassword = "s3cret-pass-4242"
|
||||
|
||||
// Test2FAGetToken checks the 2FA config flow posts the credentials to
|
||||
// the auth token endpoint without doubling the slash when the
|
||||
// configured URL ends in one, and saves the token it gets back.
|
||||
func Test2FAGetToken(t *testing.T) {
|
||||
var gotPath string
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
gotPath = r.URL.Path
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = w.Write([]byte(`{"token":"token123"}`))
|
||||
}))
|
||||
defer srv.Close()
|
||||
|
||||
m := configmap.Simple{"url": srv.URL + "/", "2fa": "true", "user": "username", "pass": obscure.MustObscure(testPassword)}
|
||||
out, err := Config(context.Background(), "test", m, fs.ConfigIn{State: "2fa_do", Result: "123456"})
|
||||
require.NoError(t, err)
|
||||
assert.Nil(t, out)
|
||||
assert.Equal(t, "/api2/auth-token/", gotPath)
|
||||
assert.Equal(t, "token123", m["auth_token"])
|
||||
assert.Equal(t, "", m["pass"])
|
||||
}
|
||||
|
||||
// newDowngradeServers returns an HTTPS server which answers the server
|
||||
// info request itself and redirects every other request to a plaintext
|
||||
// HTTP server on the same machine. The returned flags record whether
|
||||
// the plaintext server ever received an Authorization header or
|
||||
// testPassword in a request body.
|
||||
func newDowngradeServers(t *testing.T) (tlsSrv *httptest.Server, sawAuth, sawPassword *atomic.Bool) {
|
||||
t.Helper()
|
||||
sawAuth, sawPassword = new(atomic.Bool), new(atomic.Bool)
|
||||
|
||||
plain := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Header.Get("Authorization") != "" {
|
||||
sawAuth.Store(true)
|
||||
}
|
||||
body, _ := io.ReadAll(r.Body)
|
||||
if strings.Contains(string(body), testPassword) {
|
||||
sawPassword.Store(true)
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = w.Write([]byte("[]"))
|
||||
}))
|
||||
t.Cleanup(plain.Close)
|
||||
|
||||
tlsSrv = httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/api2/server-info/" {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = w.Write([]byte(`{"version":"9.0.0"}`))
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, plain.URL+r.URL.Path, http.StatusTemporaryRedirect)
|
||||
}))
|
||||
t.Cleanup(tlsSrv.Close)
|
||||
|
||||
return tlsSrv, sawAuth, sawPassword
|
||||
}
|
||||
|
||||
// TestRefuseHTTPSDowngradeRedirect checks that neither the
|
||||
// authorization token nor the password is sent over plaintext HTTP
|
||||
// when the server redirects an HTTPS request to an http:// URL.
|
||||
func TestRefuseHTTPSDowngradeRedirect(t *testing.T) {
|
||||
ctx, ci := fs.AddConfig(context.Background())
|
||||
ci.InsecureSkipVerify = true // trust the httptest certificate
|
||||
|
||||
// Every API call made through the Fs carries the token.
|
||||
t.Run("Token", func(t *testing.T) {
|
||||
tlsSrv, sawAuth, _ := newDowngradeServers(t)
|
||||
m := configmap.Simple{"url": tlsSrv.URL, "user": "username", "auth_token": "secret"}
|
||||
fsys, err := NewFs(ctx, "test", "", m)
|
||||
require.NoError(t, err)
|
||||
f := fsys.(*Fs)
|
||||
_, err = f.getLibraries(ctx)
|
||||
assert.False(t, sawAuth.Load(), "authorization token was sent over plaintext HTTP")
|
||||
assert.ErrorIs(t, err, rest.ErrHTTPSDowngrade)
|
||||
})
|
||||
|
||||
// Without a token NewFs posts the user's password to get one.
|
||||
t.Run("Login", func(t *testing.T) {
|
||||
tlsSrv, _, sawPassword := newDowngradeServers(t)
|
||||
m := configmap.Simple{"url": tlsSrv.URL, "user": "username", "pass": obscure.MustObscure(testPassword)}
|
||||
_, err := NewFs(ctx, "test", "", m)
|
||||
assert.False(t, sawPassword.Load(), "password was sent over plaintext HTTP")
|
||||
assert.ErrorIs(t, err, rest.ErrHTTPSDowngrade)
|
||||
})
|
||||
|
||||
// The 2FA config flow posts the user's password to get a token.
|
||||
t.Run("Password", func(t *testing.T) {
|
||||
tlsSrv, _, sawPassword := newDowngradeServers(t)
|
||||
m := configmap.Simple{"url": tlsSrv.URL, "2fa": "true", "user": "username", "pass": obscure.MustObscure(testPassword)}
|
||||
out, err := Config(ctx, "test", m, fs.ConfigIn{State: "2fa_do", Result: "123456"})
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, out)
|
||||
assert.False(t, sawPassword.Load(), "password was sent over plaintext HTTP")
|
||||
assert.Equal(t, "2fa_error", out.State)
|
||||
require.NotNil(t, out.Option)
|
||||
assert.Contains(t, out.Option.Help, rest.ErrHTTPSDowngrade.Error())
|
||||
})
|
||||
}
|
||||
+99
-1
@@ -9,6 +9,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
"net/http"
|
||||
"path"
|
||||
"regexp"
|
||||
"slices"
|
||||
@@ -33,6 +34,7 @@ import (
|
||||
"github.com/rclone/rclone/lib/pacer"
|
||||
"github.com/rclone/rclone/lib/random"
|
||||
"github.com/rclone/rclone/lib/readers"
|
||||
"github.com/rclone/rclone/lib/rest"
|
||||
)
|
||||
|
||||
// Constants
|
||||
@@ -193,6 +195,18 @@ func init() {
|
||||
}, {
|
||||
Value: "https://authenticate.ain.net",
|
||||
Help: "Blomp Cloud Storage",
|
||||
}, {
|
||||
Value: "https://swiss-backup01.infomaniak.com/identity/v3",
|
||||
Help: "Infomaniak Swiss Backup Location 01",
|
||||
}, {
|
||||
Value: "https://swiss-backup02.infomaniak.com/identity/v3",
|
||||
Help: "Infomaniak Swiss Backup Location 02",
|
||||
}, {
|
||||
Value: "https://swiss-backup03.infomaniak.com/identity/v3",
|
||||
Help: "Infomaniak Swiss Backup Location 03",
|
||||
}, {
|
||||
Value: "https://swiss-backup04.infomaniak.com/identity/v3",
|
||||
Help: "Infomaniak Swiss Backup Location 04",
|
||||
}},
|
||||
}, {
|
||||
Name: "user_id",
|
||||
@@ -470,6 +484,90 @@ func (o *Object) split() (container, containerPath string) {
|
||||
return o.fs.split(o.remote)
|
||||
}
|
||||
|
||||
// authHeaders are the request headers which carry the Swift
|
||||
// credentials: the token sent on every storage request and the user
|
||||
// name and API key sent on a v1 auth request. They must not be
|
||||
// forwarded when a redirect leaves the host of the original request.
|
||||
var authHeaders = []string{"X-Auth-Token", "X-Auth-Key", "X-Auth-User"}
|
||||
|
||||
// errRedirectResendsBody is returned when following a redirect which
|
||||
// leaves the host of the original request would resend that request's
|
||||
// body, such as the password in a v2 or v3 auth request, to the new
|
||||
// host.
|
||||
var errRedirectResendsBody = errors.New("refusing to follow redirect which leaves the original host: would resend the request body")
|
||||
|
||||
// transport is the http.RoundTripper for the swift connection.
|
||||
//
|
||||
// The swift library makes its own http.Client with the default
|
||||
// redirect policy and does not let the caller replace it, so the
|
||||
// redirect policy is applied here at the transport level instead. A
|
||||
// redirect which downgrades HTTPS to plaintext HTTP is refused with
|
||||
// rest.ErrHTTPSDowngrade. Once the redirect chain has left the host
|
||||
// and port of the original request the auth headers are removed from
|
||||
// every further hop, and a hop which would resend the request body is
|
||||
// refused with errRedirectResendsBody.
|
||||
type transport struct {
|
||||
*fshttp.Transport
|
||||
}
|
||||
|
||||
// newTransport returns the transport for the swift connection
|
||||
func newTransport(ctx context.Context) *transport {
|
||||
return &transport{Transport: fshttp.NewTransport(ctx)}
|
||||
}
|
||||
|
||||
// RoundTrip implements http.RoundTripper
|
||||
func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
// net/http fills in req.Response on the requests it makes to
|
||||
// follow a redirect, so a request without one is not a redirect.
|
||||
if req.Response != nil {
|
||||
origin, leftHost := redirectOrigin(req)
|
||||
if origin.URL.Scheme == "https" && req.URL.Scheme == "http" {
|
||||
if req.Body != nil {
|
||||
_ = req.Body.Close()
|
||||
}
|
||||
return nil, fmt.Errorf("redirect to %s: %w", req.URL.Redacted(), rest.ErrHTTPSDowngrade)
|
||||
}
|
||||
if leftHost {
|
||||
// net/http resends the body on a 307 or 308 if it
|
||||
// can be rewound, which for an auth request means
|
||||
// the password, so those redirects stop here.
|
||||
if req.Body != nil && req.Body != http.NoBody {
|
||||
_ = req.Body.Close()
|
||||
return nil, fmt.Errorf("redirect to %s leaves %s: %w", req.URL.Redacted(), origin.URL.Redacted(), errRedirectResendsBody)
|
||||
}
|
||||
for _, header := range authHeaders {
|
||||
if req.Header.Get(header) == "" {
|
||||
continue
|
||||
}
|
||||
fs.Debugf(nil, "redirect to %s leaves %s: not sending %s", req.URL.Redacted(), origin.URL.Redacted(), header)
|
||||
req.Header.Del(header)
|
||||
}
|
||||
}
|
||||
}
|
||||
return t.Transport.RoundTrip(req)
|
||||
}
|
||||
|
||||
// redirectOrigin walks back along the chain of redirects which led to
|
||||
// req and returns the original request and whether any hop, including
|
||||
// req, was to a different host or port from it.
|
||||
//
|
||||
// net/http copies the headers afresh from the original request for
|
||||
// every hop, so once the chain has visited another host the headers
|
||||
// must be stripped from every subsequent hop, even one back to the
|
||||
// original host, as the other host chose the URL.
|
||||
func redirectOrigin(req *http.Request) (origin *http.Request, leftHost bool) {
|
||||
origin = req
|
||||
for origin.Response != nil && origin.Response.Request != nil {
|
||||
origin = origin.Response.Request
|
||||
}
|
||||
for hop := req; hop != origin; hop = hop.Response.Request {
|
||||
if !rest.SameHost(hop.URL, origin.URL) {
|
||||
leftHost = true
|
||||
}
|
||||
}
|
||||
return origin, leftHost
|
||||
}
|
||||
|
||||
// swiftConnection makes a connection to swift
|
||||
func swiftConnection(ctx context.Context, opt *Options, name string) (*swift.Connection, error) {
|
||||
ci := fs.GetConfig(ctx)
|
||||
@@ -493,7 +591,7 @@ func swiftConnection(ctx context.Context, opt *Options, name string) (*swift.Con
|
||||
EndpointType: swift.EndpointType(opt.EndpointType),
|
||||
ConnectTimeout: time.Duration(10 * ci.ConnectTimeout), // Use the timeouts in the transport
|
||||
Timeout: time.Duration(10 * ci.Timeout), // Use the timeouts in the transport
|
||||
Transport: fshttp.NewTransport(ctx),
|
||||
Transport: newTransport(ctx),
|
||||
FetchUntilEmptyPage: opt.FetchUntilEmptyPage,
|
||||
PartialPageFetchThreshold: opt.PartialPageFetchThreshold,
|
||||
}
|
||||
|
||||
@@ -2,12 +2,22 @@ package swift
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ncw/swift/v2"
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/config/configmap"
|
||||
"github.com/rclone/rclone/fs/fserrors"
|
||||
"github.com/rclone/rclone/fs/fshttp"
|
||||
"github.com/rclone/rclone/lib/rest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestInternalUrlEncode(t *testing.T) {
|
||||
@@ -66,3 +76,201 @@ func TestInternalShouldRetryHeaders(t *testing.T) {
|
||||
assert.True(t, dt >= time.Hour-time.Second && dt <= time.Hour+time.Second)
|
||||
|
||||
}
|
||||
|
||||
// testToken is the auth token the redirect tests look for. It is
|
||||
// distinctive so that it can't match anything else in a request.
|
||||
const testToken = "AUTH_tk_secret_4242"
|
||||
|
||||
// authTestHeaders is a deliberately literal copy of authHeaders so
|
||||
// that a header dropped from the production list shows up as a leak
|
||||
// in the cross host tests rather than silently losing coverage.
|
||||
var authTestHeaders = []string{"X-Auth-Token", "X-Auth-Key", "X-Auth-User"}
|
||||
|
||||
// listHandler answers any request with an empty JSON listing.
|
||||
func listHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = w.Write([]byte("[]"))
|
||||
}
|
||||
|
||||
// newTestFs makes an Fs via NewFs for a container on storageURL,
|
||||
// using a pre-issued token so that no auth request is made.
|
||||
func newTestFs(ctx context.Context, t *testing.T, storageURL string) *Fs {
|
||||
m := configmap.Simple{
|
||||
"storage_url": storageURL + "/v1/AUTH_test",
|
||||
"auth_token": testToken,
|
||||
"chunk_size": "5Gi",
|
||||
}
|
||||
f, err := NewFs(ctx, "swift-test", "container", m)
|
||||
require.NoError(t, err)
|
||||
return f.(*Fs)
|
||||
}
|
||||
|
||||
// assertAuthHeaders checks that every auth header is absent from r
|
||||
// (!want) or that the ones named in present are there (want).
|
||||
func assertAuthHeaders(t *testing.T, r *http.Request, want bool, present ...string) {
|
||||
if want {
|
||||
for _, header := range present {
|
||||
assert.NotEmpty(t, r.Header.Get(header), "%s should be sent", header)
|
||||
}
|
||||
return
|
||||
}
|
||||
for _, header := range authTestHeaders {
|
||||
assert.Empty(t, r.Header.Get(header), "%s should have been stripped", header)
|
||||
}
|
||||
}
|
||||
|
||||
// TestRedirectStripsAuthTokenOnCrossHost checks the token is sent to
|
||||
// the storage host but not to another host it redirects to, nor to
|
||||
// the storage host again once the chain has been elsewhere.
|
||||
func TestRedirectStripsAuthTokenOnCrossHost(t *testing.T) {
|
||||
var originHits, otherHits, backHits atomic.Int32
|
||||
var origin *httptest.Server
|
||||
other := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
otherHits.Add(1)
|
||||
assertAuthHeaders(t, r, false)
|
||||
http.Redirect(w, r, origin.URL+"/back", http.StatusFound)
|
||||
}))
|
||||
defer other.Close()
|
||||
|
||||
origin = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/back" {
|
||||
backHits.Add(1)
|
||||
assertAuthHeaders(t, r, false)
|
||||
listHandler(w, r)
|
||||
return
|
||||
}
|
||||
originHits.Add(1)
|
||||
assertAuthHeaders(t, r, true, "X-Auth-Token")
|
||||
http.Redirect(w, r, other.URL+r.URL.Path, http.StatusFound)
|
||||
}))
|
||||
defer origin.Close()
|
||||
|
||||
ctx := context.Background()
|
||||
f := newTestFs(ctx, t, origin.URL)
|
||||
_, err := f.List(ctx, "")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, int32(1), originHits.Load())
|
||||
assert.Equal(t, int32(1), otherHits.Load())
|
||||
assert.Equal(t, int32(1), backHits.Load())
|
||||
}
|
||||
|
||||
// TestRedirectKeepsAuthTokenOnSameHost checks the token is still sent
|
||||
// after a redirect which stays on the storage host.
|
||||
func TestRedirectKeepsAuthTokenOnSameHost(t *testing.T) {
|
||||
var hits atomic.Int32
|
||||
origin := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
hits.Add(1)
|
||||
assertAuthHeaders(t, r, true, "X-Auth-Token")
|
||||
if !strings.HasSuffix(r.URL.Path, "/moved") {
|
||||
http.Redirect(w, r, r.URL.Path+"/moved", http.StatusTemporaryRedirect)
|
||||
return
|
||||
}
|
||||
listHandler(w, r)
|
||||
}))
|
||||
defer origin.Close()
|
||||
|
||||
ctx := context.Background()
|
||||
f := newTestFs(ctx, t, origin.URL)
|
||||
_, err := f.List(ctx, "")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, int32(2), hits.Load())
|
||||
}
|
||||
|
||||
// TestRedirectRefusesHTTPSDowngrade checks a redirect from HTTPS to
|
||||
// plaintext HTTP is not followed, so the token never goes over the
|
||||
// network in the clear.
|
||||
func TestRedirectRefusesHTTPSDowngrade(t *testing.T) {
|
||||
var targetHits atomic.Int32
|
||||
target := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
targetHits.Add(1)
|
||||
listHandler(w, r)
|
||||
}))
|
||||
defer target.Close()
|
||||
|
||||
origin := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, target.URL+r.URL.Path, http.StatusTemporaryRedirect)
|
||||
}))
|
||||
defer origin.Close()
|
||||
|
||||
// The transport is a process wide singleton so it has to be
|
||||
// rebuilt to trust the httptest certificate, and rebuilt again
|
||||
// afterwards so later tests don't inherit that.
|
||||
fshttp.ResetTransport()
|
||||
t.Cleanup(fshttp.ResetTransport)
|
||||
ctx, ci := fs.AddConfig(context.Background())
|
||||
ci.InsecureSkipVerify = true
|
||||
f := newTestFs(ctx, t, origin.URL)
|
||||
_, err := f.List(ctx, "")
|
||||
require.ErrorIs(t, err, rest.ErrHTTPSDowngrade)
|
||||
assert.Equal(t, int32(0), targetHits.Load())
|
||||
}
|
||||
|
||||
// TestAuthRedirectStripsCredentialsOnCrossHost checks the user name
|
||||
// and API key sent on a v1 auth request go to the auth host but not
|
||||
// to another host it redirects to.
|
||||
func TestAuthRedirectStripsCredentialsOnCrossHost(t *testing.T) {
|
||||
var originHits, otherHits atomic.Int32
|
||||
other := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
otherHits.Add(1)
|
||||
assertAuthHeaders(t, r, false)
|
||||
w.Header().Set("X-Storage-Url", "http://"+r.Host+"/v1/AUTH_test")
|
||||
w.Header().Set("X-Auth-Token", testToken)
|
||||
}))
|
||||
defer other.Close()
|
||||
|
||||
origin := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
originHits.Add(1)
|
||||
assertAuthHeaders(t, r, true, "X-Auth-Key", "X-Auth-User")
|
||||
http.Redirect(w, r, other.URL+r.URL.Path, http.StatusFound)
|
||||
}))
|
||||
defer origin.Close()
|
||||
|
||||
m := configmap.Simple{
|
||||
"auth": origin.URL + "/v1.0",
|
||||
"auth_version": "1",
|
||||
"user": "test-user",
|
||||
"key": "test-key",
|
||||
"chunk_size": "5Gi",
|
||||
}
|
||||
_, err := NewFs(context.Background(), "swift-test", "container", m)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, int32(1), originHits.Load())
|
||||
assert.Equal(t, int32(1), otherHits.Load())
|
||||
}
|
||||
|
||||
// TestAuthRedirectRefusesToResendPassword checks a v2 or v3 auth
|
||||
// request, which carries the password in its body, is not resent to
|
||||
// another host the auth server redirects it to.
|
||||
func TestAuthRedirectRefusesToResendPassword(t *testing.T) {
|
||||
for _, authVersion := range []string{"2", "3"} {
|
||||
t.Run("v"+authVersion, func(t *testing.T) {
|
||||
var originHits, otherHits atomic.Int32
|
||||
other := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
otherHits.Add(1)
|
||||
body, _ := io.ReadAll(r.Body)
|
||||
assert.NotContains(t, string(body), "test-key", "password was resent to another host")
|
||||
}))
|
||||
defer other.Close()
|
||||
|
||||
origin := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
originHits.Add(1)
|
||||
body, _ := io.ReadAll(r.Body)
|
||||
assert.Contains(t, string(body), "test-key")
|
||||
http.Redirect(w, r, other.URL+r.URL.Path, http.StatusTemporaryRedirect)
|
||||
}))
|
||||
defer origin.Close()
|
||||
|
||||
m := configmap.Simple{
|
||||
"auth": origin.URL + "/v" + authVersion,
|
||||
"auth_version": authVersion,
|
||||
"user": "test-user",
|
||||
"key": "test-key",
|
||||
"chunk_size": "5Gi",
|
||||
}
|
||||
_, err := NewFs(context.Background(), "swift-test", "container", m)
|
||||
require.ErrorIs(t, err, errRedirectResendsBody)
|
||||
assert.Equal(t, int32(1), originHits.Load())
|
||||
assert.Equal(t, int32(0), otherHits.Load())
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -113,6 +113,22 @@ type Fs struct {
|
||||
pacer *fs.Pacer // pacer for API calls
|
||||
}
|
||||
|
||||
// authHeaders are the request headers carrying the app and session
|
||||
// tokens which must not be forwarded when a redirect leaves the
|
||||
// original host.
|
||||
var authHeaders = []string{"X-Auth-Token", "X-User-Token"}
|
||||
|
||||
// newClient makes the http client used for all uloz.to requests.
|
||||
//
|
||||
// Downloads carry the auth headers to whatever URL the API hands out,
|
||||
// so the client strips them on cross host redirects and refuses an
|
||||
// HTTPS to HTTP downgrade.
|
||||
func newClient(ctx context.Context) *http.Client {
|
||||
client := fshttp.NewClient(ctx)
|
||||
client.CheckRedirect = rest.StripHeadersOnCrossHostRedirectFn(authHeaders...)
|
||||
return client
|
||||
}
|
||||
|
||||
// NewFs constructs a Fs from the path, container:path
|
||||
func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error) {
|
||||
// Parse config into Options struct
|
||||
@@ -125,7 +141,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||
// Strip leading and trailing slashes, see https://github.com/rclone/rclone/issues/7796 for details.
|
||||
root = strings.Trim(root, "/")
|
||||
|
||||
client := fshttp.NewClient(ctx)
|
||||
client := newClient(ctx)
|
||||
|
||||
f := &Fs{
|
||||
name: name,
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package ulozto
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
"github.com/rclone/rclone/backend/ulozto/api"
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/lib/pacer"
|
||||
"github.com/rclone/rclone/lib/rest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// authTestHeaders is a deliberately literal copy of authHeaders so
|
||||
// that a header dropped from the production list fails
|
||||
// TestAuthHeaders rather than silently losing test coverage.
|
||||
var authTestHeaders = map[string]string{
|
||||
"X-Auth-Token": "secret-app-token",
|
||||
"X-User-Token": "secret-user-token",
|
||||
}
|
||||
|
||||
func TestAuthHeaders(t *testing.T) {
|
||||
assert.ElementsMatch(t, []string{"X-Auth-Token", "X-User-Token"}, authHeaders)
|
||||
}
|
||||
|
||||
// newTestFs makes an Fs talking to apiURL with the auth headers set,
|
||||
// without going through NewFs which would authenticate.
|
||||
func newTestFs(ctx context.Context, apiURL string) *Fs {
|
||||
client := newClient(ctx)
|
||||
f := &Fs{
|
||||
name: "ulozto-test",
|
||||
cdn: rest.NewClient(client),
|
||||
rest: rest.NewClient(client).SetRoot(apiURL),
|
||||
pacer: fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant))),
|
||||
}
|
||||
f.rest.SetErrorHandler(errorHandler)
|
||||
for header, value := range authTestHeaders {
|
||||
f.rest.SetHeader(header, value)
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
// TestOpenStripsAuthHeadersOnCrossHostRedirect checks that a download
|
||||
// sends the auth headers to the host the API named but not to a host
|
||||
// that download redirects to.
|
||||
func TestOpenStripsAuthHeadersOnCrossHostRedirect(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
var otherHits atomic.Int32
|
||||
other := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
otherHits.Add(1)
|
||||
for header := range authTestHeaders {
|
||||
assert.Empty(t, r.Header.Get(header), "%s should have been stripped", header)
|
||||
}
|
||||
_, _ = w.Write([]byte("payload"))
|
||||
}))
|
||||
defer other.Close()
|
||||
|
||||
var cdnHits atomic.Int32
|
||||
cdn := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
cdnHits.Add(1)
|
||||
assert.Equal(t, "/file?hash=h", r.URL.RequestURI())
|
||||
for header, value := range authTestHeaders {
|
||||
assert.Equal(t, value, r.Header.Get(header), "%s should be sent to the download host", header)
|
||||
}
|
||||
http.Redirect(w, r, other.URL+"/payload", http.StatusTemporaryRedirect)
|
||||
}))
|
||||
defer cdn.Close()
|
||||
|
||||
apiServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
assert.Equal(t, "/v5/file/download-link/vipdata", r.URL.Path)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
require.NoError(t, json.NewEncoder(w).Encode(api.GetDownloadLinkResponse{
|
||||
Link: cdn.URL + "/file",
|
||||
Hash: "h",
|
||||
}))
|
||||
}))
|
||||
defer apiServer.Close()
|
||||
|
||||
o := &Object{fs: newTestFs(ctx, apiServer.URL), slug: "slug"}
|
||||
rc, err := o.Open(ctx)
|
||||
require.NoError(t, err)
|
||||
body, err := io.ReadAll(rc)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, rc.Close())
|
||||
assert.Equal(t, "payload", string(body))
|
||||
assert.Equal(t, int32(1), cdnHits.Load())
|
||||
assert.Equal(t, int32(1), otherHits.Load())
|
||||
}
|
||||
@@ -5,6 +5,8 @@ This takes the following parameters:
|
||||
- path1 (required) - (string) a remote directory string e.g. `drive:path1`
|
||||
- path2 (required) - (string) a remote directory string e.g. `drive:path2`
|
||||
- dryRun - (bool) dry-run mode
|
||||
- maxDelete - (int) Safety check on maximum percentage of deleted files
|
||||
allowed. If exceeded, the bisync run will abort. (default: 50%)
|
||||
- backupDir1 - (string) --backup-dir for Path1. Must be a non-overlapping path on
|
||||
the same remote.
|
||||
- backupDir2 - (string) --backup-dir for Path2. Must be a non-overlapping path on
|
||||
@@ -34,6 +36,8 @@ unavailable. (warning: may be slow and use lots of data!)
|
||||
using with --verbose
|
||||
- ignoreListingChecksum - (bool) Do not use checksums for listings (add --ignore-
|
||||
checksum to additionally skip post-copy checksum checks)
|
||||
- maxDeleteRenamesAware - (bool) Exclude tracked renames from the --max-delete
|
||||
safety check (requires --track-renames)
|
||||
- maxLock - (Duration) Consider lock files older than this to be expired
|
||||
(default: 0 (never expire)) (minimum: 2m)
|
||||
- noCleanup - (bool) Retain working files (useful for troubleshooting and
|
||||
|
||||
@@ -37,10 +37,6 @@ If you supply the |--download| flag, it will download the data from the remote
|
||||
and calculate the content hash on the fly. This can be useful for remotes
|
||||
that don't support hashes or if you really want to check all the data.
|
||||
|
||||
The SUM file can be in the format of the standard md5sum/sha1sum tools.
|
||||
Lines starting with |#| or |;| are ignored. The file may be UTF-8, or
|
||||
UTF-16 with a byte order mark.
|
||||
|
||||
Note that hash values in the SUM file are treated as case insensitive.
|
||||
`, "|", "`") + check.FlagsHelp,
|
||||
Annotations: map[string]string{
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1.1.13
|
||||
1.2.1
|
||||
Binary file not shown.
@@ -307,6 +307,10 @@ func (cds *contentDirectoryService) Handle(action string, argsXML []byte, r *htt
|
||||
if err := xml.Unmarshal(argsXML, &browse); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// StartingIndex and RequestedCount are ui4 in the SCPD
|
||||
if browse.StartingIndex < 0 || browse.RequestedCount < 0 {
|
||||
return nil, upnp.Errorf(upnp.ArgumentValueInvalidErrorCode, "negative StartingIndex %d or RequestedCount %d", browse.StartingIndex, browse.RequestedCount)
|
||||
}
|
||||
// Samsung TVs sometimes send empty ObjectID, default to root container
|
||||
if browse.ObjectID == "" {
|
||||
browse.ObjectID = "0"
|
||||
|
||||
@@ -197,6 +197,45 @@ func TestContentDirectoryBrowseResponseOrder(t *testing.T) {
|
||||
assert.Less(t, totalMatchesIdx, updateIDIdx, "TotalMatches should come before UpdateID")
|
||||
}
|
||||
|
||||
// Check that a Browse with a negative StartingIndex or RequestedCount is
|
||||
// rejected with a UPnP error rather than crashing the handler.
|
||||
func TestContentDirectoryBrowseNegativeIndex(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
startingIndex string
|
||||
requestedCount string
|
||||
}{
|
||||
{"-1", "0"},
|
||||
{"0", "-1"},
|
||||
} {
|
||||
t.Run(test.startingIndex+","+test.requestedCount, func(t *testing.T) {
|
||||
req, err := http.NewRequest("POST", baseURL+serviceControlURL, strings.NewReader(`
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<s:Body>
|
||||
<u:Browse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1">
|
||||
<ObjectID>0</ObjectID>
|
||||
<BrowseFlag>BrowseDirectChildren</BrowseFlag>
|
||||
<Filter>*</Filter>
|
||||
<StartingIndex>`+test.startingIndex+`</StartingIndex>
|
||||
<RequestedCount>`+test.requestedCount+`</RequestedCount>
|
||||
<SortCriteria></SortCriteria>
|
||||
</u:Browse>
|
||||
</s:Body>
|
||||
</s:Envelope>`))
|
||||
require.NoError(t, err)
|
||||
req.Header.Set("SOAPACTION", `"urn:schemas-upnp-org:service:ContentDirectory:1#Browse"`)
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
require.NoError(t, err)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, resp.Body.Close())
|
||||
assert.Equal(t, http.StatusInternalServerError, resp.StatusCode)
|
||||
assert.Contains(t, string(body), "<errorCode>600</errorCode>")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Check that the X_MS_MediaReceiverRegistrar is faked out properly.
|
||||
func TestMediaReceiverRegistrarService(t *testing.T) {
|
||||
env := soap.Envelope{
|
||||
|
||||
+59
-32
@@ -143,12 +143,20 @@ to make proxy to many different sftp backends, you could make the
|
||||
in the output and the user to |user|. For security you'd probably want
|
||||
to restrict the |host| to a limited list.
|
||||
|
||||
An internal cache of backends is keyed on the |user|, a hash of the
|
||||
|pass| or |public_key|, and the |client_ip|. This means that if a
|
||||
user's password or public-key changes, the client connects from a new IP
|
||||
address, or the proxy returns different config parameters (eg a rotated
|
||||
|api_key|), a fresh backend will be created on the next request rather
|
||||
than the cached one being reused.
|
||||
An internal cache of backends is keyed on the |user|, the kind of
|
||||
credential presented, a hash of the |pass| or |public_key|, and the
|
||||
|client_ip|. This means that if a user's password or public-key
|
||||
changes, the client connects from a new IP address, or the proxy
|
||||
returns different config parameters (eg a rotated |api_key|), a fresh
|
||||
backend will be created on the next request rather than the cached one
|
||||
being reused. A backend created for a public key login is never
|
||||
reused for a password login, so a public key cannot be sent as a
|
||||
password to skip the program.
|
||||
|
||||
A cached answer is checked with the program again after 5 minutes even
|
||||
if the user is in constant use, so revoking a user in the program
|
||||
takes effect within 5 minutes. For |serve sftp| this applies to new
|
||||
logins - an existing connection is not closed.
|
||||
|
||||
This can be used to build general purpose proxies to any kind of
|
||||
backend that rclone supports.
|
||||
@@ -188,6 +196,7 @@ type Proxy struct {
|
||||
// cacheEntry is what is stored in the vfsCache
|
||||
type cacheEntry struct {
|
||||
vfs *vfs.VFS // stored VFS
|
||||
kind authKind // kind of credential the entry was created for
|
||||
pwHash [sha256.Size]byte // sha256 hash of the password/publicKey
|
||||
secret string // secret access key returned by the proxy for access key auth
|
||||
refreshed *atomic.Int64 // unix nanoseconds when the proxy last confirmed this entry
|
||||
@@ -201,14 +210,13 @@ type cacheEntry struct {
|
||||
// A variable so tests can adjust it.
|
||||
var accessKeyRefreshInterval = 10 * time.Second
|
||||
|
||||
// accessKeyRevalidateInterval is how long a cached access key ID is
|
||||
// trusted before the proxy is asked about it again even though its
|
||||
// signatures are still verifying, so a revoked access key ID stops
|
||||
// working within this time rather than for as long as it stays in
|
||||
// use.
|
||||
// revalidateInterval is how long a cached answer from the proxy is
|
||||
// trusted before the proxy is asked again even though the credential
|
||||
// is still in use, so a revoked user or access key ID stops working
|
||||
// within this time rather than for as long as it stays in use.
|
||||
//
|
||||
// A variable so tests can adjust it.
|
||||
var accessKeyRevalidateInterval = 5 * time.Minute
|
||||
var revalidateInterval = 5 * time.Minute
|
||||
|
||||
// authKind is the kind of credential the client presented
|
||||
type authKind int
|
||||
@@ -308,9 +316,14 @@ func ipFromAddr(addr string) string {
|
||||
}
|
||||
|
||||
// generateCacheKey creates a composite cache key from the user, the auth
|
||||
// credentials and the client's IP address.
|
||||
func generateCacheKey(user, auth, clientIP string) string {
|
||||
// credentials, the kind of credential and the client's IP address.
|
||||
//
|
||||
// The kind is part of the key so that a public key, which is not a
|
||||
// secret, presented as a password can't hit the entry created when its
|
||||
// owner logged in with it.
|
||||
func generateCacheKey(user, auth string, kind authKind, clientIP string) string {
|
||||
mac := hmac.New(sha256.New, cacheKeyHMACKey)
|
||||
mac.Write([]byte{byte(kind)})
|
||||
mac.Write([]byte(auth))
|
||||
// Separate the two so ("ab", "c") can't collide with ("a", "bc")
|
||||
mac.Write([]byte{0})
|
||||
@@ -370,7 +383,7 @@ func (p *Proxy) call(user, auth string, kind authKind, clientIP string) (value a
|
||||
// Make the cache key include the auth and the client IP so that
|
||||
// changes to either (eg the proxy returning new config) create a
|
||||
// fresh backend rather than reusing the cached one.
|
||||
cacheKey := generateCacheKey(user, auth, clientIP)
|
||||
cacheKey := generateCacheKey(user, auth, kind, clientIP)
|
||||
|
||||
// For access key auth the secret isn't part of the cache key as
|
||||
// it isn't known until the proxy has been run, so retire any
|
||||
@@ -389,7 +402,7 @@ func (p *Proxy) call(user, auth string, kind authKind, clientIP string) (value a
|
||||
defer p.accessKeyMu.Unlock()
|
||||
if old, ok := p.vfsCache.GetMaybe(cacheKey); ok {
|
||||
if entry, ok := old.(cacheEntry); ok && entry.secret != secret {
|
||||
p.vfsCache.Rename(cacheKey, generateCacheKey(user, entry.secret, clientIP))
|
||||
p.vfsCache.Rename(cacheKey, generateCacheKey(user, entry.secret, kind, clientIP))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -420,6 +433,7 @@ func (p *Proxy) call(user, auth string, kind authKind, clientIP string) (value a
|
||||
// after the unencrypted password in memory most likely.
|
||||
entry := cacheEntry{
|
||||
vfs: vfs.New(p.ctx, f, &p.vfsOpt),
|
||||
kind: kind,
|
||||
pwHash: sha256.Sum256([]byte(auth)),
|
||||
secret: secret,
|
||||
refreshed: new(atomic.Int64),
|
||||
@@ -440,25 +454,37 @@ func (p *Proxy) call(user, auth string, kind authKind, clientIP string) (value a
|
||||
// Call runs the auth proxy with the username and password/public key provided
|
||||
// returning a *vfs.VFS and the key used in the VFS cache.
|
||||
//
|
||||
// A cached answer older than revalidateInterval is checked with the
|
||||
// proxy again so a revoked user is refused even if it is in constant
|
||||
// use.
|
||||
//
|
||||
// remoteAddr is the address of the client as returned by net.Addr.String().
|
||||
// It may be empty if the client has no IP address, for example when
|
||||
// connecting over a unix socket.
|
||||
func (p *Proxy) Call(user, auth string, isPublicKey bool, remoteAddr string) (VFS *vfs.VFS, vfsKey string, err error) {
|
||||
clientIP := ipFromAddr(remoteAddr)
|
||||
kind := authPassword
|
||||
if isPublicKey {
|
||||
kind = authPublicKey
|
||||
}
|
||||
|
||||
// Cache key includes the auth and the client IP so credential or
|
||||
// address changes don't hit a stale entry
|
||||
cacheKey := generateCacheKey(user, auth, clientIP)
|
||||
// Cache key includes the auth, its kind and the client IP so
|
||||
// credential, method or address changes don't hit a stale entry
|
||||
cacheKey := generateCacheKey(user, auth, kind, clientIP)
|
||||
|
||||
// Look in the cache first with the credential-aware key
|
||||
value, ok := p.vfsCache.GetMaybe(cacheKey)
|
||||
|
||||
// Ask the proxy again once the cached answer is old enough, so
|
||||
// a revoked user is refused even if the entry is in constant use
|
||||
if entry, isEntry := value.(cacheEntry); ok && isEntry {
|
||||
if time.Since(time.Unix(0, entry.refreshed.Load())) >= revalidateInterval {
|
||||
ok = false
|
||||
}
|
||||
}
|
||||
|
||||
// If not found then call the proxy for a fresh answer
|
||||
if !ok {
|
||||
kind := authPassword
|
||||
if isPublicKey {
|
||||
kind = authPublicKey
|
||||
}
|
||||
// Logins with the same credentials which arrive together
|
||||
// share one call, as each call which made its own cache
|
||||
// entry would take a reference to the VFS but only the
|
||||
@@ -477,13 +503,14 @@ func (p *Proxy) Call(user, auth string, isPublicKey bool, remoteAddr string) (VF
|
||||
return nil, "", fmt.Errorf("proxy: value is not cache entry: %#v", value)
|
||||
}
|
||||
|
||||
// Check the password / public key matches the cached entry. The
|
||||
// cache key already includes a hash of the auth, so a changed
|
||||
// credential lands on a fresh key rather than this entry; this
|
||||
// check is a final guard against a hash collision on the key
|
||||
// returning a backend created with different auth.
|
||||
// Check the password / public key and its kind match the cached
|
||||
// entry. The cache key already includes a hash of the auth and its
|
||||
// kind, so a changed credential or method lands on a fresh key
|
||||
// rather than this entry; this check is a final guard against a
|
||||
// hash collision on the key returning a backend created with
|
||||
// different auth.
|
||||
authHash := sha256.Sum256([]byte(auth))
|
||||
if subtle.ConstantTimeCompare(authHash[:], entry.pwHash[:]) != 1 {
|
||||
if entry.kind != kind || subtle.ConstantTimeCompare(authHash[:], entry.pwHash[:]) != 1 {
|
||||
if isPublicKey {
|
||||
return nil, "", errors.New("proxy: incorrect public key")
|
||||
}
|
||||
@@ -507,20 +534,20 @@ func (p *Proxy) Call(user, auth string, isPublicKey bool, remoteAddr string) (VF
|
||||
// safe to do when a signature fails to verify in case the secret has
|
||||
// been rotated.
|
||||
//
|
||||
// A cached answer older than accessKeyRevalidateInterval is always
|
||||
// A cached answer older than revalidateInterval is always
|
||||
// checked with the proxy so a revoked access key ID is refused even
|
||||
// if it is in constant use.
|
||||
//
|
||||
// remoteAddr is the address of the client as returned by net.Addr.String().
|
||||
func (p *Proxy) CallAccessKey(accessKeyID, remoteAddr string, refresh bool) (VFS *vfs.VFS, secret string, err error) {
|
||||
clientIP := ipFromAddr(remoteAddr)
|
||||
cacheKey := generateCacheKey(accessKeyID, "", clientIP)
|
||||
cacheKey := generateCacheKey(accessKeyID, "", authAccessKey, clientIP)
|
||||
value, ok := p.vfsCache.GetMaybe(cacheKey)
|
||||
if ok {
|
||||
if entry, isEntry := value.(cacheEntry); isEntry {
|
||||
age := time.Since(time.Unix(0, entry.refreshed.Load()))
|
||||
switch {
|
||||
case age >= accessKeyRevalidateInterval:
|
||||
case age >= revalidateInterval:
|
||||
refresh = true
|
||||
case age < accessKeyRefreshInterval:
|
||||
refresh = false
|
||||
|
||||
@@ -35,6 +35,15 @@ func main() {
|
||||
v += "-test"
|
||||
case "error":
|
||||
log.Fatal(v)
|
||||
case "pass":
|
||||
// Simulate a key-only policy which refuses every password
|
||||
if os.Getenv("RCLONE_TEST_PROXY_KEY_ONLY") != "" {
|
||||
log.Fatalf("password refused for %q", in["user"])
|
||||
}
|
||||
case "public_key":
|
||||
if os.Getenv("RCLONE_TEST_PROXY_REFUSE_KEYS") != "" {
|
||||
log.Fatalf("public key refused for %q", in["user"])
|
||||
}
|
||||
}
|
||||
out[k] = v
|
||||
}
|
||||
@@ -44,16 +53,18 @@ func main() {
|
||||
if out["_root"] == "" {
|
||||
out["_root"] = ""
|
||||
}
|
||||
// A user or access key ID can be revoked
|
||||
if revoked := os.Getenv("RCLONE_TEST_PROXY_REVOKED"); revoked != "" && in["user"] == revoked {
|
||||
log.Fatalf("user %q revoked", in["user"])
|
||||
}
|
||||
// S3 access key auth has neither pass nor public_key and needs
|
||||
// the secret returned, unless the user asks for it to be omitted
|
||||
// or empty. The secret's suffix can be changed to simulate a
|
||||
// rotation and an access key ID can be revoked.
|
||||
// rotation.
|
||||
_, havePass := in["pass"]
|
||||
_, havePublicKey := in["public_key"]
|
||||
switch {
|
||||
case havePass || havePublicKey || in["user"] == "nosecret":
|
||||
case in["user"] == os.Getenv("RCLONE_TEST_PROXY_REVOKED"):
|
||||
log.Fatalf("access key ID %q revoked", in["user"])
|
||||
case in["user"] == "emptysecret":
|
||||
out["_secret_access_key"] = ""
|
||||
default:
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -107,14 +108,25 @@ func TestRun(t *testing.T) {
|
||||
// affect the cache key, otherwise the proxy would be run for
|
||||
// every connection rather than once per client.
|
||||
assert.Equal(t,
|
||||
generateCacheKey(testUser, testPass, ipFromAddr(testIP+":1024")),
|
||||
generateCacheKey(testUser, testPass, ipFromAddr(testIP+":2048")))
|
||||
generateCacheKey(testUser, testPass, authPassword, ipFromAddr(testIP+":1024")),
|
||||
generateCacheKey(testUser, testPass, authPassword, ipFromAddr(testIP+":2048")))
|
||||
|
||||
// A different client IP must produce a different key so the
|
||||
// proxy is consulted again
|
||||
assert.NotEqual(t,
|
||||
generateCacheKey(testUser, testPass, ipFromAddr(testAddr)),
|
||||
generateCacheKey(testUser, testPass, ipFromAddr(otherAddr)))
|
||||
generateCacheKey(testUser, testPass, authPassword, ipFromAddr(testAddr)),
|
||||
generateCacheKey(testUser, testPass, authPassword, ipFromAddr(otherAddr)))
|
||||
|
||||
// The same credential presented by a different method must
|
||||
// produce a different key, otherwise a public key, which isn't
|
||||
// a secret, sent as a password would hit the entry made when
|
||||
// its owner logged in with it and skip the proxy.
|
||||
assert.NotEqual(t,
|
||||
generateCacheKey(testUser, testPass, authPublicKey, ipFromAddr(testAddr)),
|
||||
generateCacheKey(testUser, testPass, authPassword, ipFromAddr(testAddr)))
|
||||
assert.NotEqual(t,
|
||||
generateCacheKey(testUser, "", authAccessKey, ipFromAddr(testAddr)),
|
||||
generateCacheKey(testUser, "", authPassword, ipFromAddr(testAddr)))
|
||||
})
|
||||
|
||||
t.Run("call w/Password", func(t *testing.T) {
|
||||
@@ -133,7 +145,7 @@ func TestRun(t *testing.T) {
|
||||
require.NotNil(t, entry.vfs)
|
||||
f := entry.vfs.Fs()
|
||||
require.NotNil(t, f)
|
||||
cacheKey := generateCacheKey(testUser, testPass, testIP)
|
||||
cacheKey := generateCacheKey(testUser, testPass, authPassword, testIP)
|
||||
assert.Equal(t, "proxy-"+cacheKey, f.Name())
|
||||
assert.True(t, strings.HasPrefix(f.String(), "Local file system"))
|
||||
|
||||
@@ -149,7 +161,7 @@ func TestRun(t *testing.T) {
|
||||
assert.Equal(t, 0, p.vfsCache.Entries())
|
||||
defer p.vfsCache.Clear()
|
||||
|
||||
cacheKey := generateCacheKey(testUser, testPass, testIP)
|
||||
cacheKey := generateCacheKey(testUser, testPass, authPassword, testIP)
|
||||
vfs, vfsKey, err := p.Call(testUser, testPass, false, testAddr)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, vfs)
|
||||
@@ -206,7 +218,8 @@ func TestRun(t *testing.T) {
|
||||
// If a cached entry's pwHash somehow doesn't match the supplied
|
||||
// auth (eg a hash collision on the cache key), Call must reject
|
||||
// it. Simulate by corrupting the cached pwHash.
|
||||
entry := cacheEntry{vfs: vfs, pwHash: sha256.Sum256([]byte("tampered"))}
|
||||
entry := cacheEntry{vfs: vfs, pwHash: sha256.Sum256([]byte("tampered")), refreshed: new(atomic.Int64)}
|
||||
entry.refreshed.Store(time.Now().UnixNano())
|
||||
p.vfsCache.Put(cacheKey, entry)
|
||||
vfs, vfsKey, err = p.Call(testUser, testPass, false, testAddr)
|
||||
require.Error(t, err)
|
||||
@@ -224,7 +237,35 @@ func TestRun(t *testing.T) {
|
||||
vfs, vfsKey, err := p.Call(testUser, testPass, false, "")
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, vfs)
|
||||
assert.Equal(t, generateCacheKey(testUser, testPass, ""), vfsKey)
|
||||
assert.Equal(t, generateCacheKey(testUser, testPass, authPassword, ""), vfsKey)
|
||||
assert.Equal(t, 1, p.vfsCache.Entries())
|
||||
})
|
||||
|
||||
t.Run("Call revalidates", func(t *testing.T) {
|
||||
assert.Equal(t, 0, p.vfsCache.Entries())
|
||||
defer p.vfsCache.Clear()
|
||||
oldRevalidate := revalidateInterval
|
||||
defer func() { revalidateInterval = oldRevalidate }()
|
||||
|
||||
VFS, _, err := p.Call(testUser, testPass, false, testAddr)
|
||||
require.NoError(t, err)
|
||||
|
||||
// A recently confirmed entry is used without asking the proxy
|
||||
t.Setenv("RCLONE_TEST_PROXY_REVOKED", testUser)
|
||||
VFS2, _, err := p.Call(testUser, testPass, false, testAddr)
|
||||
require.NoError(t, err, "cached entry should still be trusted")
|
||||
assert.Same(t, VFS, VFS2)
|
||||
|
||||
// Once old enough the proxy is asked again and can revoke the user
|
||||
revalidateInterval = 0
|
||||
_, _, err = p.Call(testUser, testPass, false, testAddr)
|
||||
require.ErrorContains(t, err, "revoked")
|
||||
|
||||
// A user the proxy still allows keeps the cached backend
|
||||
t.Setenv("RCLONE_TEST_PROXY_REVOKED", "")
|
||||
VFS3, _, err := p.Call(testUser, testPass, false, testAddr)
|
||||
require.NoError(t, err)
|
||||
assert.Same(t, VFS, VFS3)
|
||||
assert.Equal(t, 1, p.vfsCache.Entries())
|
||||
})
|
||||
|
||||
@@ -254,7 +295,7 @@ func TestRun(t *testing.T) {
|
||||
require.NotNil(t, entry.vfs)
|
||||
f := entry.vfs.Fs()
|
||||
require.NotNil(t, f)
|
||||
cacheKey := generateCacheKey(testUser, publicKeyString, testIP)
|
||||
cacheKey := generateCacheKey(testUser, publicKeyString, authPublicKey, testIP)
|
||||
assert.Equal(t, "proxy-"+cacheKey, f.Name())
|
||||
assert.True(t, strings.HasPrefix(f.String(), "Local file system"))
|
||||
|
||||
@@ -270,7 +311,7 @@ func TestRun(t *testing.T) {
|
||||
assert.Equal(t, 0, p.vfsCache.Entries())
|
||||
defer p.vfsCache.Clear()
|
||||
|
||||
cacheKey := generateCacheKey(testUser, publicKeyString, testIP)
|
||||
cacheKey := generateCacheKey(testUser, publicKeyString, authPublicKey, testIP)
|
||||
vfs, vfsKey, err := p.Call(
|
||||
testUser,
|
||||
publicKeyString,
|
||||
@@ -323,7 +364,8 @@ func TestRun(t *testing.T) {
|
||||
// If a cached entry's pwHash somehow doesn't match the supplied
|
||||
// auth (eg a hash collision on the cache key), Call must reject
|
||||
// it. Simulate by corrupting the cached pwHash.
|
||||
entry := cacheEntry{vfs: vfs, pwHash: sha256.Sum256([]byte("tampered"))}
|
||||
entry := cacheEntry{vfs: vfs, kind: authPublicKey, pwHash: sha256.Sum256([]byte("tampered")), refreshed: new(atomic.Int64)}
|
||||
entry.refreshed.Store(time.Now().UnixNano())
|
||||
p.vfsCache.Put(cacheKey, entry)
|
||||
vfs, vfsKey, err = p.Call(testUser, publicKeyString, true, testAddr)
|
||||
require.Error(t, err)
|
||||
@@ -331,6 +373,42 @@ func TestRun(t *testing.T) {
|
||||
require.Nil(t, vfs)
|
||||
require.Equal(t, "", vfsKey)
|
||||
})
|
||||
|
||||
t.Run("Call w/PublicKey as Password", func(t *testing.T) {
|
||||
// A public key isn't a secret, so once its owner has logged in
|
||||
// with it anyone who knows it must not be able to send it as a
|
||||
// password from the same address and get the cached backend
|
||||
// without the proxy being asked whether that password is valid.
|
||||
assert.Equal(t, 0, p.vfsCache.Entries())
|
||||
defer p.vfsCache.Clear()
|
||||
|
||||
vfs, vfsKey, err := p.Call(testUser, publicKeyString, true, testAddr)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, vfs)
|
||||
assert.Equal(t, 1, p.vfsCache.Entries())
|
||||
|
||||
// The proxy must be consulted, which shows up as a fresh cache
|
||||
// entry with a different key and backend
|
||||
vfs2, vfsKey2, err := p.Call(testUser, publicKeyString, false, testAddr)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, vfs2)
|
||||
assert.NotEqual(t, vfsKey, vfsKey2)
|
||||
assert.Equal(t, 2, p.vfsCache.Entries())
|
||||
if vfs.Fs() == vfs2.Fs() {
|
||||
t.Error("password login got the backend created for a public key login")
|
||||
}
|
||||
|
||||
// A cached entry of the wrong kind must be rejected even if
|
||||
// the cache key somehow matches (eg a hash collision).
|
||||
entry := cacheEntry{vfs: vfs2, kind: authPublicKey, pwHash: sha256.Sum256([]byte(publicKeyString)), refreshed: new(atomic.Int64)}
|
||||
entry.refreshed.Store(time.Now().UnixNano())
|
||||
p.vfsCache.Put(vfsKey2, entry)
|
||||
vfs2, vfsKey2, err = p.Call(testUser, publicKeyString, false, testAddr)
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), "incorrect password")
|
||||
require.Nil(t, vfs2)
|
||||
require.Equal(t, "", vfsKey2)
|
||||
})
|
||||
}
|
||||
|
||||
// TestCallAccessKeyConcurrentRefresh checks that concurrent refreshes
|
||||
@@ -467,13 +545,13 @@ func TestCallAccessKey(t *testing.T) {
|
||||
|
||||
// Check a cached entry is revalidated with the proxy once it is
|
||||
// old enough even without a refresh being asked for
|
||||
oldRevalidate := accessKeyRevalidateInterval
|
||||
defer func() { accessKeyRevalidateInterval = oldRevalidate }()
|
||||
oldRevalidate := revalidateInterval
|
||||
defer func() { revalidateInterval = oldRevalidate }()
|
||||
t.Setenv("RCLONE_TEST_PROXY_REVOKED", "AKID")
|
||||
_, secret8, err := p.CallAccessKey("AKID", remoteAddr, false)
|
||||
require.NoError(t, err, "cached entry should still be trusted")
|
||||
assert.Equal(t, "AKID-rotated-again", secret8)
|
||||
accessKeyRevalidateInterval = 0
|
||||
revalidateInterval = 0
|
||||
_, _, err = p.CallAccessKey("AKID", remoteAddr, false)
|
||||
require.ErrorContains(t, err, "revoked")
|
||||
}
|
||||
|
||||
@@ -124,7 +124,19 @@ func (v vfsHandler) Filecmd(r *sftp.Request) (err error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case "Rmdir", "Remove":
|
||||
case "Rmdir":
|
||||
node, err := v.Stat(r.Filepath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !node.IsDir() {
|
||||
return syscall.ENOTDIR
|
||||
}
|
||||
err = node.Remove()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case "Remove":
|
||||
err := v.Remove(r.Filepath)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -295,6 +295,28 @@ func TestShortSubsystemRequest(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
// Test that an RMDIR request on a file fails and leaves the file alone,
|
||||
// rather than deleting it.
|
||||
func TestRmdirFile(t *testing.T) {
|
||||
vfsOpt := vfscommon.Opt
|
||||
client := startTestServer(t, &vfsOpt)
|
||||
|
||||
const fileName = "file.txt"
|
||||
require.NoError(t, writeFile(client, fileName, "hello"))
|
||||
|
||||
assert.Error(t, client.RemoveDirectory(fileName))
|
||||
|
||||
fi, err := client.Stat(fileName)
|
||||
require.NoError(t, err, "file deleted by rmdir")
|
||||
assert.Equal(t, int64(5), fi.Size())
|
||||
|
||||
// RMDIR still removes an empty directory
|
||||
require.NoError(t, client.Mkdir("dir"))
|
||||
require.NoError(t, client.RemoveDirectory("dir"))
|
||||
_, err = client.Stat("dir")
|
||||
assert.True(t, os.IsNotExist(err), "directory not removed: %v", err)
|
||||
}
|
||||
|
||||
// writeFile writes contents to fileName via the client truncating any existing
|
||||
// data, the way a normal upload does.
|
||||
func writeFile(client *sftp.Client, fileName, contents string) error {
|
||||
|
||||
@@ -196,6 +196,24 @@ func (s *server) configure() (err error) {
|
||||
},
|
||||
PublicKeyCallback: func(c ssh.ConnMetadata, pubKey ssh.PublicKey) (*ssh.Permissions, error) {
|
||||
fs.Debugf(describeConn(c), "Public key login attempt for %s", c.User())
|
||||
if s.provider.IsProxy() {
|
||||
// This is also called for keys offered without a
|
||||
// signature, so leave asking the proxy until
|
||||
// VerifiedPublicKeyCallback when the client has proved
|
||||
// it holds the private key.
|
||||
return &ssh.Permissions{}, nil
|
||||
}
|
||||
if _, ok := authorizedKeysMap[string(pubKey.Marshal())]; ok {
|
||||
return &ssh.Permissions{
|
||||
// Record the public key used for authentication.
|
||||
Extensions: map[string]string{
|
||||
"pubkey-fp": ssh.FingerprintSHA256(pubKey),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
return nil, fmt.Errorf("unknown public key for %q", c.User())
|
||||
},
|
||||
VerifiedPublicKeyCallback: func(c ssh.ConnMetadata, pubKey ssh.PublicKey, perms *ssh.Permissions, _ string) (*ssh.Permissions, error) {
|
||||
if s.provider.IsProxy() {
|
||||
//query the proxy for the config
|
||||
_, vfsKey, err := s.provider.Proxy().Call(
|
||||
@@ -214,15 +232,7 @@ func (s *server) configure() (err error) {
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
if _, ok := authorizedKeysMap[string(pubKey.Marshal())]; ok {
|
||||
return &ssh.Permissions{
|
||||
// Record the public key used for authentication.
|
||||
Extensions: map[string]string{
|
||||
"pubkey-fp": ssh.FingerprintSHA256(pubKey),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
return nil, fmt.Errorf("unknown public key for %q", c.User())
|
||||
return perms, nil
|
||||
},
|
||||
AuthLogCallback: func(conn ssh.ConnMetadata, method string, err error) {
|
||||
status := "OK"
|
||||
|
||||
@@ -9,8 +9,16 @@ package sftp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/ed25519"
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/sftp"
|
||||
_ "github.com/rclone/rclone/backend/local"
|
||||
@@ -23,6 +31,7 @@ import (
|
||||
"github.com/rclone/rclone/vfs/vfscommon"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -104,6 +113,190 @@ func TestNewServerPerServerAuthProxy(t *testing.T) {
|
||||
assert.Nil(t, w.provider.VFS(), "expected no fixed VFS when auth proxy is in use")
|
||||
}
|
||||
|
||||
// TestAuthProxyPublicKeyAsPassword checks that a public key which has
|
||||
// just been used to log in through the auth proxy can't be sent as a
|
||||
// password from the same address to get the same backend without the
|
||||
// proxy being asked.
|
||||
func TestAuthProxyPublicKeyAsPassword(t *testing.T) {
|
||||
// The proxy accepts any public key but refuses every password, so
|
||||
// a password login can only succeed by skipping the proxy
|
||||
t.Setenv("RCLONE_TEST_PROXY_KEY_ONLY", "1")
|
||||
proxyOpt := proxy.Opt
|
||||
proxyOpt.AuthProxy = "go run ../proxy/proxy_code.go"
|
||||
|
||||
opt := Opt
|
||||
opt.ListenAddr = testBindAddress
|
||||
w, err := newServer(context.Background(), nil, &opt, &vfscommon.Opt, &proxyOpt)
|
||||
require.NoError(t, err)
|
||||
go func() {
|
||||
assert.NoError(t, w.Serve())
|
||||
}()
|
||||
defer func() {
|
||||
assert.NoError(t, w.Shutdown())
|
||||
}()
|
||||
addr := w.Addr().String()
|
||||
|
||||
_, privateKey, err := ed25519.GenerateKey(rand.Reader)
|
||||
require.NoError(t, err)
|
||||
signer, err := ssh.NewSignerFromKey(privateKey)
|
||||
require.NoError(t, err)
|
||||
publicKeyString := base64.StdEncoding.EncodeToString(signer.PublicKey().Marshal())
|
||||
|
||||
login := func(auth ssh.AuthMethod) error {
|
||||
client, err := ssh.Dial("tcp", addr, &ssh.ClientConfig{
|
||||
User: "victim",
|
||||
Auth: []ssh.AuthMethod{auth},
|
||||
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||
Timeout: 30 * time.Second,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = client.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check the proxy refuses the public key as a password on a cold cache
|
||||
require.ErrorContains(t, login(ssh.Password(publicKeyString)), "unable to authenticate")
|
||||
|
||||
// The owner of the key logs in with it
|
||||
require.NoError(t, login(ssh.PublicKeys(signer)))
|
||||
|
||||
// Now the public key must still be refused as a password
|
||||
require.ErrorContains(t, login(ssh.Password(publicKeyString)), "unable to authenticate")
|
||||
}
|
||||
|
||||
// querySigner offers a public key without being able to sign with it,
|
||||
// so the client only asks the server whether the key is acceptable.
|
||||
type querySigner struct {
|
||||
key ssh.PublicKey
|
||||
}
|
||||
|
||||
func (s querySigner) PublicKey() ssh.PublicKey {
|
||||
return s.key
|
||||
}
|
||||
|
||||
func (s querySigner) Sign(io.Reader, []byte) (*ssh.Signature, error) {
|
||||
return nil, errors.New("no private key")
|
||||
}
|
||||
|
||||
// TestAuthProxyPublicKeyQuery checks that offering a public key without
|
||||
// proving possession of its private key doesn't run the auth proxy or
|
||||
// log in.
|
||||
func TestAuthProxyPublicKeyQuery(t *testing.T) {
|
||||
runLog := filepath.Join(t.TempDir(), "proxy-runs")
|
||||
t.Setenv("RCLONE_TEST_PROXY_RUN_LOG", runLog)
|
||||
proxyOpt := proxy.Opt
|
||||
proxyOpt.AuthProxy = "go run ../proxy/proxy_code.go"
|
||||
|
||||
opt := Opt
|
||||
opt.ListenAddr = testBindAddress
|
||||
w, err := newServer(context.Background(), nil, &opt, &vfscommon.Opt, &proxyOpt)
|
||||
require.NoError(t, err)
|
||||
go func() {
|
||||
assert.NoError(t, w.Serve())
|
||||
}()
|
||||
defer func() {
|
||||
assert.NoError(t, w.Shutdown())
|
||||
}()
|
||||
addr := w.Addr().String()
|
||||
|
||||
_, privateKey, err := ed25519.GenerateKey(rand.Reader)
|
||||
require.NoError(t, err)
|
||||
signer, err := ssh.NewSignerFromKey(privateKey)
|
||||
require.NoError(t, err)
|
||||
|
||||
login := func(auth ssh.AuthMethod) error {
|
||||
client, err := ssh.Dial("tcp", addr, &ssh.ClientConfig{
|
||||
User: "victim",
|
||||
Auth: []ssh.AuthMethod{auth},
|
||||
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||
Timeout: 30 * time.Second,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = client.Close()
|
||||
return nil
|
||||
}
|
||||
proxyRuns := func() int {
|
||||
data, err := os.ReadFile(runLog)
|
||||
if os.IsNotExist(err) {
|
||||
return 0
|
||||
}
|
||||
require.NoError(t, err)
|
||||
return strings.Count(string(data), "\n")
|
||||
}
|
||||
|
||||
// Offering the key without signing must not run the proxy
|
||||
require.Error(t, login(ssh.PublicKeys(querySigner{signer.PublicKey()})))
|
||||
assert.Equal(t, 0, proxyRuns())
|
||||
|
||||
// The owner of the key can still log in with it
|
||||
require.NoError(t, login(ssh.PublicKeys(signer)))
|
||||
assert.Equal(t, 1, proxyRuns())
|
||||
|
||||
// A key the client signs with must still be refused if the proxy
|
||||
// refuses it
|
||||
t.Setenv("RCLONE_TEST_PROXY_REFUSE_KEYS", "1")
|
||||
_, otherPrivateKey, err := ed25519.GenerateKey(rand.Reader)
|
||||
require.NoError(t, err)
|
||||
otherSigner, err := ssh.NewSignerFromKey(otherPrivateKey)
|
||||
require.NoError(t, err)
|
||||
require.ErrorContains(t, login(ssh.PublicKeys(otherSigner)), "unable to authenticate")
|
||||
assert.Equal(t, 2, proxyRuns())
|
||||
}
|
||||
|
||||
// TestAuthorizedKeys checks that only keys in --authorized-keys can log
|
||||
// in, and only when the client signs with the private key.
|
||||
func TestAuthorizedKeys(t *testing.T) {
|
||||
newSigner := func() ssh.Signer {
|
||||
_, privateKey, err := ed25519.GenerateKey(rand.Reader)
|
||||
require.NoError(t, err)
|
||||
signer, err := ssh.NewSignerFromKey(privateKey)
|
||||
require.NoError(t, err)
|
||||
return signer
|
||||
}
|
||||
signer := newSigner()
|
||||
otherSigner := newSigner()
|
||||
|
||||
authKeysFile := filepath.Join(t.TempDir(), "authorized_keys")
|
||||
require.NoError(t, os.WriteFile(authKeysFile, ssh.MarshalAuthorizedKey(signer.PublicKey()), 0600))
|
||||
|
||||
f, err := fs.NewFs(context.Background(), t.TempDir())
|
||||
require.NoError(t, err)
|
||||
opt := Opt
|
||||
opt.ListenAddr = testBindAddress
|
||||
opt.AuthorizedKeys = authKeysFile
|
||||
w, err := newServer(context.Background(), f, &opt, &vfscommon.Opt, &proxy.Opt)
|
||||
require.NoError(t, err)
|
||||
go func() {
|
||||
assert.NoError(t, w.Serve())
|
||||
}()
|
||||
defer func() {
|
||||
assert.NoError(t, w.Shutdown())
|
||||
}()
|
||||
addr := w.Addr().String()
|
||||
|
||||
login := func(auth ssh.AuthMethod) error {
|
||||
client, err := ssh.Dial("tcp", addr, &ssh.ClientConfig{
|
||||
User: testUser,
|
||||
Auth: []ssh.AuthMethod{auth},
|
||||
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||
Timeout: 30 * time.Second,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = client.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
require.NoError(t, login(ssh.PublicKeys(signer)))
|
||||
require.ErrorContains(t, login(ssh.PublicKeys(otherSigner)), "unable to authenticate")
|
||||
require.Error(t, login(ssh.PublicKeys(querySigner{signer.PublicKey()})))
|
||||
}
|
||||
|
||||
func TestRc(t *testing.T) {
|
||||
servetest.TestRc(t, rc.Params{
|
||||
"type": "sftp",
|
||||
|
||||
@@ -164,6 +164,8 @@ WebDAV or S3, that work out of the box.)
|
||||
{{< provider name="IBM COS S3" home="http://www.ibm.com/cloud/object-storage" config="/s3/#ibm-cos-s3" >}}
|
||||
{{< provider name="IDrive e2" home="https://www.idrive.com/e2/?refer=rclone" config="/s3/#idrive-e2" >}}
|
||||
{{< provider name="Impossible Cloud" home="https://www.impossiblecloud.com/" config="/s3/#impossible-cloud" >}}
|
||||
{{< provider name="Infomaniak Swiss Backup (S3)" home="https://www.infomaniak.com/en/swiss-backup/cloud-storage" config="/s3/#infomaniak" >}}
|
||||
{{< provider name="Infomaniak Swiss Backup (Swift)" home="https://www.infomaniak.com/en/swiss-backup/cloud-storage" config="/swift" >}}
|
||||
{{< provider name="Intercolo Object Storage" home="https://intercolo.de/object-storage" config="/s3/#intercolo" >}}
|
||||
{{< provider name="IONOS Cloud" home="https://cloud.ionos.com/storage/object-storage" config="/s3/#ionos" >}}
|
||||
{{< provider name="kDrive" home="https://www.infomaniak.com/en/ksuite/kdrive" config="/kdrive/" >}}
|
||||
@@ -182,6 +184,7 @@ WebDAV or S3, that work out of the box.)
|
||||
{{< provider name="Microsoft Azure Files Storage" home="https://azure.microsoft.com/en-us/services/storage/files/" config="/azurefiles/" >}}
|
||||
{{< provider name="Microsoft OneDrive" home="https://onedrive.live.com/" config="/onedrive/" >}}
|
||||
{{< provider name="Minio" home="https://www.minio.io/" config="/s3/#minio" >}}
|
||||
{{< provider name="Neon Object Storage" home="https://neon.com/docs/storage/overview" config="/s3/#neon" >}}
|
||||
{{< provider name="Nextcloud" home="https://nextcloud.com/" config="/webdav/#nextcloud" >}}
|
||||
{{< provider name="Blomp Cloud Storage" home="https://rclone.org/swift/" config="/swift/" >}}
|
||||
{{< provider name="OpenDrive" home="https://www.opendrive.com/" config="/opendrive/" >}}
|
||||
|
||||
@@ -1302,3 +1302,19 @@ put them back in again. -->
|
||||
- hahahahahayesyeseys <1145018948@qq.com>
|
||||
- qodelicious <162776175+qodelicious@users.noreply.github.com>
|
||||
- fixfon <12512757+fixfon@users.noreply.github.com>
|
||||
- berce <75228263+bercedev@users.noreply.github.com>
|
||||
- Fred <24314560+creativeprojects@users.noreply.github.com>
|
||||
- Florian Josef Altendorfer <info@altendorfer.dev>
|
||||
- ashwinibailangadi <ashwinib40@gmail.com>
|
||||
- ilya lavrenov <17838283+ilyalavrenov@users.noreply.github.com>
|
||||
- Soujas K <kudchadkarsoujas@gmail.com>
|
||||
- Robert Kubiś <robert.h3x@gmail.com>
|
||||
- b84330808 <b84330808@gmail.com>
|
||||
- Guillaume MALLERET <guillaume.malleret@infomaniak.com>
|
||||
- Louis <louis.amoudruz@gmail.com>
|
||||
- 唐僧洗发用飘柔 <2906266135@qq.com>
|
||||
- Seth Westphal <westy92@gmail.com>
|
||||
- ZainnQureshii <43629888+ZainnQureshii@users.noreply.github.com>
|
||||
- Rishi Raj Jain <jain71000@gmail.com>
|
||||
- Enbiya Göral <100806254+enbiyagoral@users.noreply.github.com>
|
||||
- Florian Josef Altendorfer <341419330+florianaltendorfer@users.noreply.github.com>
|
||||
@@ -919,6 +919,52 @@ Properties:
|
||||
- Type: int
|
||||
- Default: 5000
|
||||
|
||||
#### --azureblob-use-arrow-list
|
||||
|
||||
Use the Apache Arrow listing format.
|
||||
|
||||
If set, directory listings are fetched using the ListBlobs Apache
|
||||
Arrow response format instead of XML. Arrow responses are smaller and
|
||||
much cheaper to parse, making listings of large containers several
|
||||
times faster. Combine with "list_parallelism" for the biggest gains.
|
||||
|
||||
"Blob Listing with Apache Arrow" is in public preview at Microsoft and
|
||||
is only supported on flat namespace accounts. On accounts with a
|
||||
hierarchical namespace (ADLS Gen2), or where the feature is otherwise
|
||||
unavailable, the server returns XML and the listing transparently
|
||||
falls back to the normal XML path (logged at debug level).
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: use_arrow_list
|
||||
- Env Var: RCLONE_AZUREBLOB_USE_ARROW_LIST
|
||||
- Type: bool
|
||||
- Default: false
|
||||
|
||||
#### --azureblob-list-parallelism
|
||||
|
||||
Number of parallel shards to list a directory with.
|
||||
|
||||
If set greater than 1, the blob name keyspace of each directory is
|
||||
split into ranges which are listed concurrently using the Arrow
|
||||
startFrom/endBefore range parameters. This can dramatically speed up
|
||||
listing containers with millions of objects, for both recursive
|
||||
(ListR) and single directory listings. Speed keeps improving up to a
|
||||
parallelism of around 30.
|
||||
|
||||
This has no effect unless "use_arrow_list" is also set, as Arrow is the
|
||||
only listing path that supports server-side name ranges. If the
|
||||
account does not support range listing (e.g. it has a hierarchical
|
||||
namespace) the listing falls back to sequential. The default of 0 (or
|
||||
1) lists sequentially.
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: list_parallelism
|
||||
- Env Var: RCLONE_AZUREBLOB_LIST_PARALLELISM
|
||||
- Type: int
|
||||
- Default: 0
|
||||
|
||||
#### --azureblob-access-tier
|
||||
|
||||
Access tier of blob: hot, cool, cold or archive.
|
||||
@@ -1022,6 +1068,9 @@ creates an empty object ending with "/", to persist the folder.
|
||||
|
||||
This object also has the metadata "hdi_isfolder = true" to conform to
|
||||
the Microsoft standard.
|
||||
|
||||
This is not needed on storage accounts with a hierarchical namespace
|
||||
(see the hns option) as these always support empty directories.
|
||||
|
||||
|
||||
Properties:
|
||||
@@ -1031,6 +1080,24 @@ Properties:
|
||||
- Type: bool
|
||||
- Default: false
|
||||
|
||||
#### --azureblob-hns
|
||||
|
||||
Set if the storage account has a hierarchical namespace.
|
||||
|
||||
Storage accounts with hierarchical namespace enabled (Azure Data Lake
|
||||
Storage Gen2) have real directories which can be empty.
|
||||
|
||||
If this is unset then rclone will read it from the storage account
|
||||
and save it in the config file.
|
||||
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: hns
|
||||
- Env Var: RCLONE_AZUREBLOB_HNS
|
||||
- Type: Tristate
|
||||
- Default: unset
|
||||
|
||||
#### --azureblob-no-check-container
|
||||
|
||||
If set, don't attempt to check the container exists or create it.
|
||||
|
||||
@@ -736,7 +736,7 @@ Properties:
|
||||
Upload chunk size.
|
||||
|
||||
Note that this is stored in memory and there may be up to
|
||||
"--transfers" * "--azurefile-upload-concurrency" chunks stored at once
|
||||
"--transfers" * "--azurefiles-upload-concurrency" chunks stored at once
|
||||
in memory.
|
||||
|
||||
Properties:
|
||||
@@ -758,7 +758,7 @@ links and these uploads do not fully utilize your bandwidth, then
|
||||
increasing this may help to speed up the transfers.
|
||||
|
||||
Note that chunks are stored in memory and there may be up to
|
||||
"--transfers" * "--azurefile-upload-concurrency" chunks stored at once
|
||||
"--transfers" * "--azurefiles-upload-concurrency" chunks stored at once
|
||||
in memory.
|
||||
|
||||
Properties:
|
||||
|
||||
+7
-2
@@ -569,6 +569,11 @@ If the custom endpoint rewrites the requests for authentication,
|
||||
e.g., in Cloudflare Workers, this header needs to be handled properly.
|
||||
Leave blank if you want to use the endpoint provided by Backblaze.
|
||||
|
||||
Rclone will not follow a redirect from this endpoint which downgrades
|
||||
HTTPS to HTTP, and will not send the "Authorization" header or the
|
||||
SSE-C key headers once a redirect has left the host and port of this
|
||||
endpoint.
|
||||
|
||||
The URL provided here SHOULD have the protocol and SHOULD NOT have
|
||||
a trailing slash or specify the /file/bucket subpath as rclone will
|
||||
request files with "{download_url}/file/{bucket_name}/{path}".
|
||||
@@ -665,7 +670,7 @@ Properties:
|
||||
|
||||
To use SSE-C, you may provide the secret encryption key encoded in a UTF-8 compatible string to encrypt/decrypt your data
|
||||
|
||||
Alternatively you can provide --sse-customer-key-base64.
|
||||
Alternatively you can provide --b2-sse-customer-key-base64.
|
||||
|
||||
Properties:
|
||||
|
||||
@@ -681,7 +686,7 @@ Properties:
|
||||
|
||||
To use SSE-C, you may provide the secret encryption key encoded in Base64 format to encrypt/decrypt your data
|
||||
|
||||
Alternatively you can provide --sse-customer-key.
|
||||
Alternatively you can provide --b2-sse-customer-key.
|
||||
|
||||
Properties:
|
||||
|
||||
|
||||
+15
-6
@@ -1074,14 +1074,20 @@ The following backends have known issues that need more investigation:
|
||||
- `TestHuaweiDrive` (`huaweidrive`)
|
||||
- [`TestBisyncRemoteLocal/ext_paths`](https://pub.rclone.org/integration-tests/current/huaweidrive-cmd.bisync-TestHuaweiDrive-1.txt)
|
||||
- [`TestBisyncRemoteLocal/extended_filenames`](https://pub.rclone.org/integration-tests/current/huaweidrive-cmd.bisync-TestHuaweiDrive-1.txt)
|
||||
- [`TestBisyncRemoteLocal/normalization`](https://pub.rclone.org/integration-tests/current/huaweidrive-cmd.bisync-TestHuaweiDrive-1.txt)
|
||||
- [`TestBisyncLocalRemote/ext_paths`](https://pub.rclone.org/integration-tests/current/huaweidrive-cmd.bisync-TestHuaweiDrive-1.txt)
|
||||
- [`TestBisyncLocalRemote/extended_filenames`](https://pub.rclone.org/integration-tests/current/huaweidrive-cmd.bisync-TestHuaweiDrive-1.txt)
|
||||
- [4 more](https://pub.rclone.org/integration-tests/current/)
|
||||
- [`TestBisyncLocalRemote/normalization`](https://pub.rclone.org/integration-tests/current/huaweidrive-cmd.bisync-TestHuaweiDrive-1.txt)
|
||||
- [3 more](https://pub.rclone.org/integration-tests/current/)
|
||||
- `TestPcloud` (`pcloud`)
|
||||
- [`TestBisyncRemoteRemote/check_access`](https://pub.rclone.org/integration-tests/current/pcloud-cmd.bisync-TestPcloud-1.txt)
|
||||
- [`TestBisyncRemoteRemote/rmdirs`](https://pub.rclone.org/integration-tests/current/pcloud-cmd.bisync-TestPcloud-1.txt)
|
||||
- Updated: 2026-07-31-010017
|
||||
- [`TestBisyncRemoteRemote/extended_filenames`](https://pub.rclone.org/integration-tests/current/pcloud-cmd.bisync-TestPcloud-1.txt)
|
||||
- `TestYandex` (`yandex`)
|
||||
- [`TestBisyncRemoteLocal/all_changed`](https://pub.rclone.org/integration-tests/current/yandex-cmd.bisync-TestYandex-1.txt)
|
||||
- [`TestBisyncRemoteLocal/backupdir`](https://pub.rclone.org/integration-tests/current/yandex-cmd.bisync-TestYandex-1.txt)
|
||||
- [`TestBisyncRemoteLocal/basic`](https://pub.rclone.org/integration-tests/current/yandex-cmd.bisync-TestYandex-1.txt)
|
||||
- [`TestBisyncRemoteLocal/changes`](https://pub.rclone.org/integration-tests/current/yandex-cmd.bisync-TestYandex-1.txt)
|
||||
- [`TestBisyncRemoteLocal/check_access`](https://pub.rclone.org/integration-tests/current/yandex-cmd.bisync-TestYandex-1.txt)
|
||||
- [94 more](https://pub.rclone.org/integration-tests/current/)
|
||||
- Updated: 2026-11-06-010024
|
||||
<!--- end list_failures - DO NOT EDIT THIS SECTION - use make commanddocs --->
|
||||
|
||||
The following backends either have not been tested recently or have known issues
|
||||
@@ -1099,6 +1105,8 @@ that are deemed unfixable for the time being:
|
||||
- `TestFilesCom` (`filescom`)
|
||||
- `TestImageKit` (`imagekit`)
|
||||
- `TestJottacloud` (`jottacloud`)
|
||||
- `TestKdrive` (`kdrive`)
|
||||
- `TestBisyncRemoteRemote/normalization`
|
||||
- `TestLinkbox` (`linkbox`)
|
||||
- `TestMailru` (`mailru`)
|
||||
- `TestMega` (`mega`)
|
||||
@@ -1111,7 +1119,8 @@ that are deemed unfixable for the time being:
|
||||
- `TestQuatrix` (`quatrix`)
|
||||
- `TestS3GCS` (`s3`)
|
||||
- `TestBisyncRemoteRemote/extended_filenames`
|
||||
- `TestS3Rclone` (`s3`)
|
||||
- `TestBisyncRemoteLocal/extended_filenames`
|
||||
- `TestBisyncLocalRemote/extended_filenames`
|
||||
- `TestSFTPRsyncNet` (`sftp`)
|
||||
- `TestStorj` (`storj`)
|
||||
- `TestWebdavNextcloud` (`webdav`)
|
||||
|
||||
+328
-28
@@ -6,12 +6,312 @@ description: "Rclone Changelog"
|
||||
|
||||
# Changelog
|
||||
|
||||
## v1.76.0 - 2026-11-06
|
||||
|
||||
[See commits](https://github.com/rclone/rclone/compare/v1.75.0...v1.76.0)
|
||||
|
||||
- New backends
|
||||
- [Dosya](/dosya/) (Kaya)
|
||||
- [Infomaniak kDrive](/kdrive/) (Guillaume MALLERET)
|
||||
- New S3 Providers
|
||||
- [Autonomys Auto Drive](/s3/#autonomys) (Jim Counter)
|
||||
- [Clever Cloud Cellar](/s3/#clever-cloud-cellar) (David Legrand)
|
||||
- [Infomaniak Swiss Backup](/s3/#infomaniak) (Louis)
|
||||
- [Neon Object Storage](/s3/#neon) (Rishi Raj Jain)
|
||||
- [RelAix.Storage](/s3/#relaix) (mygrexit)
|
||||
- New commands
|
||||
- [index](/commands/rclone_index/): Write static directory listings into a remote (Nick Craig-Wood)
|
||||
- Security
|
||||
- build
|
||||
- Disable Multipath TCP listeners by default to mitigate CVE-2026-98432 (Nick Craig-Wood)
|
||||
- Fix multiple CVEs including CVE-2026-111943 by upgrading to go1.27.3 (Nick Craig-Wood)
|
||||
- Update `golang.org/x/net` to v0.62.0 to fix multiple CVEs (Nick Craig-Wood)
|
||||
- Update `github.com/andybalholm/brotli` to v1.2.7 to fix CVE-2026-111497 (Nick Craig-Wood)
|
||||
- fshttp: Refuse HTTPS to HTTP redirects unless `--allow-https-downgrade` GHSA-m97j-7x65-wh93 CVE-PENDING (Nick Craig-Wood)
|
||||
- lib/http: Stop `--htpasswd` and `--user` revealing which usernames exist through timing GHSA-hwj7-wp9g-wrv9 CVE-PENDING (Nick Craig-Wood)
|
||||
- local
|
||||
- Fix user metadata escaping the root through a planted symlink GHSA-r5wv-vqqh-2r9c CVE-PENDING (Nick Craig-Wood)
|
||||
- Fix MkdirMetadata finding directories outside the root through a planted symlink (Nick Craig-Wood)
|
||||
- Fix Remove and Rmdir deleting outside the root through a planted symlink (Nick Craig-Wood)
|
||||
- Fix DirMove creating the destination parent through a planted symlink (Nick Craig-Wood)
|
||||
- netstorage: Fix API auth headers leaking to other hosts on redirect GHSA-m97j-7x65-wh93 CVE-PENDING (Nick Craig-Wood)
|
||||
- rc
|
||||
- Limit request size when the rc server has no authentication GHSA-f8p4-8g4j-q3m2 CVE-PENDING (Nick Craig-Wood)
|
||||
- Reject unauthorised and unknown calls before reading the request GHSA-f8p4-8g4j-q3m2 CVE-PENDING (Nick Craig-Wood)
|
||||
- seafile: Fix HTTPS to HTTP redirects leaking credentials GHSA-m97j-7x65-wh93 CVE-PENDING (Nick Craig-Wood)
|
||||
- serve: Make auth proxy revocation take effect within 5 minutes GHSA-vmgx-g9c5-669p CVE-PENDING (Nick Craig-Wood)
|
||||
- serve sftp
|
||||
- Fix auth proxy letting a public key be used as a password GHSA-66qv-66mg-9h74 CVE-PENDING (Nick Craig-Wood)
|
||||
- Fix auth proxy running for public keys the client can't use GHSA-66qv-66mg-9h74 CVE-PENDING (Nick Craig-Wood)
|
||||
- swift
|
||||
- Fix auth token leaking to other hosts or over plaintext on redirect GHSA-m97j-7x65-wh93 CVE-PENDING (Nick Craig-Wood)
|
||||
- Fix password being resent to another host on auth redirect GHSA-m97j-7x65-wh93 CVE-PENDING (Nick Craig-Wood)
|
||||
- ulozto: Fix auth tokens leaking on redirects from download links GHSA-3xpx-hjg2-vrjh CVE-PENDING (Nick Craig-Wood)
|
||||
- New Features
|
||||
- accounting
|
||||
- Stop `--max-transfer` overshooting the limit (Nick Craig-Wood)
|
||||
- Add "Updated dirs" count of directory modtime/metadata updates to the stats (Nick Craig-Wood)
|
||||
- batcher: Log when committing uploads has finished (phatlc)
|
||||
- bisync
|
||||
- Make `--max-delete` aware of `--track-renames` (Morax)
|
||||
- Fall back to `--download` when a checksum is missing (nielash)
|
||||
- Reject `--max-delete` above 100 (nielash)
|
||||
- build
|
||||
- Update to go1.27 and make go1.26 the minimum required version (Nick Craig-Wood)
|
||||
- Update all dependencies (Nick Craig-Wood)
|
||||
- cmd: Complete enum flag values from their choices (Demiao Huang)
|
||||
- config: Only run `--password-command` once when using `--daemon` (phatlc)
|
||||
- doc fixes (ashwinibailangadi, ferrumclaudepilgrim, frodleTian, FTCHD, gomitrah, Nick Craig-Wood, qodelicious, Satvik Mishra, ZainnQureshii)
|
||||
- docker: Make container user UID and GID configurable via build ARGs (Vaibhav Mashal)
|
||||
- filter
|
||||
- Speed up large `--include-from` lists of directories (kaii9)
|
||||
- Make `[!...]` in globs a negated character class (kevin9327)
|
||||
- Make `[^...]` in globs exclude `/` and document it (kevin9327)
|
||||
- fs
|
||||
- Reject sizes too large for SizeSuffix instead of silently disabling the limit (KBS)
|
||||
- Stop writing config for on the fly and environment variable remotes into the config file (Nick Craig-Wood)
|
||||
- Reject durations like 300y that overflow instead of wrapping (kevin9327)
|
||||
- Accept multi-unit relative times like 1d12h in Time options (kevin)
|
||||
- Reject NaN sizes and CountSuffix values that overflow (kevin9327)
|
||||
- Reject `--bwlimit` times without a colon or with signed digits (kevin9327)
|
||||
- Reject NaN durations instead of wrapping (Soujas K)
|
||||
- Add MIME type for JPEG XL (.jxl) files (Seth Westphal)
|
||||
- gui
|
||||
- Take the GUI out of beta (Nick Craig-Wood)
|
||||
- Update embedded release to 1.2.1 (Nick Craig-Wood)
|
||||
- hash: Add CRC-32C (Castagnoli) support (Dirk Petersen)
|
||||
- index: Add partial runs which only re-index changed directories (Nick Craig-Wood)
|
||||
- lib/http
|
||||
- Return 416 for ranges `--rc-serve` and serve restic can't satisfy (Rohit Behera)
|
||||
- Replace `github.com/abbot/go-http-auth` with built in htpasswd support (Nick Craig-Wood)
|
||||
- Accept the Basic auth scheme in any case (kevin)
|
||||
- lib/proxy: Send the decoded user and password in Proxy-Authorization (kevin)
|
||||
- lib/transform: Make titlecase capitalise words instead of upper-casing them (kevin)
|
||||
- ncdu: Show progress and the item count when deleting a selection (Lev Devaev)
|
||||
- operations
|
||||
- Check checksums in rcat with known size (phatlc)
|
||||
- Speed up checksum by hashing files in parallel (Teddy Tennant)
|
||||
- Fall back to a single stream when a multi-thread source ignores ranges (Morax)
|
||||
- Show directory operations in the `--progress` display (Nick Craig-Wood)
|
||||
- Add `operations/getfile` remote control API endpoint (Hakan İSMAİL)
|
||||
- Make `--immutable` work with copyto, moveto and single file copy (phatlc)
|
||||
- Respect `--backup-dir` in deletefile (Cao Yuhang)
|
||||
- rc
|
||||
- Deprecate `--rc-web-gui` flag (Nick Craig-Wood)
|
||||
- Add sync report parameters to `sync/sync`, `sync/copy` and `sync/move` (Nick Craig-Wood)
|
||||
- rest: Reject negative sizes in HTTP response headers (Yousef Issa)
|
||||
- serve http
|
||||
- Sort directory listings in the browser (Nick Craig-Wood)
|
||||
- Redesign the directory listing page (Nick Craig-Wood)
|
||||
- serve s3
|
||||
- Report the object's modtime as Last-Modified after a PUT (kevin9327)
|
||||
- Support changing object tags (Nick Craig-Wood)
|
||||
- Quote the ETags of objects in listings (Nick Craig-Wood)
|
||||
- Support listing with delimiters other than "/" (Nick Craig-Wood)
|
||||
- Support directory markers and refuse file/directory conflicts (Nick Craig-Wood)
|
||||
- Make the ETag of multipart uploads agree with HEAD and support partNumber (Nick Craig-Wood)
|
||||
- Make conditional writes atomic against other writes through the server (Nick Craig-Wood)
|
||||
- Make the ETag returned on upload agree with HEAD for any `--etag-hash` (Nick Craig-Wood)
|
||||
- List empty directories as directory markers (Nick Craig-Wood)
|
||||
- Allow copying directory markers (Nick Craig-Wood)
|
||||
- Remove the directories made for a failed upload (Nick Craig-Wood)
|
||||
- Keep the MD5 ETag of objects on remotes without MD5 (Nick Craig-Wood)
|
||||
- Don't read directories needlessly when listing with a delimiter (Nick Craig-Wood)
|
||||
- Don't compute the MD5 of multipart uploads unless the ETag is MD5 (Nick Craig-Wood)
|
||||
- List the directory markers put for directories holding other keys (Nick Craig-Wood)
|
||||
- Let a failed CompleteMultipartUpload be retried (Nick Craig-Wood)
|
||||
- List objects with the storage class they were put with (Nick Craig-Wood)
|
||||
- Add `--directory-markers` to list every directory as a marker (Nick Craig-Wood)
|
||||
- Remove a directory with its last key after its marker is deleted (Nick Craig-Wood)
|
||||
- Make `--no-cleanup` a deprecated alias of `--directory-markers` (Nick Craig-Wood)
|
||||
- Document which S3 features are supported and the design goals (Nick Craig-Wood)
|
||||
- serve webdav
|
||||
- Sort directory listings in the browser (Nick Craig-Wood)
|
||||
- Redesign the directory listing page (Nick Craig-Wood)
|
||||
- size: Include source in JSON output (Jiacheng Xu)
|
||||
- sync: Add pattern-based transfer ordering (Shurong Cao)
|
||||
- touch: Parse documented timestamp formats (Nicholas Velten)
|
||||
- Bug Fixes
|
||||
- accounting: Fix totalBytes counting server-side copies and moves twice (ilya lavrenov)
|
||||
- bisync
|
||||
- Fix conflict winner missing from listings when Path2 wins (nielash)
|
||||
- Fix `--conflict-resolve` comparing a zero size or modtime (nielash)
|
||||
- Fix endless retry loop for skipped files (nielash)
|
||||
- Fix listings ignoring a modtime less than 1s older (nielash)
|
||||
- Fix rc ignoring global `--dry-run` and `--max-delete` settings (nielash)
|
||||
- Fix rc ignoring legacy backupdir1/2 and invalid values (nielash)
|
||||
- Fix internal error when a conflict rename reuses deleted names (TastyHeadphones)
|
||||
- fs: Fix durations like 1d12h being rejected (Rohit Behera)
|
||||
- lib/encoder: Fix decoding a trailing character after an escaped quote (kevin9327)
|
||||
- list: Fix ext sort error sometimes being ignored at the end of a listing (Nick Craig-Wood)
|
||||
- ncdu: Update to tcell v3 which fixes duplicated keys on Windows (Nick Craig-Wood)
|
||||
- operations
|
||||
- Fix making a directory with modtime asking twice with `--interactive` (Nick Craig-Wood)
|
||||
- Fix case- or Unicode-only renames deleting the file (nielash)
|
||||
- Fix moving a file onto its own name deleting it (nielash)
|
||||
- Fix cat `--offset` before the start of a file printing its end (b84330808)
|
||||
- Fix oversized getfile tail requests (唐僧洗发用飘柔)
|
||||
- rc: Fix LogLevel in `_config` being ignored (Nick Craig-Wood)
|
||||
- rest: Fix retries reading the request body after the request has finished (Nick Craig-Wood)
|
||||
- serve dlna: Fix crash on Browse with a negative StartingIndex or RequestedCount (phatlc)
|
||||
- serve restic: Fix temporary errors confusing restic into leaving locks behind (Azhar)
|
||||
- serve s3
|
||||
- Update to gofakes3 v0.0.8 which fixes 500 errors with go1.27 (Nick Craig-Wood)
|
||||
- Upgrade gofakes3 to v0.0.11 to fix IsTruncated and Docker Distribution Registry (DEVN)
|
||||
- Fix buckets being undeletable after an aborted multipart upload (Nick Craig-Wood)
|
||||
- Fix CopyObject metadata including the source's and an mtime (Nick Craig-Wood)
|
||||
- serve sftp: Fix rmdir deleting a file instead of returning an error (phatlc)
|
||||
- sync
|
||||
- Fix directory modtimes being set twice (Nick Craig-Wood)
|
||||
- Fix `--delete-empty-src-dirs` disabled by a prior error in a reused stats group (ghwany)
|
||||
- walk: Fix duplicate directories with `--fast-list` when directories are listed after their contents (Nick Craig-Wood)
|
||||
- Mount
|
||||
- Fix VFS instance leaks on mount failures and unmounts (Hakan İSMAİL)
|
||||
- VFS
|
||||
- Preserve shrinking truncate on uncached files (47th)
|
||||
- Fix crash renaming a directory while the dir cache expires (Shreyansh Jain)
|
||||
- Fix virtual entries leak in removed directory (Biagio Peccerillo)
|
||||
- Fix renamed items listed twice after a case or Unicode-only match (nielash)
|
||||
- Fix uploads never starting while a dirty file keeps being read (Neil Cawse)
|
||||
- Local
|
||||
- Speed up default checksummed copies by writing in larger blocks (Dominik Sander)
|
||||
- Make out of space errors fatal during multi-thread transfers (ferrumclaudepilgrim)
|
||||
- Stop `--copy-links` following symlink loops (phatlc)
|
||||
- Limit the size of symlink targets read from .rclonelink files (Nick Craig-Wood)
|
||||
- Fix server-side copy on macOS when the destination exists (Ayush Sharma)
|
||||
- Set only the ownership a non-root user may set (Dirk Petersen)
|
||||
- Crypt
|
||||
- Fix nil pointer panic in ObjectInfo.Hash (fixfon)
|
||||
- Archive
|
||||
- Read symlinks stored in zip and squashfs archives (Lev Devaev)
|
||||
- Fix reading an archive in the root of a remote (Oshino Penguin)
|
||||
- Azure Blob
|
||||
- Enable on Solaris (acoeur)
|
||||
- Fix directories on storage accounts with hierarchical namespace (Nick Craig-Wood)
|
||||
- Fix NewObject on a directory returning "is not a regular file" (Nick Craig-Wood)
|
||||
- Fix listing a file as a directory on hierarchical namespace accounts (Nick Craig-Wood)
|
||||
- Fix sync at the root failing on soft deleted containers (Ludovic Bondon)
|
||||
- Box
|
||||
- Reuse multipart upload part buffers via the global pool (Nick Craig-Wood)
|
||||
- Fix ~ and environment variables not being expanded in `box_config_file` (Nick Craig-Wood)
|
||||
- Chunker
|
||||
- Clean stale chunks after server-side overwrite (hahahahahayesyeseys)
|
||||
- Compress
|
||||
- Buffer small uploads in the global memory pool (Nick Craig-Wood)
|
||||
- Stop buffering the compressibility check output in memory (Nick Craig-Wood)
|
||||
- Drime
|
||||
- Fix endless listing of directories with more than 20,000 entries (Maksym Tymoshyk)
|
||||
- Drive
|
||||
- Fetch metadata permissions concurrently (Loi Nguyen)
|
||||
- Reuse resumable-upload chunk buffers via the global memory pool (SillyZir)
|
||||
- Stop a fast-list error from hanging the sync (Sash)
|
||||
- Dropbox
|
||||
- Reuse upload chunk buffers via the global memory pool (Nick Craig-Wood)
|
||||
- Filelu
|
||||
- Reuse multipart upload buffers via the global pool and retry failed parts (Nick Craig-Wood)
|
||||
- Encode multipart init paths (wjc)
|
||||
- FTP
|
||||
- Discard connections that fail with non-FTP errors (Daniel Bae)
|
||||
- Fix ranged reads failing when the server answers 425 to an early close (Robert Kubiś)
|
||||
- Hasher
|
||||
- Keep cached hash when only the modtime changes (Aniket)
|
||||
- Hidrive
|
||||
- Stop copying every upload chunk a second time (Nick Craig-Wood)
|
||||
- Buffer the start of each upload from the global memory pool (Nick Craig-Wood)
|
||||
- Reuse chunked upload buffers via the global memory pool (Nick Craig-Wood)
|
||||
- Buffer small file updates from the global memory pool (Nick Craig-Wood)
|
||||
- Fix truncated file left behind when an upload hits `--max-transfer` (Nick Craig-Wood)
|
||||
- HTTP
|
||||
- Add metadata defaults for `--http-no-head` (Giridhar)
|
||||
- Huaweidrive
|
||||
- Build small uploads in pooled memory instead of a growing buffer (Nick Craig-Wood)
|
||||
- Reuse resumable-upload chunk buffers via the global pool (Nick Craig-Wood)
|
||||
- Fix creating, copying and renaming files with non-ASCII names (Nick Craig-Wood)
|
||||
- Iclouddrive
|
||||
- Mark the backend as case insensitive (berce)
|
||||
- Imagekit
|
||||
- Stop multipart writers after failed uploads (Florian Josef Altendorfer)
|
||||
- Jottacloud
|
||||
- Buffer MD5 pre-reads in the global memory pool (Nick Craig-Wood)
|
||||
- Fix server-side copy onto a trashed file failing as corrupted (Nick Craig-Wood)
|
||||
- Fix server-side copy onto a trashed file keeping the old name case (Nick Craig-Wood)
|
||||
- Fix authentication with whitelabel services elkjop and elko (albertony)
|
||||
- Fix traditional authentication failing with invalid_client (albertony)
|
||||
- Linkbox
|
||||
- Buffer the hashed 10 MiB file prefix in the global memory pool (Nick Craig-Wood)
|
||||
- Mailru
|
||||
- Buffer speedup hashing in the global memory pool and fix upload retries (Nick Craig-Wood)
|
||||
- Onedrive
|
||||
- OneDrive for Business and SharePoint users must upgrade to v1.76+ before April 1, 2027 (Nick Craig-Wood)
|
||||
- Authenticate SharePoint downloads, uploads and copies after tempauth retirement (Nick Craig-Wood)
|
||||
- Return an error if a ranged download doesn't return the requested range (Nick Craig-Wood)
|
||||
- Reuse upload chunk buffers via the global memory pool (Nick Craig-Wood)
|
||||
- Allow `--onedrive-upload-cutoff` up to the documented limit of 250 MiB (Can Arslan)
|
||||
- Add configurable SharePoint tenant API version (Mattias Michaux)
|
||||
- Make `--onedrive-delta` quicker when not listing from the drive root (Nick Craig-Wood)
|
||||
- Keep the delta token when a ChangeNotify poll fails (xiaozou-wine)
|
||||
- Show the size of directories in listings (GingerAdonis)
|
||||
- Poll async copy status with the configured HTTP client (Soujas K)
|
||||
- Opendrive
|
||||
- Reuse upload chunk buffers via the global memory pool (Nick Craig-Wood)
|
||||
- Oracleobjectstorage
|
||||
- Add server-side object moves (tomaszni)
|
||||
- Encode carriage returns and line feeds (tomaszni)
|
||||
- Purge objects in batches (tomaszni)
|
||||
- Retry 409 ConcurrentObjectUpdate errors (berce)
|
||||
- Pcloud
|
||||
- Stop multipart writers after failed uploads (Florian Josef Altendorfer)
|
||||
- Pikpak
|
||||
- Share upload chunk buffers with the global memory pool (Nick Craig-Wood)
|
||||
- Use pooled memory for the gcid hash buffer and spool unknown-size uploads to disk (Nick Craig-Wood)
|
||||
- Fix downloads that return an HTTP error page as the file (Cestercian)
|
||||
- Stop multipart writers after failed uploads (Florian Josef Altendorfer)
|
||||
- Fix uploads failing when the server is slow to complete them (Nick Craig-Wood)
|
||||
- Putio
|
||||
- Reuse upload chunk buffers via the global memory pool (Nick Craig-Wood)
|
||||
- S3
|
||||
- Avoid buffering Object Lock uploads when the source MD5 is known (Nick Craig-Wood)
|
||||
- Add backend link command with signed response header overrides (eliotee)
|
||||
- Add Fastly EU Central 1 region (Leon Brocard)
|
||||
- Add the MD5 of multipart chunks to the debug log (interested.tortoise)
|
||||
- Report the real storage class when an object needs restoring (Dirk Petersen)
|
||||
- Speed up multi-thread uploads by checksumming chunks in 1 MiB reads (Roman Butor)
|
||||
- Add IT-MIL region to Scaleway (Alessio Margelli)
|
||||
- Add missing Huawei OBS regions (Enbiya Göral)
|
||||
- Fix rmdir of the root directory with `--s3-directory-markers` (Nick Craig-Wood)
|
||||
- Fix presigned URLs for GCS, Linode and Ceph (Leon Brocard)
|
||||
- Seafile
|
||||
- Fix operations on files whose names are not in Unicode NFC form (Fred)
|
||||
- Stop multipart writers after failed uploads (Florian Josef Altendorfer)
|
||||
- Fix double slash in the URL when getting a 2FA token (Nick Craig-Wood)
|
||||
- SFTP
|
||||
- Implement multi-thread uploads (Splainte)
|
||||
- Fix data race when using `--sftp-ssh` (Dirk Petersen)
|
||||
- Fix hash check for names starting with "-" with relative `--sftp-path-override` (Dirk Einecke)
|
||||
- Fix sync deleting files with control characters in their names (nielash)
|
||||
- Fix hashing files with a newline in their name on rsync.net (Nick Craig-Wood)
|
||||
- Shade
|
||||
- Stop copying each upload chunk into a second heap buffer (Nick Craig-Wood)
|
||||
- Smb
|
||||
- Add workstation field to smb backend (Kalin Stoyanov)
|
||||
- Swift
|
||||
- Add Infomaniak Swiss Backup provider (Louis)
|
||||
- WebDAV
|
||||
- Reject ranged responses which ignore the range (Morax)
|
||||
- Retry Nextcloud chunk uploads individually (Stochastic)
|
||||
- Fix Nextcloud public share access by sending X-Requested-With (drakeo338)
|
||||
- Fix memory leak uploading to Infinite Scale (jxj)
|
||||
- Yandex
|
||||
- Add `app_folder` option to support `cloud_api:disk.app_folder` OAuth scope (Sanjay Kanth A)
|
||||
- Zoho
|
||||
- Stop multipart writers after failed uploads (Florian Josef Altendorfer)
|
||||
|
||||
## v1.75.2 - 2026-10-09
|
||||
|
||||
[See commits](https://github.com/rclone/rclone/compare/v1.75.1...v1.75.2)
|
||||
|
||||
- Security
|
||||
- b2: Fix account token and SSE-C key leaking on redirects from `--b2-download-url` GHSA-gpw7-77cq-9f72 CVE-PENDING (Nick Craig-Wood)
|
||||
- b2: Fix account token and SSE-C key leaking on redirects from `--b2-download-url` GHSA-gpw7-77cq-9f72 CVE-2026-116196 (Nick Craig-Wood)
|
||||
- build
|
||||
- Fix multiple CVEs by upgrading to go1.26.9 (Nick Craig-Wood)
|
||||
- CVE-2026-97032: net/http: HTTP/2 server crash due to HPACK encoder race
|
||||
@@ -37,28 +337,28 @@ description: "Rclone Changelog"
|
||||
- Update google.golang.org/grpc to fix CVE-2026-84445 (dependabot[bot])
|
||||
- CVE-2026-84445: xds: server panic on a request missing both :authority and Host headers
|
||||
- fshttp: Drop `--header` values over HTTP after HTTPS downgrade GHSA-rrwf-2qr6-p832 CVE-PENDING (Nick Craig-Wood)
|
||||
- http: Stop a path starting with // moving the remote to another host GHSA-xqmq-v4wj-rw5m CVE-PENDING (Nick Craig-Wood)
|
||||
- lib/http: Require authentication for OPTIONS requests GHSA-gj73-fh6v-92fj CVE-PENDING (Nick Craig-Wood)
|
||||
- local: Fix .rclonelink names escaping the root with `--links` GHSA-55qp-jrwr-x827 CVE-PENDING (Nick Craig-Wood)
|
||||
- http: Stop a path starting with // moving the remote to another host GHSA-xqmq-v4wj-rw5m CVE-2026-116192 (Nick Craig-Wood)
|
||||
- lib/http: Require authentication for OPTIONS requests GHSA-gj73-fh6v-92fj CVE-2026-116193 (Nick Craig-Wood)
|
||||
- local: Fix .rclonelink names escaping the root with `--links` GHSA-55qp-jrwr-x827 CVE-2026-116195 (Nick Craig-Wood)
|
||||
- netstorage
|
||||
- Stop a path starting with // moving the remote to another host GHSA-xqmq-v4wj-rw5m CVE-PENDING (Nick Craig-Wood)
|
||||
- Stop a listing resume token moving signed requests to another host GHSA-xqmq-v4wj-rw5m CVE-PENDING (Nick Craig-Wood)
|
||||
- Stop a path starting with // moving the remote to another host GHSA-xqmq-v4wj-rw5m CVE-2026-116192 (Nick Craig-Wood)
|
||||
- Stop a listing resume token moving signed requests to another host GHSA-xqmq-v4wj-rw5m CVE-2026-116192 (Nick Craig-Wood)
|
||||
- pcloud
|
||||
- Fix OAuth config accepting callbacks without state GHSA-hvpr-p4pv-4f46 CVE-PENDING (Nick Craig-Wood)
|
||||
- Fix OAuth config accepting callbacks without state GHSA-hvpr-p4pv-4f46 CVE-2026-116194 (Nick Craig-Wood)
|
||||
- Only accept pCloud hosts from the hostname in the OAuth callback GHSA-hvpr-p4pv-4f46 (Nick Craig-Wood)
|
||||
- selfupdate
|
||||
- Fix hash check trusting unsigned data in the signed SHA256SUMS GHSA-w33h-3qgq-8mv8 CVE-PENDING (Nick Craig-Wood)
|
||||
- Fix hash check trusting unsigned data in the signed SHA256SUMS GHSA-w33h-3qgq-8mv8 CVE-2026-116189 (Nick Craig-Wood)
|
||||
- Fix release verification instructions trusting unsigned hashes GHSA-w33h-3qgq-8mv8 (Nick Craig-Wood)
|
||||
- serve nfs: Fix path traversal by refusing unsafe file names in the VFS GHSA-44pm-2q5p-fm63 CVE-PENDING (Nick Craig-Wood)
|
||||
- serve nfs: Fix path traversal by refusing unsafe file names in the VFS GHSA-44pm-2q5p-fm63 CVE-2026-116191 (Nick Craig-Wood)
|
||||
- serve s3
|
||||
- Fix presigned URL being turned into a copy of any object GHSA-w3h7-jxxq-vfrp CVE-PENDING (Nick Craig-Wood)
|
||||
- Stop auth proxy users listing or using each other's multipart uploads and metadata GHSA-35g6-9fjv-rmx5 CVE-PENDING (Nick Craig-Wood)
|
||||
- Fix multipart buffer limits being bypassed by overflowing part sizes GHSA-qjw8-8hmp-c3m6 (Nick Craig-Wood)
|
||||
- Stop auth proxy users listing or using each other's multipart uploads and metadata GHSA-35g6-9fjv-rmx5 CVE-2026-116187 (Nick Craig-Wood)
|
||||
- Fix multipart buffer limits being bypassed by overflowing part sizes GHSA-qjw8-8hmp-c3m6 CVE-2026-116188 (Nick Craig-Wood)
|
||||
- Add `--multipart-max-uploads` to limit uploads in progress (Nick Craig-Wood)
|
||||
- Add `--multipart-streaming-buffer-total` to limit memory across uploads (Nick Craig-Wood)
|
||||
- Add `--metadata-max-objects` to limit the metadata kept in memory (Nick Craig-Wood)
|
||||
- serve webdav: Fix path traversal above the served directory GHSA-44pm-2q5p-fm63 CVE-PENDING (Nick Craig-Wood)
|
||||
- webdav: Fix headers option leaking to other hosts on redirect GHSA-3rqf-7h69-gg5v CVE-PENDING (Nick Craig-Wood)
|
||||
- serve webdav: Fix path traversal above the served directory GHSA-44pm-2q5p-fm63 CVE-2026-116191 (Nick Craig-Wood)
|
||||
- webdav: Fix headers option leaking to other hosts on redirect GHSA-3rqf-7h69-gg5v CVE-2026-116190 (Nick Craig-Wood)
|
||||
- Bug Fixes
|
||||
- accounting
|
||||
- Stop averaging when the last check finishes (Kunpeng Xie)
|
||||
@@ -229,7 +529,7 @@ description: "Rclone Changelog"
|
||||
- CVE-2026-56855: ssh: a malicious peer could send crafted messages on an established channel, deadlocking the connection
|
||||
- Update golang.org/x/image to v0.45.0 to fix CVE-2026-46603 (Nick Craig-Wood)
|
||||
- CVE-2026-46603: excessive memory allocation during VP8L decoding
|
||||
- fs: Confine directory listing entries that escape the root GHSA-3vxh-3pcx-9m8q GHSA-38xv-hf3p-h7mq CVE-2026-88046 (Nick Craig-Wood)
|
||||
- fs: Confine directory listing entries that escape the root GHSA-3vxh-3pcx-9m8q CVE-2026-93986 GHSA-38xv-hf3p-h7mq CVE-2026-88046 (Nick Craig-Wood)
|
||||
- fshttp: Don't send `--header` values to other hosts on redirect GHSA-486v-q2wf-fp2r CVE-2026-88013 (Nick Craig-Wood)
|
||||
- http: Don't leak configured headers to other hosts or over plaintext on redirect GHSA-486v-q2wf-fp2r CVE-2026-88013 (Nick Craig-Wood)
|
||||
- lib/rest: Check HTTPS downgrades against the original request on redirect GHSA-486v-q2wf-fp2r CVE-2026-88013 (Nick Craig-Wood)
|
||||
@@ -238,9 +538,9 @@ description: "Rclone Changelog"
|
||||
- Fix btime escaping the root via a planted symlink GHSA-f8g7-2xjc-7mfh CVE-2026-88016 (Nick Craig-Wood)
|
||||
- Fix panic on Range request past the end of a symlink GHSA-p6m2-r3w9-mpxw CVE-2026-88015 (Nick Craig-Wood)
|
||||
- serve docker
|
||||
- Reject volume names that escape the base directory GHSA-p6vx-hf7p-98j6 (Nick Craig-Wood)
|
||||
- Reject volume names resolving to the base directory itself GHSA-p6vx-hf7p-98j6 (Nick Craig-Wood)
|
||||
- Re-derive volume mountpoint from name when restoring state GHSA-p6vx-hf7p-98j6 (Nick Craig-Wood)
|
||||
- Reject volume names that escape the base directory GHSA-p6vx-hf7p-98j6 CVE-2026-93987 (Nick Craig-Wood)
|
||||
- Reject volume names resolving to the base directory itself GHSA-p6vx-hf7p-98j6 CVE-2026-93987 (Nick Craig-Wood)
|
||||
- Re-derive volume mountpoint from name when restoring state GHSA-p6vx-hf7p-98j6 CVE-2026-93987 (Nick Craig-Wood)
|
||||
- serve ftp: Fix auth-proxy sessions sharing credentials by username GHSA-c476-6w5q-jw77 CVE-2026-88017 (Nick Craig-Wood)
|
||||
- serve s3
|
||||
- Fix memory exhaustion from client-declared multipart part size GHSA-2p48-j3qc-rx9f CVE-2026-88045 (Nick Craig-Wood)
|
||||
@@ -352,26 +652,26 @@ description: "Rclone Changelog"
|
||||
- [Scality](/s3/#scality) (RING / ARTESCA)
|
||||
- [Zero Services](/s3/#zero-z3) (ZERO-Z3)
|
||||
- Security
|
||||
- archive: Don't crash on malformed squashfs images GHSA-6jcg-q3wp-x2f4 (Nick Craig-Wood)
|
||||
- archive: Don't crash on malformed squashfs images GHSA-6jcg-q3wp-x2f4 CVE-2026-79775 (Nick Craig-Wood)
|
||||
- ftp: Fix ftp command injection when encoding doesn't include CRLF GHSA-8c48-q9wj-3w37 CVE-2026-71311 (Nick Craig-Wood)
|
||||
- lib/http: Use TLS on all `--addr` listeners when `--cert` and `--key` are set GHSA-mfvx-7rcj-9m5g (Nick Craig-Wood)
|
||||
- lib/proxy: Fix unbounded HTTP CONNECT headers causing OOM GHSA-xhf4-832v-7xcr CVE-2026-71310 (Nick Craig-Wood)
|
||||
- local: Stop source file names escaping the destination directory GHSA-7p4m-qxvv-g567 CVE-2026-71313 (Nick Craig-Wood)
|
||||
- rc
|
||||
- Don't expose pprof debug handlers on an unauthenticated server GHSA-mfvx-7rcj-9m5g CVE-PENDING (Nick Craig-Wood)
|
||||
- Don't expose pprof debug handlers on an unauthenticated server GHSA-mfvx-7rcj-9m5g CVE-2026-79776 (Nick Craig-Wood)
|
||||
- Require authentication to list the remotes with `--rc-serve` GHSA-mfvx-7rcj-9m5g (Nick Craig-Wood)
|
||||
- Fix leaking stack traces on panics GHSA-gwfq-86j8-7qhv (Nick Craig-Wood)
|
||||
- Fix leaking stack traces on panics GHSA-gwfq-86j8-7qhv CVE-2026-79777 (Nick Craig-Wood)
|
||||
- s3
|
||||
- Fix redirect credential leaks, reject HTTPS->HTTP and strip secrets GHSA-8mxv-9xhp-86h4 (Nick Craig-Wood)
|
||||
- Strip S3 Express session token on cross-host redirects GHSA-8mxv-9xhp-86h4 (Nick Craig-Wood)
|
||||
- Fix redirect credential leaks, reject HTTPS->HTTP and strip secrets GHSA-8mxv-9xhp-86h4 CVE-2026-79780 (Nick Craig-Wood)
|
||||
- Strip S3 Express session token on cross-host redirects GHSA-8mxv-9xhp-86h4 CVE-2026-79780 (Nick Craig-Wood)
|
||||
- serve ftp: Use constant time comparison for password check GHSA-mfvx-7rcj-9m5g (Nick Craig-Wood)
|
||||
- serve restic: Fix path traversal above the served directory GHSA-45pq-889g-fcgh CVE-2026-71309 (Nick Craig-Wood)
|
||||
- serve sftp: Don't crash the whole server on a bad request GHSA-6jcg-q3wp-x2f4 (Nick Craig-Wood)
|
||||
- serve sftp: Don't crash the whole server on a bad request GHSA-6jcg-q3wp-x2f4 CVE-2026-79775 (Nick Craig-Wood)
|
||||
- sftp: Fix command injection via crafted filenames on PowerShell remotes GHSA-2m8m-jhrm-w6j2 CVE-2026-71312 (Nick Craig-Wood)
|
||||
- vfs: Don't crash the process if a backend panics on a background goroutine GHSA-6jcg-q3wp-x2f4 (Nick Craig-Wood)
|
||||
- vfs: Don't crash the process if a backend panics on a background goroutine GHSA-6jcg-q3wp-x2f4 CVE-2026-79775 (Nick Craig-Wood)
|
||||
- webdav
|
||||
- Fix HTTPS to HTTP redirects leaking credentials GHSA-h4mf-4v27-hggj (Nick Craig-Wood)
|
||||
- Tus: fix potential nil pointer crash GHSA-3x6r-wxxg-53vv (Nick Craig-Wood)
|
||||
- Fix HTTPS to HTTP redirects leaking credentials GHSA-h4mf-4v27-hggj CVE-2026-79779 (Nick Craig-Wood)
|
||||
- Tus: fix potential nil pointer crash GHSA-3x6r-wxxg-53vv CVE-2026-79778 (Nick Craig-Wood)
|
||||
- Update `google.golang.org/grpc` to fix multiple security problems (Nick Craig-Wood)
|
||||
- New Features
|
||||
- build: Update all dependencies (Nick Craig-Wood)
|
||||
@@ -600,14 +900,14 @@ description: "Rclone Changelog"
|
||||
- serve restic: Fix `--private-repos` isolation bypass CVE-2026-59733 (Nick Craig-Wood)
|
||||
- serve s3
|
||||
- Fix spurious 404 on HEAD/GET during VFS writeback (max)
|
||||
- Fix path traversal letting clients see files in the root GHSA-8v25-v8p6-qf7v (Nick Craig-Wood)
|
||||
- Fix path traversal letting clients see files in the root GHSA-8v25-v8p6-qf7v CVE-2026-79781 (Nick Craig-Wood)
|
||||
- serve webdav: Fix MOVE overwrite failing without Overwrite header (Sanjay Santhanam)
|
||||
- serve/http: Fix `--disable-zip` so it works over rc (Nick Craig-Wood)
|
||||
- VFS
|
||||
- Fix hang reopening a file during the handle-caching grace period (Nick Craig-Wood)
|
||||
- Local
|
||||
- Stop `--links` symlinks escaping the destination directory CVE-2026-54572 (Nick Craig-Wood)
|
||||
- Don't restore setuid/setgid/sticky bits from metadata by default GHSA-945v-v9p3-v5xw (Nick Craig-Wood)
|
||||
- Don't restore setuid/setgid/sticky bits from metadata by default GHSA-945v-v9p3-v5xw CVE-2026-79783 (Nick Craig-Wood)
|
||||
- Drive
|
||||
- Warn when non-exportable Google documents are skipped (Nick Craig-Wood)
|
||||
- Fix stray %!(EXTRA) in unexportable google document log message (Nick Craig-Wood)
|
||||
|
||||
@@ -24,6 +24,7 @@ rclone [flags]
|
||||
```
|
||||
--alias-description string Description of the remote
|
||||
--alias-remote string Remote or path to alias
|
||||
--allow-https-downgrade Follow redirects from HTTPS to HTTP (insecure)
|
||||
--archive-description string Description of the remote
|
||||
--archive-remote string Remote to wrap to read archives from
|
||||
--ask-password Allow prompt for password for encrypted configuration (default true)
|
||||
@@ -50,8 +51,10 @@ rclone [flags]
|
||||
--azureblob-encoding Encoding The encoding for the backend (default Slash,BackSlash,Del,Ctl,RightPeriod,InvalidUtf8)
|
||||
--azureblob-endpoint string Endpoint for the service
|
||||
--azureblob-env-auth Read credentials from runtime (environment variables, CLI or MSI)
|
||||
--azureblob-hns Tristate Set if the storage account has a hierarchical namespace (default unset)
|
||||
--azureblob-key string Storage Account Shared Key
|
||||
--azureblob-list-chunk int Size of blob list (default 5000)
|
||||
--azureblob-list-parallelism int Number of parallel shards to list a directory with
|
||||
--azureblob-msi-client-id string Object ID of the user-assigned MSI to use, if any
|
||||
--azureblob-msi-mi-res-id string Azure resource ID of the user-assigned MSI to use, if any
|
||||
--azureblob-msi-object-id string Object ID of the user-assigned MSI to use, if any
|
||||
@@ -64,6 +67,7 @@ rclone [flags]
|
||||
--azureblob-tenant string ID of the service principal's tenant. Also called its directory ID
|
||||
--azureblob-upload-concurrency int Concurrency for multipart uploads (default 16)
|
||||
--azureblob-upload-cutoff string Cutoff for switching to chunked upload (<= 256 MiB) (deprecated)
|
||||
--azureblob-use-arrow-list Use the Apache Arrow listing format
|
||||
--azureblob-use-az Use Azure CLI tool az for authentication
|
||||
--azureblob-use-copy-blob Whether to use the Copy Blob API when copying to the same storage account (default true)
|
||||
--azureblob-use-emulator Uses local storage emulator if provided as 'true'
|
||||
@@ -224,6 +228,12 @@ rclone [flags]
|
||||
--doi-doi string The DOI or the doi.org URL
|
||||
--doi-doi-resolver-api-url string The URL of the DOI resolver API to use
|
||||
--doi-provider string DOI provider
|
||||
--dosya-api-key string Your API Key, get it from https://dosya.dev/profile under "API keys"
|
||||
--dosya-api-url string API base URL (default "https://api.dosya.dev")
|
||||
--dosya-description string Description of the remote
|
||||
--dosya-encoding Encoding The encoding for the backend (default Slash,LtGt,DoubleQuote,SingleQuote,BackSlash,Del,Ctl,LeftSpace,RightSpace,InvalidUtf8,Dot)
|
||||
--dosya-upload-concurrency int Concurrency for multipart uploads (default 4)
|
||||
--dosya-workspace-id string Your workspace ID
|
||||
--drime-access-token string API Access token
|
||||
--drime-chunk-size SizeSuffix Chunk size to use for uploading (default 5Mi)
|
||||
--drime-description string Description of the remote
|
||||
@@ -470,6 +480,8 @@ rclone [flags]
|
||||
--http-headers CommaSepList Set HTTP headers for all transactions
|
||||
--http-no-escape Do not escape URL metacharacters in path names
|
||||
--http-no-head Don't use HEAD requests
|
||||
--http-no-head-size SizeSuffix Set the reported file size for --http-no-head (default off)
|
||||
--http-no-head-time Time Set a default modification time for --http-no-head (default off)
|
||||
--http-no-slash Set this if the site doesn't end directories with /
|
||||
--http-proxy string HTTP proxy URL
|
||||
--http-url string URL of HTTP host to connect to
|
||||
@@ -543,6 +555,17 @@ rclone [flags]
|
||||
--jottacloud-token-url string Token server url
|
||||
--jottacloud-trashed-only Only show files that are in the trash
|
||||
--jottacloud-upload-resume-limit SizeSuffix Files bigger than this can be resumed if the upload fail's (default 10Mi)
|
||||
--kdrive-auth-url string Auth server URL
|
||||
--kdrive-chunk-size SizeSuffix Files above this size are uploaded in chunks of this size (default 20Mi)
|
||||
--kdrive-client-id string OAuth Client Id
|
||||
--kdrive-description string Description of the remote
|
||||
--kdrive-drive-id string ID of the kDrive to use
|
||||
--kdrive-encoding Encoding The encoding for the backend (default Slash,Del,Ctl,LeftSpace,RightSpace,InvalidUtf8,Dot)
|
||||
--kdrive-endpoint string The API endpoint to use
|
||||
--kdrive-root-folder-id string The folder to use as root
|
||||
--kdrive-token string OAuth Access Token as a JSON blob
|
||||
--kdrive-token-url string Token server url
|
||||
--kdrive-upload-concurrency int Concurrency for chunked uploads (default 4)
|
||||
--koofr-description string Description of the remote
|
||||
--koofr-encoding Encoding The encoding for the backend (default Slash,BackSlash,Del,Ctl,InvalidUtf8,Dot)
|
||||
--koofr-endpoint string The Koofr API endpoint to use
|
||||
@@ -695,6 +718,7 @@ rclone [flags]
|
||||
--onedrive-root-folder-id string ID of the root folder
|
||||
--onedrive-server-side-across-configs Deprecated: use --server-side-across-configs instead
|
||||
--onedrive-tenant string ID of the service principal's tenant. Also called its directory ID
|
||||
--onedrive-tenant-api-version string The SharePoint API version to use with tenant_url (default "v2.0")
|
||||
--onedrive-tenant-url string The tenant URL for non-admin OneDrive access
|
||||
--onedrive-token string OAuth Access Token as a JSON blob
|
||||
--onedrive-token-url string Token server url
|
||||
@@ -709,7 +733,7 @@ rclone [flags]
|
||||
--oos-decompress If set this will decompress gzip encoded objects
|
||||
--oos-description string Description of the remote
|
||||
--oos-disable-checksum Don't store MD5 checksum with object metadata
|
||||
--oos-encoding Encoding The encoding for the backend (default Slash,InvalidUtf8,Dot)
|
||||
--oos-encoding Encoding The encoding for the backend (default Slash,CrLf,InvalidUtf8,Dot)
|
||||
--oos-endpoint string Endpoint for Object storage API
|
||||
--oos-leave-parts-on-error If true avoid calling abort upload on a failure, leaving all successfully uploaded parts for manual recovery
|
||||
--oos-max-upload-parts int Maximum number of parts in a multipart upload (default 10000)
|
||||
@@ -840,11 +864,6 @@ rclone [flags]
|
||||
--rc-template string User-specified template
|
||||
--rc-user string User name for authentication
|
||||
--rc-user-from-header string User name from a defined HTTP header
|
||||
--rc-web-fetch-url string URL to fetch the releases for webgui (default "https://api.github.com/repos/rclone/rclone-webui-react/releases/latest")
|
||||
--rc-web-gui Launch WebGUI on localhost
|
||||
--rc-web-gui-force-update Force update to latest version of web gui
|
||||
--rc-web-gui-no-open-browser Don't open the browser automatically
|
||||
--rc-web-gui-update Check and update to latest version of web gui
|
||||
--refresh-times Refresh the modtime of remote files
|
||||
--retries int Retry operations this many times if they fail (default 3)
|
||||
--retries-sleep Duration Interval between retrying operations if they fail, e.g. 500ms, 60s, 5m (0 to disable) (default 0s)
|
||||
@@ -945,7 +964,7 @@ rclone [flags]
|
||||
--sftp-disable-concurrent-reads If set don't use concurrent reads
|
||||
--sftp-disable-concurrent-writes If set don't use concurrent writes
|
||||
--sftp-disable-hashcheck Disable the execution of SSH commands to determine if remote file hashing is available
|
||||
--sftp-encoding Encoding The encoding for the backend (default Slash,Del,Ctl,Dot)
|
||||
--sftp-encoding Encoding The encoding for the backend (default Slash,Dot)
|
||||
--sftp-hashes CommaSepList Comma separated list of supported checksum types
|
||||
--sftp-host string SSH host to connect to
|
||||
--sftp-host-key-algorithms SpaceSepList Space separated list of host key algorithms, ordered by preference
|
||||
@@ -960,6 +979,7 @@ rclone [flags]
|
||||
--sftp-known-hosts-file string Optional path to known_hosts file
|
||||
--sftp-macs SpaceSepList Space separated list of MACs (message authentication code) algorithms, ordered by preference
|
||||
--sftp-md5sum-command string The command used to read MD5 hashes
|
||||
--sftp-multithread-upload Set this to use multi-thread (multi-connection) uploads
|
||||
--sftp-pass string SSH password, leave blank to use ssh-agent (obscured)
|
||||
--sftp-path-override string Override path used by SSH shell commands
|
||||
--sftp-pin-host-key Pin the server host key on first connection (Trust On First Use)
|
||||
@@ -1023,7 +1043,8 @@ rclone [flags]
|
||||
--smb-port int SMB port number (default 445)
|
||||
--smb-spn string Service principal name
|
||||
--smb-use-kerberos Use Kerberos authentication
|
||||
--smb-user string SMB username (default "$USER")
|
||||
--smb-user string SMB username
|
||||
--smb-workstation string Workstation name sent in NTLM authentication
|
||||
--stats Duration Interval between printing stats, e.g. 500ms, 60s, 5m (0 to disable) (default 1m0s)
|
||||
--stats-file-name-length int Max file name length in stats (0 for no limit) (default 45)
|
||||
--stats-log-level LogLevel Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default INFO)
|
||||
@@ -1107,7 +1128,7 @@ rclone [flags]
|
||||
--use-json-log Use json log format
|
||||
--use-mmap Use mmap allocator (see docs)
|
||||
--use-server-modtime Use server modified time instead of object metadata
|
||||
--user-agent string Set the user-agent to a specified string (default "rclone/v1.75.0")
|
||||
--user-agent string Set the user-agent to a specified string (default "rclone/v1.76.0")
|
||||
-v, --verbose count Print lots more stuff (repeat for more)
|
||||
-V, --version Print the version number
|
||||
--webdav-auth-redirect Preserve authentication on redirect
|
||||
@@ -1125,6 +1146,7 @@ rclone [flags]
|
||||
--webdav-url string URL of http host to connect to
|
||||
--webdav-user string User name
|
||||
--webdav-vendor string Name of the WebDAV site/service/software you are using
|
||||
--yandex-app-folder Use the application folder as the root
|
||||
--yandex-auth-url string Auth server URL
|
||||
--yandex-client-credentials Use client credentials OAuth flow
|
||||
--yandex-client-id string OAuth Client Id
|
||||
@@ -1183,6 +1205,7 @@ rclone [flags]
|
||||
* [rclone gitannex](/commands/rclone_gitannex/) - Speaks with git-annex over stdin/stdout.
|
||||
* [rclone gui](/commands/rclone_gui/) - Open the web based GUI.
|
||||
* [rclone hashsum](/commands/rclone_hashsum/) - Produces a hashsum file for all the objects in the path.
|
||||
* [rclone index](/commands/rclone_index/) - Write static directory listings into a remote.
|
||||
* [rclone link](/commands/rclone_link/) - Generate public link to file/folder.
|
||||
* [rclone listremotes](/commands/rclone_listremotes/) - List all the remotes in the config file and defined in environment variables.
|
||||
* [rclone ls](/commands/rclone_ls/) - List the objects in the path with size and path.
|
||||
|
||||
@@ -52,6 +52,7 @@ rclone bisync remote1:path1 remote2:path2 [flags]
|
||||
--force Bypass --max-delete safety check and run the sync. Consider using with --verbose
|
||||
-h, --help help for bisync
|
||||
--ignore-listing-checksum Do not use checksums for listings (add --ignore-checksum to additionally skip post-copy checksum checks)
|
||||
--max-delete-renames-aware Exclude tracked renames from the --max-delete safety check (requires --track-renames)
|
||||
--max-lock Duration Consider lock files older than this to be expired (default: 0 (never expire)) (minimum: 2m) (default 0s)
|
||||
--no-cleanup Retain working files (useful for troubleshooting and testing).
|
||||
--no-slow-hash Ignore listing checksums only on backends where they are slow
|
||||
|
||||
@@ -14,6 +14,8 @@ Output completion script for a given shell.
|
||||
|
||||
Generates a shell completion script for rclone.
|
||||
Run with `--help` to list the supported shells.
|
||||
Enum-valued flags such as `--log-level` and `--vfs-cache-mode`
|
||||
also complete their supported values.
|
||||
|
||||
## Options
|
||||
|
||||
|
||||
@@ -231,12 +231,12 @@ rclone convmv "stories/The Quick Brown Fox!.txt" --name-transform "all,command=e
|
||||
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown Fox!" --name-transform "date=-{YYYYMMDD}"
|
||||
// Output: stories/The Quick Brown Fox!-20260731
|
||||
// Output: stories/The Quick Brown Fox!-20261106
|
||||
```
|
||||
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown Fox!" --name-transform "date=-{macfriendlytime}"
|
||||
// Output: stories/The Quick Brown Fox!-2026-07-31 0340PM
|
||||
// Output: stories/The Quick Brown Fox!-2026-11-06 0220PM
|
||||
```
|
||||
|
||||
```console
|
||||
|
||||
@@ -10,9 +10,11 @@ Remove a single file from remote.
|
||||
|
||||
## Synopsis
|
||||
|
||||
Remove a single file from remote. Unlike `delete` it cannot be used to
|
||||
Remove a single file from remote. Unlike `delete` it cannot be used to
|
||||
remove a directory and it doesn't obey include/exclude filters - if the
|
||||
specified file exists, it will always be removed.
|
||||
specified file exists, it will always be removed from its original location.
|
||||
|
||||
The `--backup-dir` and `--suffix` flags are honored when set.
|
||||
|
||||
```
|
||||
rclone deletefile remote:path [flags]
|
||||
@@ -27,6 +29,26 @@ rclone deletefile remote:path [flags]
|
||||
Options shared with other commands are described next.
|
||||
See the [global flags page](/flags/) for global options not listed here.
|
||||
|
||||
### Sync Options
|
||||
|
||||
Flags used for sync commands
|
||||
|
||||
```text
|
||||
--backup-dir string Make backups into hierarchy based in DIR
|
||||
--delete-after When synchronizing, delete files on destination after transferring (default)
|
||||
--delete-before When synchronizing, delete files on destination before transferring
|
||||
--delete-during When synchronizing, delete files during transfer
|
||||
--fix-case Force rename of case insensitive dest to match source
|
||||
--ignore-errors Delete even if there are I/O errors
|
||||
--list-cutoff int To save memory, sort directory listings on disk above this threshold (default 1000000)
|
||||
--max-delete int When synchronizing, limit the number of deletes (default -1)
|
||||
--max-delete-size SizeSuffix When synchronizing, limit the total size of deletes (default off)
|
||||
--suffix string Suffix to add to changed files
|
||||
--suffix-keep-extension Preserve the extension when using --suffix
|
||||
--track-renames When synchronizing, track file renames and do a server-side move if possible
|
||||
--track-renames-strategy string Strategies to use when synchronizing using track-renames hash|modtime|leaf (default "hash")
|
||||
```
|
||||
|
||||
### Important Options
|
||||
|
||||
Important flags useful for most commands
|
||||
|
||||
@@ -101,11 +101,6 @@ Flags to control the Remote Control API
|
||||
--rc-template string User-specified template
|
||||
--rc-user string User name for authentication
|
||||
--rc-user-from-header string User name from a defined HTTP header
|
||||
--rc-web-fetch-url string URL to fetch the releases for webgui (default "https://api.github.com/repos/rclone/rclone-webui-react/releases/latest")
|
||||
--rc-web-gui Launch WebGUI on localhost
|
||||
--rc-web-gui-force-update Force update to latest version of web gui
|
||||
--rc-web-gui-no-open-browser Don't open the browser automatically
|
||||
--rc-web-gui-update Check and update to latest version of web gui
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
@@ -41,6 +41,7 @@ Supported hashes are:
|
||||
- blake3
|
||||
- xxh3
|
||||
- xxh128
|
||||
- crc32c
|
||||
```
|
||||
|
||||
Then
|
||||
|
||||
@@ -0,0 +1,331 @@
|
||||
---
|
||||
title: "rclone index"
|
||||
description: "Write static directory listings into a remote."
|
||||
versionIntroduced: v1.76
|
||||
# autogenerated - DO NOT EDIT, instead edit the source code in cmd/index/ and as part of making a release run "make commanddocs"
|
||||
---
|
||||
# rclone index
|
||||
|
||||
Write static directory listings into a remote.
|
||||
|
||||
## Synopsis
|
||||
|
||||
Write a directory listing, `index.html` by default, into every
|
||||
directory of `remote:path` so that it can be browsed when it is served
|
||||
as a static website, for example from an S3 website endpoint, a bucket
|
||||
behind a CDN, or a plain web server.
|
||||
|
||||
This works like `rclone sync`: each run makes the minimum changes needed
|
||||
to bring the listings into line with the files. Listings which haven't
|
||||
changed aren't rewritten, so a run with no changes makes no uploads. The
|
||||
listings never show the listing files themselves.
|
||||
|
||||
**Note** that `rclone index` treats every file with an output name
|
||||
(`index.html` by default) in the directories it indexes as its own, and
|
||||
will overwrite it or delete it without checking where it came from. To
|
||||
protect a hand-written index, exclude its directory with
|
||||
`--index-exclude`.
|
||||
|
||||
## Outputs
|
||||
|
||||
`--output NAME=FORMAT` says what to write in each directory and can be
|
||||
repeated. NAME is the file name, and FORMAT is one of the built-in
|
||||
formats below or the path of a Go template file.
|
||||
|
||||
| Format | MIME type | Contents |
|
||||
|:-------|:----------|:---------|
|
||||
| `html` | `text/html; charset=utf-8` | The HTML listing from the `rclone serve http` template |
|
||||
| `json` | `application/json` | JSON in the format of `rclone lsjson` for the directory |
|
||||
| `caddy` | `application/json` | JSON in the format of Caddy's `file_server browse` |
|
||||
|
||||
The default is `--output index.html=html`. The built-in formats are
|
||||
templates, so they can be printed with `--print-template FORMAT`, copied
|
||||
and changed. Outputs whose name ends in `.html` or `.htm` are rendered
|
||||
with Go's `html/template` and everything else with `text/template`, which
|
||||
has a `json` function for safe encoding. The template data is that of
|
||||
`rclone serve http` with `.Static` set (see
|
||||
[rclone serve http](/commands/rclone_serve_http/#template)). Outputs are
|
||||
uploaded with the MIME type of the built-in format, or that of the
|
||||
output name's extension for template outputs, since static hosts serve
|
||||
the stored type.
|
||||
|
||||
## Filters
|
||||
|
||||
The normal filters (`--include`, `--exclude`, `--filter-from`, `--max-age`, ...)
|
||||
control what appears in the listings. An excluded file isn't listed, and
|
||||
an excluded directory isn't listed or indexed.
|
||||
|
||||
The `--index-include`, `--index-exclude`, `--index-filter` flags and their
|
||||
`-from` variants control which directories get listings. They take the same
|
||||
patterns as the normal filters, applied to directory paths, and
|
||||
`--index-include` implies excluding all other directories. A directory
|
||||
excluded here still appears in its parent's listing, but nothing is written
|
||||
or deleted inside it, so it can have its own hand-made index.
|
||||
`--index-max-depth` limits how deep listings are written.
|
||||
|
||||
## Modification times
|
||||
|
||||
Listings show the modification time of each file. When using the s3,
|
||||
oracleobjectstorage and swift backends rclone stores the modification time as
|
||||
metadata which isn't returned by the bucket listing, so **every object needs
|
||||
a HEAD request**, which can mean thousands of transactions per run. Avoid
|
||||
this with one of:
|
||||
|
||||
- `--use-server-modtime` uses the time the object was uploaded instead,
|
||||
which is what the web server sends as `Last-Modified`. Recommended for s3
|
||||
unless the original modification times matter.
|
||||
- `--no-modtime` shows no times at all, which is the cheapest option.
|
||||
|
||||
`--dir-time` sets the time shown for directories:
|
||||
|
||||
- `newest` (default): the newest modification time of anything below the
|
||||
directory. Note that this means one new file changes the listing of
|
||||
every directory above it.
|
||||
- `dir`: the directory's own modification time. On most file systems
|
||||
writing a listing into a directory changes its time, so this can take
|
||||
more than one run to settle.
|
||||
- `none`: no time.
|
||||
|
||||
The listing files are given the newest modification time below their
|
||||
directory, so the `Last-Modified` header of a listing is meaningful.
|
||||
|
||||
## Links
|
||||
|
||||
Directory links are `dir/` by default, which works on hosts that serve
|
||||
index documents: S3 website endpoints, GCS and Azure static websites,
|
||||
nginx and Apache, and R2 custom domains with a URL rewrite rule. For
|
||||
hosts that don't (plain S3 REST URLs, B2 friendly URLs) use
|
||||
`--link-index` to make directory links `dir/index.html` instead.
|
||||
|
||||
## Partial runs
|
||||
|
||||
After a sync which changed a known set of files there is no need to
|
||||
walk the whole remote. Tell `rclone index` what changed and it re-indexes
|
||||
only the directories that could be affected:
|
||||
|
||||
rclone index r2:bucket --changed v1.76.0/ --changed version.txt
|
||||
rclone index r2:bucket --changed-from changes.txt
|
||||
rclone sync ./public r2:bucket --exclude index.html --combined - | rclone index r2:bucket --changed-combined -
|
||||
|
||||
- `--changed PATH` names a changed file or directory relative to
|
||||
`remote:path` and can be repeated. A directory, given with a trailing
|
||||
slash or found to be one, is re-indexed completely.
|
||||
- `--changed-from FILE` reads one path per line exactly as written.
|
||||
- `--changed-combined FILE` reads the `--combined` report of
|
||||
`rclone sync`: lines starting with `+`, `-`, `*` and `!` are changes and
|
||||
`=` lines are ignored.
|
||||
- Both files accept `-` for standard input and all three flags can be
|
||||
combined.
|
||||
|
||||
A changed file re-indexes its directory and every directory above it,
|
||||
since their times and their listings can change too, and on bucket
|
||||
based storage a directory can cease to exist. Each of those is one
|
||||
directory listing. With `--dir-time newest` the directories above also
|
||||
need the times of their unchanged subdirectories, which are read from
|
||||
the modification times of those subdirectories' listings at the cost
|
||||
of one small request each. With `--use-server-modtime` that is the time
|
||||
the listing was written rather than the time of the newest file, so
|
||||
partial runs can drift by the indexing delay until the next full run.
|
||||
`--dir-time dir` and `none` need no such lookups.
|
||||
|
||||
Directories which are neither named nor above a named path are left
|
||||
alone, as are directories deeper than `--max-depth`. An empty change
|
||||
list does nothing, and naming the root does a full run. There is no
|
||||
automatic cutover to a full run since that depends on the size of the
|
||||
whole remote: a partial run costs one listing per affected directory,
|
||||
a full run one request per thousand objects on S3-like storage or one
|
||||
per directory elsewhere. The number
|
||||
of directories a partial run will list is logged with `-v`, and
|
||||
`--changed-max-dirs` makes it fall back to a full run above that
|
||||
number. A good pattern is a partial run after each upload and a
|
||||
scheduled full run to catch anything missed.
|
||||
|
||||
## Site icon
|
||||
|
||||
The listings carry no icon or branding of their own. To give a site an
|
||||
icon, upload a `favicon.ico` to the root of the remote, which browsers
|
||||
fetch from there for every page. Exclude it from the listings with
|
||||
`--exclude /favicon.ico` so it stays on the site but isn't shown.
|
||||
|
||||
## Deleting listings
|
||||
|
||||
On backends which can't have empty directories (S3, B2 and other
|
||||
bucket-based storage) a directory only exists while it has files in it.
|
||||
Once the last file in a directory has been removed its listing is
|
||||
deleted, since the directory only existed because of it. Backends which
|
||||
can have empty directories keep a listing for each empty directory.
|
||||
|
||||
## Using with sync
|
||||
|
||||
A sync from a local build deletes files on the destination which aren't
|
||||
in the source, which includes the listings. Either index the local build
|
||||
before syncing:
|
||||
|
||||
rclone index ./public
|
||||
rclone sync ./public r2:bucket
|
||||
|
||||
or exclude the listings from the sync so it neither uploads nor deletes
|
||||
them, then index the remote:
|
||||
|
||||
rclone sync ./public r2:bucket --exclude index.html
|
||||
rclone index r2:bucket
|
||||
|
||||
## Examples
|
||||
|
||||
An S3 website bucket, using the upload times so no object needs a HEAD
|
||||
request:
|
||||
|
||||
rclone index s3:my-site --use-server-modtime
|
||||
|
||||
HTML and rclone JSON listings, setting `Cache-Control` on them:
|
||||
|
||||
rclone index s3:bucket --output index.html=html --output index.json=json --header-upload "Cache-Control: max-age=300"
|
||||
|
||||
Only list release files, and don't write listings under `/private`:
|
||||
|
||||
rclone index r2:bucket --include "*.{zip,deb,rpm}" --index-exclude "/private/**"
|
||||
|
||||
A B2 bucket served from its friendly URLs:
|
||||
|
||||
rclone index b2:bucket --link-index
|
||||
|
||||
See what would change:
|
||||
|
||||
rclone index r2:bucket --dry-run -v
|
||||
|
||||
Listings which haven't changed aren't normally rewritten, so changing
|
||||
the headers or metadata set on them needs `--index-rewrite`, which
|
||||
writes every listing a run would render whether it changed or not:
|
||||
|
||||
rclone index r2:bucket --index-rewrite --header-upload "Cache-Control: max-age=3600"
|
||||
|
||||
```
|
||||
rclone index remote:path [flags]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
```
|
||||
--changed stringArray Only re-index directories affected by this changed path (directories end in /)
|
||||
--changed-combined stringArray Read changed paths from a sync --combined report (use - to read from stdin)
|
||||
--changed-from stringArray Read changed paths from file, one per line (use - to read from stdin)
|
||||
--changed-max-dirs int Do a full index if a partial one would list more than this many directories (0 for no limit)
|
||||
--dir-time newest|dir|none How to work out the time shown for a directory (default newest)
|
||||
-h, --help help for index
|
||||
--index-exclude stringArray Don't write listings in directories matching pattern
|
||||
--index-exclude-from stringArray Read directory exclude patterns from file (use - to read from stdin)
|
||||
--index-filter stringArray Add a rule for which directories get listings
|
||||
--index-filter-from stringArray Read directory rules from a file (use - to read from stdin)
|
||||
--index-include stringArray Only write listings in directories matching pattern
|
||||
--index-include-from stringArray Read directory include patterns from file (use - to read from stdin)
|
||||
--index-max-depth int Only write listings this many directories deep (-1 for no limit) (default -1)
|
||||
--index-rewrite Write every listing even if it is unchanged
|
||||
--link-index Link to dir/NAME rather than dir/ for hosts without index documents
|
||||
--no-modtime Don't show modification times in listings
|
||||
--output stringArray Listing to write in each directory as NAME=FORMAT (default [index.html=html])
|
||||
--print-template string Print the built-in template for FORMAT and exit
|
||||
```
|
||||
|
||||
Options shared with other commands are described next.
|
||||
See the [global flags page](/flags/) for global options not listed here.
|
||||
|
||||
### Copy Options
|
||||
|
||||
Flags for anything which can copy a file
|
||||
|
||||
```text
|
||||
--check-first Do all the checks before starting transfers
|
||||
-c, --checksum Check for changes with size & checksum (if available, or fallback to size only)
|
||||
--compare-dest stringArray Include additional server-side paths during comparison
|
||||
--copy-dest stringArray Implies --compare-dest but also copies files from paths into destination
|
||||
--cutoff-mode HARD|SOFT|CAUTIOUS Mode to stop transfers when reaching the max transfer limit HARD|SOFT|CAUTIOUS (default HARD)
|
||||
--ignore-case-sync Ignore case when synchronizing
|
||||
--ignore-checksum Skip post copy check of checksums
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use modtime or checksum
|
||||
-I, --ignore-times Don't skip items that match size and time - transfer all unconditionally
|
||||
--immutable Do not modify files, fail if existing files have been modified
|
||||
--inplace Download directly to destination file instead of atomic download to temp/rename
|
||||
-l, --links Translate symlinks to/from regular files with a '.rclonelink' extension
|
||||
--max-backlog int Maximum number of objects in sync or check backlog (default 10000)
|
||||
--max-duration Duration Maximum duration rclone will transfer data for (default 0s)
|
||||
--max-transfer SizeSuffix Maximum size of data to transfer (default off)
|
||||
-M, --metadata If set, preserve metadata when copying objects
|
||||
--modify-window Duration Max time diff to be considered the same (default 1ns)
|
||||
--multi-thread-chunk-size SizeSuffix Chunk size for multi-thread downloads / uploads, if not set by filesystem (default 64Mi)
|
||||
--multi-thread-cutoff SizeSuffix Use multi-thread downloads for files above this size (default 256Mi)
|
||||
--multi-thread-streams int Number of streams to use for multi-thread downloads (default 4)
|
||||
--multi-thread-write-buffer-size SizeSuffix In memory buffer size for writing when in multi-thread mode (default 128Ki)
|
||||
--name-transform stringArray Transform paths during the copy process
|
||||
--no-check-dest Don't check the destination, copy regardless
|
||||
--no-traverse Don't traverse destination file system on copy
|
||||
--no-update-dir-modtime Don't update directory modification times
|
||||
--no-update-modtime Don't update destination modtime if files identical
|
||||
--order-by string Instructions on how to order the transfers, e.g. 'size,descending'
|
||||
--partial-suffix string Add partial-suffix to temporary file name when --inplace is not used (default ".partial")
|
||||
--refresh-times Refresh the modtime of remote files
|
||||
--server-side-across-configs Allow server-side operations (e.g. copy) to work across different configs
|
||||
--size-only Skip based on size only, not modtime or checksum
|
||||
--streaming-upload-cutoff SizeSuffix Cutoff for switching to chunked upload if file size is unknown, upload starts after reaching cutoff or when file ends (default 100Ki)
|
||||
-u, --update Skip files that are newer on the destination
|
||||
```
|
||||
|
||||
### Important Options
|
||||
|
||||
Important flags useful for most commands
|
||||
|
||||
```text
|
||||
-n, --dry-run Do a trial run with no permanent changes
|
||||
-i, --interactive Enable interactive mode
|
||||
-v, --verbose count Print lots more stuff (repeat for more)
|
||||
```
|
||||
|
||||
### Filter Options
|
||||
|
||||
Flags for filtering directory listings
|
||||
|
||||
```text
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read file exclude patterns from file (use - to read from stdin)
|
||||
--exclude-if-present stringArray Exclude directories if filename is present
|
||||
--files-from stringArray Read list of source-file names from file (use - to read from stdin)
|
||||
--files-from-raw stringArray Read list of source-file names from file without any processing of lines (use - to read from stdin)
|
||||
--files-from0 stringArray Read list of source-file names from file using NUL as separator (use - to read from stdin)
|
||||
-f, --filter stringArray Add a file filtering rule
|
||||
--filter-from stringArray Read file filtering patterns from a file (use - to read from stdin)
|
||||
--hash-filter string Partition filenames by hash k/n or randomly @/n
|
||||
--ignore-case Ignore case in filters (case insensitive)
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read file include patterns from file (use - to read from stdin)
|
||||
--max-age Duration Only transfer files younger than this in s or suffix ms|s|m|h|d|w|M|y (default off)
|
||||
--max-depth int If set limits the recursion depth to this (default -1)
|
||||
--max-size SizeSuffix Only transfer files smaller than this in KiB or suffix B|K|M|G|T|P (default off)
|
||||
--metadata-exclude stringArray Exclude metadatas matching pattern
|
||||
--metadata-exclude-from stringArray Read metadata exclude patterns from file (use - to read from stdin)
|
||||
--metadata-filter stringArray Add a metadata filtering rule
|
||||
--metadata-filter-from stringArray Read metadata filtering patterns from a file (use - to read from stdin)
|
||||
--metadata-include stringArray Include metadatas matching pattern
|
||||
--metadata-include-from stringArray Read metadata include patterns from file (use - to read from stdin)
|
||||
--min-age Duration Only transfer files older than this in s or suffix ms|s|m|h|d|w|M|y (default off)
|
||||
--min-size SizeSuffix Only transfer files bigger than this in KiB or suffix B|K|M|G|T|P (default off)
|
||||
```
|
||||
|
||||
### Listing Options
|
||||
|
||||
Flags for listing directories
|
||||
|
||||
```text
|
||||
--default-time Time Time to show if modtime is unknown for files and directories (default 2000-01-01T00:00:00Z)
|
||||
--fast-list Use recursive list if available; uses more memory but fewer transactions
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
<!-- markdownlint-capture -->
|
||||
<!-- markdownlint-disable ul-style line-length -->
|
||||
|
||||
* [rclone](/commands/rclone/) - Show help for rclone commands, flags and backends.
|
||||
|
||||
|
||||
<!-- markdownlint-restore -->
|
||||
@@ -41,6 +41,10 @@ Note that `ls` and `lsl` recurse by default - use `--max-depth 1` to stop the re
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default -
|
||||
use `-R` to make them recurse.
|
||||
|
||||
On the bucket-based remotes (e.g. s3, gcs, b2) a directory is a key prefix
|
||||
rather than an object, so a listing without `-R` shows each prefix as one
|
||||
directory entry and not the objects stored under it.
|
||||
|
||||
List commands prefer a recursive method that uses more memory but fewer
|
||||
transactions by default. Use `--disable ListR` to suppress the behavior.
|
||||
See [`--fast-list`](/docs/#fast-list) for more details.
|
||||
|
||||
@@ -13,7 +13,7 @@ Lists the directories in the source path to standard output. Does not
|
||||
recurse by default. Use the `-R` flag to recurse.
|
||||
|
||||
This command lists the total size of the directory (if known, -1 if
|
||||
not), the modification time (if known, the current time if not), the
|
||||
not), the modification time (if known, the `--default-time` if not), the
|
||||
number of objects in the directory (if known, -1 if not) and the name
|
||||
of the directory, E.g.
|
||||
|
||||
@@ -53,6 +53,10 @@ Note that `ls` and `lsl` recurse by default - use `--max-depth 1` to stop the re
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default -
|
||||
use `-R` to make them recurse.
|
||||
|
||||
On the bucket-based remotes (e.g. s3, gcs, b2) a directory is a key prefix
|
||||
rather than an object, so a listing without `-R` shows each prefix as one
|
||||
directory entry and not the objects stored under it.
|
||||
|
||||
List commands prefer a recursive method that uses more memory but fewer
|
||||
transactions by default. Use `--disable ListR` to suppress the behavior.
|
||||
See [`--fast-list`](/docs/#fast-list) for more details.
|
||||
|
||||
@@ -164,6 +164,10 @@ Note that `ls` and `lsl` recurse by default - use `--max-depth 1` to stop the re
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default -
|
||||
use `-R` to make them recurse.
|
||||
|
||||
On the bucket-based remotes (e.g. s3, gcs, b2) a directory is a key prefix
|
||||
rather than an object, so a listing without `-R` shows each prefix as one
|
||||
directory entry and not the objects stored under it.
|
||||
|
||||
List commands prefer a recursive method that uses more memory but fewer
|
||||
transactions by default. Use `--disable ListR` to suppress the behavior.
|
||||
See [`--fast-list`](/docs/#fast-list) for more details.
|
||||
|
||||
@@ -111,6 +111,10 @@ Note that `ls` and `lsl` recurse by default - use `--max-depth 1` to stop the re
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default -
|
||||
use `-R` to make them recurse.
|
||||
|
||||
On the bucket-based remotes (e.g. s3, gcs, b2) a directory is a key prefix
|
||||
rather than an object, so a listing without `-R` shows each prefix as one
|
||||
directory entry and not the objects stored under it.
|
||||
|
||||
List commands prefer a recursive method that uses more memory but fewer
|
||||
transactions by default. Use `--disable ListR` to suppress the behavior.
|
||||
See [`--fast-list`](/docs/#fast-list) for more details.
|
||||
|
||||
@@ -42,6 +42,10 @@ Note that `ls` and `lsl` recurse by default - use `--max-depth 1` to stop the re
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default -
|
||||
use `-R` to make them recurse.
|
||||
|
||||
On the bucket-based remotes (e.g. s3, gcs, b2) a directory is a key prefix
|
||||
rather than an object, so a listing without `-R` shows each prefix as one
|
||||
directory entry and not the objects stored under it.
|
||||
|
||||
List commands prefer a recursive method that uses more memory but fewer
|
||||
transactions by default. Use `--disable ListR` to suppress the behavior.
|
||||
See [`--fast-list`](/docs/#fast-list) for more details.
|
||||
|
||||
@@ -292,6 +292,11 @@ for all `mount` and `serve` commands on macOS. For details, see [vfs-case-sensit
|
||||
|
||||
### NFS mount
|
||||
|
||||
For macOS (and other platforms where this path is supported), prefer the dedicated
|
||||
[rclone nfsmount](/commands/rclone_nfsmount/) command. It starts the NFS server and
|
||||
performs the mount for you. `rclone mount` itself still uses FUSE (macFUSE/FUSE-T)
|
||||
and does not switch to NFS via a flag.
|
||||
|
||||
This method spins up an NFS server using [serve nfs](/commands/rclone_serve_nfs/)
|
||||
command and mounts it to the specified mountpoint. If you run this in background
|
||||
mode using |--daemon|, you will need to send SIGTERM signal to the rclone process
|
||||
@@ -629,7 +634,7 @@ at all times. The buffered data is bound to one open file and won't be
|
||||
shared.
|
||||
|
||||
This flag is a upper limit for the used memory per open file. The
|
||||
buffer will only use memory for data that is downloaded but not not
|
||||
buffer will only use memory for data that is downloaded but not
|
||||
yet read. If the buffer is empty, only a small amount of memory will
|
||||
be used.
|
||||
|
||||
@@ -684,7 +689,8 @@ longest. This cache flushing strategy is efficient and more relevant
|
||||
files are likely to remain cached.
|
||||
|
||||
The `--vfs-cache-max-age` will evict files from the cache
|
||||
after the set time since last access has passed. The default value of
|
||||
after the set time since last access has passed; it is based on access time,
|
||||
not on when the file was first added to the cache. The default value of
|
||||
1 hour will start evicting files from cache that haven't been accessed
|
||||
for 1 hour. When a cached file is accessed the 1 hour timer is reset to 0
|
||||
and will wait for 1 more hour before evicting. Specify the time with
|
||||
@@ -838,7 +844,7 @@ Rclone reads `--vfs-read-chunk-streams` chunks of size
|
||||
`--vfs-read-chunk-size` concurrently. The size for each read will stay
|
||||
constant.
|
||||
|
||||
This improves performance performance massively on high latency links
|
||||
This improves performance massively on high latency links
|
||||
or very high bandwidth links to high performance object stores.
|
||||
|
||||
Some experimentation will be needed to find the optimum values of
|
||||
|
||||
@@ -293,6 +293,11 @@ for all `mount` and `serve` commands on macOS. For details, see [vfs-case-sensit
|
||||
|
||||
### NFS mount
|
||||
|
||||
For macOS (and other platforms where this path is supported), prefer the dedicated
|
||||
[rclone nfsmount](/commands/rclone_nfsmount/) command. It starts the NFS server and
|
||||
performs the mount for you. `rclone mount` itself still uses FUSE (macFUSE/FUSE-T)
|
||||
and does not switch to NFS via a flag.
|
||||
|
||||
This method spins up an NFS server using [serve nfs](/commands/rclone_serve_nfs/)
|
||||
command and mounts it to the specified mountpoint. If you run this in background
|
||||
mode using |--daemon|, you will need to send SIGTERM signal to the rclone process
|
||||
@@ -630,7 +635,7 @@ at all times. The buffered data is bound to one open file and won't be
|
||||
shared.
|
||||
|
||||
This flag is a upper limit for the used memory per open file. The
|
||||
buffer will only use memory for data that is downloaded but not not
|
||||
buffer will only use memory for data that is downloaded but not
|
||||
yet read. If the buffer is empty, only a small amount of memory will
|
||||
be used.
|
||||
|
||||
@@ -685,7 +690,8 @@ longest. This cache flushing strategy is efficient and more relevant
|
||||
files are likely to remain cached.
|
||||
|
||||
The `--vfs-cache-max-age` will evict files from the cache
|
||||
after the set time since last access has passed. The default value of
|
||||
after the set time since last access has passed; it is based on access time,
|
||||
not on when the file was first added to the cache. The default value of
|
||||
1 hour will start evicting files from cache that haven't been accessed
|
||||
for 1 hour. When a cached file is accessed the 1 hour timer is reset to 0
|
||||
and will wait for 1 more hour before evicting. Specify the time with
|
||||
@@ -839,7 +845,7 @@ Rclone reads `--vfs-read-chunk-streams` chunks of size
|
||||
`--vfs-read-chunk-size` concurrently. The size for each read will stay
|
||||
constant.
|
||||
|
||||
This improves performance performance massively on high latency links
|
||||
This improves performance massively on high latency links
|
||||
or very high bandwidth links to high performance object stores.
|
||||
|
||||
Some experimentation will be needed to find the optimum values of
|
||||
|
||||
@@ -47,6 +47,13 @@ accept in the HTTP header.
|
||||
will overriding existing values. The flag may be repeated to add multiple
|
||||
headers. Use the format `Header-Name: value`.
|
||||
|
||||
`--rc-allow-origin` enables cross-origin (CORS) requests from browsers
|
||||
by setting the `Access-Control-Allow-Origin` header on every response to the
|
||||
origin given, e.g. `--rc-allow-origin https://app.example.com`. Browser
|
||||
CORS preflight OPTIONS requests are answered by rclone without needing
|
||||
authentication as browsers never send credentials with them. Setting this
|
||||
to `*` allows any origin which is a security risk on an authenticated server.
|
||||
|
||||
`--rc-baseurl` controls the URL prefix that rclone serves from. By default
|
||||
rclone will serve from the root. If you used `--rc-baseurl "/rclone"` then
|
||||
rclone would serve from a URL starting with "/rclone/". This is
|
||||
@@ -116,6 +123,13 @@ to be used within the template to server pages:
|
||||
| .Sort | | The current sort used. This is changeable via '?sort=' parameter. Possible values: namedirfirst, name, size, time (default namedirfirst). |
|
||||
| .Order | | The current ordering used. This is changeable via '?order=' parameter. Possible values: asc, desc (default asc). |
|
||||
| .Query | | Currently unused. |
|
||||
| .Path | | The path of the directory from the root with leading and trailing slashes, e.g. '/dir/'. |
|
||||
| .IsRoot | | Boolean for if this is the root directory. |
|
||||
| .UpLink | | The link to the parent directory. |
|
||||
| .Static | | Boolean for if the listing is being written as a static page by rclone index. |
|
||||
| .NumDirs | | The number of directories in the listing. |
|
||||
| .NumFiles | | The number of files in the listing. |
|
||||
| .TotalSize | | The total size in bytes of the files in the listing. |
|
||||
| .Breadcrumb | | Allows for creating a relative navigation. |
|
||||
| | .Link | The link of the Text relative to the root. |
|
||||
| | .Text | The Name of the directory. |
|
||||
@@ -125,6 +139,7 @@ to be used within the template to server pages:
|
||||
| | .IsDir | Boolean for if an entry is a directory or not. |
|
||||
| | .Size | Size in bytes of the entry. |
|
||||
| | .ModTime | The UTC timestamp of an entry. |
|
||||
| | .MimeType | The MIME type of an entry guessed from its name, or 'inode/directory'. |
|
||||
|
||||
The server also makes the following functions available so that they can be used
|
||||
within the template. These functions help extend the options for dynamic
|
||||
@@ -165,8 +180,20 @@ htpasswd -B htpasswd user
|
||||
htpasswd -B htpasswd anotherUser
|
||||
```
|
||||
|
||||
Use the same hash format and cost for every entry in the file. If the
|
||||
entries differ, the time taken to reject a wrong password can reveal
|
||||
which usernames exist.
|
||||
|
||||
The password file can be updated while rclone is running.
|
||||
|
||||
When authentication is enabled every request must be authenticated,
|
||||
including HTTP OPTIONS requests, as the answer to an OPTIONS request can
|
||||
reveal whether a path exists. Health checks or monitoring which use
|
||||
unauthenticated OPTIONS requests will need to send credentials. The
|
||||
exception is browser CORS preflight requests when `--rc-allow-origin`
|
||||
is set, which are answered without authentication as browsers never send
|
||||
credentials with them.
|
||||
|
||||
Use `--rc-realm` to set the authentication realm.
|
||||
|
||||
Use `--rc-salt` to change the password hashing salt from the default.
|
||||
@@ -215,11 +242,6 @@ Flags to control the Remote Control API
|
||||
--rc-template string User-specified template
|
||||
--rc-user string User name for authentication
|
||||
--rc-user-from-header string User name from a defined HTTP header
|
||||
--rc-web-fetch-url string URL to fetch the releases for webgui (default "https://api.github.com/repos/rclone/rclone-webui-react/releases/latest")
|
||||
--rc-web-gui Launch WebGUI on localhost
|
||||
--rc-web-gui-force-update Force update to latest version of web gui
|
||||
--rc-web-gui-no-open-browser Don't open the browser automatically
|
||||
--rc-web-gui-update Check and update to latest version of web gui
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
@@ -100,7 +100,7 @@ at all times. The buffered data is bound to one open file and won't be
|
||||
shared.
|
||||
|
||||
This flag is a upper limit for the used memory per open file. The
|
||||
buffer will only use memory for data that is downloaded but not not
|
||||
buffer will only use memory for data that is downloaded but not
|
||||
yet read. If the buffer is empty, only a small amount of memory will
|
||||
be used.
|
||||
|
||||
@@ -155,7 +155,8 @@ longest. This cache flushing strategy is efficient and more relevant
|
||||
files are likely to remain cached.
|
||||
|
||||
The `--vfs-cache-max-age` will evict files from the cache
|
||||
after the set time since last access has passed. The default value of
|
||||
after the set time since last access has passed; it is based on access time,
|
||||
not on when the file was first added to the cache. The default value of
|
||||
1 hour will start evicting files from cache that haven't been accessed
|
||||
for 1 hour. When a cached file is accessed the 1 hour timer is reset to 0
|
||||
and will wait for 1 more hour before evicting. Specify the time with
|
||||
@@ -309,7 +310,7 @@ Rclone reads `--vfs-read-chunk-streams` chunks of size
|
||||
`--vfs-read-chunk-size` concurrently. The size for each read will stay
|
||||
constant.
|
||||
|
||||
This improves performance performance massively on high latency links
|
||||
This improves performance massively on high latency links
|
||||
or very high bandwidth links to high performance object stores.
|
||||
|
||||
Some experimentation will be needed to find the optimum values of
|
||||
|
||||
@@ -162,7 +162,7 @@ at all times. The buffered data is bound to one open file and won't be
|
||||
shared.
|
||||
|
||||
This flag is a upper limit for the used memory per open file. The
|
||||
buffer will only use memory for data that is downloaded but not not
|
||||
buffer will only use memory for data that is downloaded but not
|
||||
yet read. If the buffer is empty, only a small amount of memory will
|
||||
be used.
|
||||
|
||||
@@ -217,7 +217,8 @@ longest. This cache flushing strategy is efficient and more relevant
|
||||
files are likely to remain cached.
|
||||
|
||||
The `--vfs-cache-max-age` will evict files from the cache
|
||||
after the set time since last access has passed. The default value of
|
||||
after the set time since last access has passed; it is based on access time,
|
||||
not on when the file was first added to the cache. The default value of
|
||||
1 hour will start evicting files from cache that haven't been accessed
|
||||
for 1 hour. When a cached file is accessed the 1 hour timer is reset to 0
|
||||
and will wait for 1 more hour before evicting. Specify the time with
|
||||
@@ -371,7 +372,7 @@ Rclone reads `--vfs-read-chunk-streams` chunks of size
|
||||
`--vfs-read-chunk-size` concurrently. The size for each read will stay
|
||||
constant.
|
||||
|
||||
This improves performance performance massively on high latency links
|
||||
This improves performance massively on high latency links
|
||||
or very high bandwidth links to high performance object stores.
|
||||
|
||||
Some experimentation will be needed to find the optimum values of
|
||||
|
||||
@@ -93,7 +93,7 @@ at all times. The buffered data is bound to one open file and won't be
|
||||
shared.
|
||||
|
||||
This flag is a upper limit for the used memory per open file. The
|
||||
buffer will only use memory for data that is downloaded but not not
|
||||
buffer will only use memory for data that is downloaded but not
|
||||
yet read. If the buffer is empty, only a small amount of memory will
|
||||
be used.
|
||||
|
||||
@@ -148,7 +148,8 @@ longest. This cache flushing strategy is efficient and more relevant
|
||||
files are likely to remain cached.
|
||||
|
||||
The `--vfs-cache-max-age` will evict files from the cache
|
||||
after the set time since last access has passed. The default value of
|
||||
after the set time since last access has passed; it is based on access time,
|
||||
not on when the file was first added to the cache. The default value of
|
||||
1 hour will start evicting files from cache that haven't been accessed
|
||||
for 1 hour. When a cached file is accessed the 1 hour timer is reset to 0
|
||||
and will wait for 1 more hour before evicting. Specify the time with
|
||||
@@ -302,7 +303,7 @@ Rclone reads `--vfs-read-chunk-streams` chunks of size
|
||||
`--vfs-read-chunk-size` concurrently. The size for each read will stay
|
||||
constant.
|
||||
|
||||
This improves performance performance massively on high latency links
|
||||
This improves performance massively on high latency links
|
||||
or very high bandwidth links to high performance object stores.
|
||||
|
||||
Some experimentation will be needed to find the optimum values of
|
||||
@@ -545,9 +546,10 @@ This config generated must have this extra parameter
|
||||
|
||||
- `_root` - root to use for the backend
|
||||
|
||||
And it may have this parameter
|
||||
And it may have these parameters
|
||||
|
||||
- `_obscure` - comma separated strings for parameters to obscure
|
||||
- `_secret_access_key` - the secret for S3 access key auth (see below)
|
||||
|
||||
If password authentication was used by the client, input to the proxy
|
||||
process (on STDIN) would look similar to this:
|
||||
@@ -555,7 +557,8 @@ process (on STDIN) would look similar to this:
|
||||
```json
|
||||
{
|
||||
"user": "me",
|
||||
"pass": "mypassword"
|
||||
"pass": "mypassword",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -565,10 +568,44 @@ proxy process (on STDIN) would look similar to this:
|
||||
```json
|
||||
{
|
||||
"user": "me",
|
||||
"public_key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDuwESFdAe14hVS6omeyX7edc...JQdf"
|
||||
"public_key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDuwESFdAe14hVS6omeyX7edc...JQdf",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
If the client authenticated with an S3 access key (`rclone serve s3`),
|
||||
the client never sends its secret, only a signature made with it, so
|
||||
the input contains just the access key ID as the `user` with no `pass`
|
||||
or `public_key`:
|
||||
|
||||
```json
|
||||
{
|
||||
"user": "AKIAIOSFODNN7EXAMPLE",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
In this case the program must look up the secret access key for that
|
||||
access key ID and return it in the `_secret_access_key` field of the
|
||||
output. Rclone then uses that secret to verify the signature on the
|
||||
request, refusing the request if it does not match. This means the
|
||||
proxy program is the source of truth for both the credentials and the
|
||||
backend they map to. If the program does not return
|
||||
`_secret_access_key` or returns it empty the request is refused.
|
||||
|
||||
The program's answer for an access key ID is cached (see below) but
|
||||
is checked with the program again after 5 minutes even if the access
|
||||
key ID is in constant use, so revoking an access key ID in the
|
||||
program takes effect within 5 minutes. A rotated secret takes effect
|
||||
on the first request signed with it.
|
||||
|
||||
The `client_ip` key holds the IP address the client connected from,
|
||||
without a port number. It can be used to restrict logins to certain
|
||||
networks, or to log authentication attempts centrally. It is omitted if
|
||||
the client has no IP address, for example when connecting over a unix
|
||||
socket. Note that if rclone is behind a reverse proxy this will be the
|
||||
address of the reverse proxy and not the original client.
|
||||
|
||||
And as an example return this on STDOUT
|
||||
|
||||
```json
|
||||
@@ -594,11 +631,20 @@ to make proxy to many different sftp backends, you could make the
|
||||
in the output and the user to `user`. For security you'd probably want
|
||||
to restrict the `host` to a limited list.
|
||||
|
||||
An internal cache of backends is keyed on the `user` and a hash of the
|
||||
`pass` or `public_key`. This means that if a user's password or
|
||||
public-key changes, or the proxy returns different config parameters
|
||||
(eg a rotated `api_key`), a fresh backend will be created on the next
|
||||
request rather than the cached one being reused.
|
||||
An internal cache of backends is keyed on the `user`, the kind of
|
||||
credential presented, a hash of the `pass` or `public_key`, and the
|
||||
`client_ip`. This means that if a user's password or public-key
|
||||
changes, the client connects from a new IP address, or the proxy
|
||||
returns different config parameters (eg a rotated `api_key`), a fresh
|
||||
backend will be created on the next request rather than the cached one
|
||||
being reused. A backend created for a public key login is never
|
||||
reused for a password login, so a public key cannot be sent as a
|
||||
password to skip the program.
|
||||
|
||||
A cached answer is checked with the program again after 5 minutes even
|
||||
if the user is in constant use, so revoking a user in the program
|
||||
takes effect within 5 minutes. For `serve sftp` this applies to new
|
||||
logins - an existing connection is not closed.
|
||||
|
||||
This can be used to build general purpose proxies to any kind of
|
||||
backend that rclone supports.
|
||||
|
||||
@@ -49,6 +49,13 @@ accept in the HTTP header.
|
||||
will overriding existing values. The flag may be repeated to add multiple
|
||||
headers. Use the format `Header-Name: value`.
|
||||
|
||||
`--allow-origin` enables cross-origin (CORS) requests from browsers
|
||||
by setting the `Access-Control-Allow-Origin` header on every response to the
|
||||
origin given, e.g. `--allow-origin https://app.example.com`. Browser
|
||||
CORS preflight OPTIONS requests are answered by rclone without needing
|
||||
authentication as browsers never send credentials with them. Setting this
|
||||
to `*` allows any origin which is a security risk on an authenticated server.
|
||||
|
||||
`--baseurl` controls the URL prefix that rclone serves from. By default
|
||||
rclone will serve from the root. If you used `--baseurl "/rclone"` then
|
||||
rclone would serve from a URL starting with "/rclone/". This is
|
||||
@@ -118,6 +125,13 @@ to be used within the template to server pages:
|
||||
| .Sort | | The current sort used. This is changeable via '?sort=' parameter. Possible values: namedirfirst, name, size, time (default namedirfirst). |
|
||||
| .Order | | The current ordering used. This is changeable via '?order=' parameter. Possible values: asc, desc (default asc). |
|
||||
| .Query | | Currently unused. |
|
||||
| .Path | | The path of the directory from the root with leading and trailing slashes, e.g. '/dir/'. |
|
||||
| .IsRoot | | Boolean for if this is the root directory. |
|
||||
| .UpLink | | The link to the parent directory. |
|
||||
| .Static | | Boolean for if the listing is being written as a static page by rclone index. |
|
||||
| .NumDirs | | The number of directories in the listing. |
|
||||
| .NumFiles | | The number of files in the listing. |
|
||||
| .TotalSize | | The total size in bytes of the files in the listing. |
|
||||
| .Breadcrumb | | Allows for creating a relative navigation. |
|
||||
| | .Link | The link of the Text relative to the root. |
|
||||
| | .Text | The Name of the directory. |
|
||||
@@ -127,6 +141,7 @@ to be used within the template to server pages:
|
||||
| | .IsDir | Boolean for if an entry is a directory or not. |
|
||||
| | .Size | Size in bytes of the entry. |
|
||||
| | .ModTime | The UTC timestamp of an entry. |
|
||||
| | .MimeType | The MIME type of an entry guessed from its name, or 'inode/directory'. |
|
||||
|
||||
The server also makes the following functions available so that they can be used
|
||||
within the template. These functions help extend the options for dynamic
|
||||
@@ -167,8 +182,20 @@ htpasswd -B htpasswd user
|
||||
htpasswd -B htpasswd anotherUser
|
||||
```
|
||||
|
||||
Use the same hash format and cost for every entry in the file. If the
|
||||
entries differ, the time taken to reject a wrong password can reveal
|
||||
which usernames exist.
|
||||
|
||||
The password file can be updated while rclone is running.
|
||||
|
||||
When authentication is enabled every request must be authenticated,
|
||||
including HTTP OPTIONS requests, as the answer to an OPTIONS request can
|
||||
reveal whether a path exists. Health checks or monitoring which use
|
||||
unauthenticated OPTIONS requests will need to send credentials. The
|
||||
exception is browser CORS preflight requests when `--allow-origin`
|
||||
is set, which are answered without authentication as browsers never send
|
||||
credentials with them.
|
||||
|
||||
Use `--realm` to set the authentication realm.
|
||||
|
||||
Use `--salt` to change the password hashing salt from the default.
|
||||
@@ -236,7 +263,7 @@ at all times. The buffered data is bound to one open file and won't be
|
||||
shared.
|
||||
|
||||
This flag is a upper limit for the used memory per open file. The
|
||||
buffer will only use memory for data that is downloaded but not not
|
||||
buffer will only use memory for data that is downloaded but not
|
||||
yet read. If the buffer is empty, only a small amount of memory will
|
||||
be used.
|
||||
|
||||
@@ -291,7 +318,8 @@ longest. This cache flushing strategy is efficient and more relevant
|
||||
files are likely to remain cached.
|
||||
|
||||
The `--vfs-cache-max-age` will evict files from the cache
|
||||
after the set time since last access has passed. The default value of
|
||||
after the set time since last access has passed; it is based on access time,
|
||||
not on when the file was first added to the cache. The default value of
|
||||
1 hour will start evicting files from cache that haven't been accessed
|
||||
for 1 hour. When a cached file is accessed the 1 hour timer is reset to 0
|
||||
and will wait for 1 more hour before evicting. Specify the time with
|
||||
@@ -445,7 +473,7 @@ Rclone reads `--vfs-read-chunk-streams` chunks of size
|
||||
`--vfs-read-chunk-size` concurrently. The size for each read will stay
|
||||
constant.
|
||||
|
||||
This improves performance performance massively on high latency links
|
||||
This improves performance massively on high latency links
|
||||
or very high bandwidth links to high performance object stores.
|
||||
|
||||
Some experimentation will be needed to find the optimum values of
|
||||
@@ -688,9 +716,10 @@ This config generated must have this extra parameter
|
||||
|
||||
- `_root` - root to use for the backend
|
||||
|
||||
And it may have this parameter
|
||||
And it may have these parameters
|
||||
|
||||
- `_obscure` - comma separated strings for parameters to obscure
|
||||
- `_secret_access_key` - the secret for S3 access key auth (see below)
|
||||
|
||||
If password authentication was used by the client, input to the proxy
|
||||
process (on STDIN) would look similar to this:
|
||||
@@ -698,7 +727,8 @@ process (on STDIN) would look similar to this:
|
||||
```json
|
||||
{
|
||||
"user": "me",
|
||||
"pass": "mypassword"
|
||||
"pass": "mypassword",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -708,10 +738,44 @@ proxy process (on STDIN) would look similar to this:
|
||||
```json
|
||||
{
|
||||
"user": "me",
|
||||
"public_key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDuwESFdAe14hVS6omeyX7edc...JQdf"
|
||||
"public_key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDuwESFdAe14hVS6omeyX7edc...JQdf",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
If the client authenticated with an S3 access key (`rclone serve s3`),
|
||||
the client never sends its secret, only a signature made with it, so
|
||||
the input contains just the access key ID as the `user` with no `pass`
|
||||
or `public_key`:
|
||||
|
||||
```json
|
||||
{
|
||||
"user": "AKIAIOSFODNN7EXAMPLE",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
In this case the program must look up the secret access key for that
|
||||
access key ID and return it in the `_secret_access_key` field of the
|
||||
output. Rclone then uses that secret to verify the signature on the
|
||||
request, refusing the request if it does not match. This means the
|
||||
proxy program is the source of truth for both the credentials and the
|
||||
backend they map to. If the program does not return
|
||||
`_secret_access_key` or returns it empty the request is refused.
|
||||
|
||||
The program's answer for an access key ID is cached (see below) but
|
||||
is checked with the program again after 5 minutes even if the access
|
||||
key ID is in constant use, so revoking an access key ID in the
|
||||
program takes effect within 5 minutes. A rotated secret takes effect
|
||||
on the first request signed with it.
|
||||
|
||||
The `client_ip` key holds the IP address the client connected from,
|
||||
without a port number. It can be used to restrict logins to certain
|
||||
networks, or to log authentication attempts centrally. It is omitted if
|
||||
the client has no IP address, for example when connecting over a unix
|
||||
socket. Note that if rclone is behind a reverse proxy this will be the
|
||||
address of the reverse proxy and not the original client.
|
||||
|
||||
And as an example return this on STDOUT
|
||||
|
||||
```json
|
||||
@@ -737,11 +801,20 @@ to make proxy to many different sftp backends, you could make the
|
||||
in the output and the user to `user`. For security you'd probably want
|
||||
to restrict the `host` to a limited list.
|
||||
|
||||
An internal cache of backends is keyed on the `user` and a hash of the
|
||||
`pass` or `public_key`. This means that if a user's password or
|
||||
public-key changes, or the proxy returns different config parameters
|
||||
(eg a rotated `api_key`), a fresh backend will be created on the next
|
||||
request rather than the cached one being reused.
|
||||
An internal cache of backends is keyed on the `user`, the kind of
|
||||
credential presented, a hash of the `pass` or `public_key`, and the
|
||||
`client_ip`. This means that if a user's password or public-key
|
||||
changes, the client connects from a new IP address, or the proxy
|
||||
returns different config parameters (eg a rotated `api_key`), a fresh
|
||||
backend will be created on the next request rather than the cached one
|
||||
being reused. A backend created for a public key login is never
|
||||
reused for a password login, so a public key cannot be sent as a
|
||||
password to skip the program.
|
||||
|
||||
A cached answer is checked with the program again after 5 minutes even
|
||||
if the user is in constant use, so revoking a user in the program
|
||||
takes effect within 5 minutes. For `serve sftp` this applies to new
|
||||
logins - an existing connection is not closed.
|
||||
|
||||
This can be used to build general purpose proxies to any kind of
|
||||
backend that rclone supports.
|
||||
|
||||
@@ -167,7 +167,7 @@ at all times. The buffered data is bound to one open file and won't be
|
||||
shared.
|
||||
|
||||
This flag is a upper limit for the used memory per open file. The
|
||||
buffer will only use memory for data that is downloaded but not not
|
||||
buffer will only use memory for data that is downloaded but not
|
||||
yet read. If the buffer is empty, only a small amount of memory will
|
||||
be used.
|
||||
|
||||
@@ -222,7 +222,8 @@ longest. This cache flushing strategy is efficient and more relevant
|
||||
files are likely to remain cached.
|
||||
|
||||
The `--vfs-cache-max-age` will evict files from the cache
|
||||
after the set time since last access has passed. The default value of
|
||||
after the set time since last access has passed; it is based on access time,
|
||||
not on when the file was first added to the cache. The default value of
|
||||
1 hour will start evicting files from cache that haven't been accessed
|
||||
for 1 hour. When a cached file is accessed the 1 hour timer is reset to 0
|
||||
and will wait for 1 more hour before evicting. Specify the time with
|
||||
@@ -376,7 +377,7 @@ Rclone reads `--vfs-read-chunk-streams` chunks of size
|
||||
`--vfs-read-chunk-size` concurrently. The size for each read will stay
|
||||
constant.
|
||||
|
||||
This improves performance performance massively on high latency links
|
||||
This improves performance massively on high latency links
|
||||
or very high bandwidth links to high performance object stores.
|
||||
|
||||
Some experimentation will be needed to find the optimum values of
|
||||
|
||||
@@ -126,6 +126,13 @@ accept in the HTTP header.
|
||||
will overriding existing values. The flag may be repeated to add multiple
|
||||
headers. Use the format `Header-Name: value`.
|
||||
|
||||
`--allow-origin` enables cross-origin (CORS) requests from browsers
|
||||
by setting the `Access-Control-Allow-Origin` header on every response to the
|
||||
origin given, e.g. `--allow-origin https://app.example.com`. Browser
|
||||
CORS preflight OPTIONS requests are answered by rclone without needing
|
||||
authentication as browsers never send credentials with them. Setting this
|
||||
to `*` allows any origin which is a security risk on an authenticated server.
|
||||
|
||||
`--baseurl` controls the URL prefix that rclone serves from. By default
|
||||
rclone will serve from the root. If you used `--baseurl "/rclone"` then
|
||||
rclone would serve from a URL starting with "/rclone/". This is
|
||||
@@ -210,8 +217,20 @@ htpasswd -B htpasswd user
|
||||
htpasswd -B htpasswd anotherUser
|
||||
```
|
||||
|
||||
Use the same hash format and cost for every entry in the file. If the
|
||||
entries differ, the time taken to reject a wrong password can reveal
|
||||
which usernames exist.
|
||||
|
||||
The password file can be updated while rclone is running.
|
||||
|
||||
When authentication is enabled every request must be authenticated,
|
||||
including HTTP OPTIONS requests, as the answer to an OPTIONS request can
|
||||
reveal whether a path exists. Health checks or monitoring which use
|
||||
unauthenticated OPTIONS requests will need to send credentials. The
|
||||
exception is browser CORS preflight requests when `--allow-origin`
|
||||
is set, which are answered without authentication as browsers never send
|
||||
credentials with them.
|
||||
|
||||
Use `--realm` to set the authentication realm.
|
||||
|
||||
Use `--salt` to change the password hashing salt from the default.
|
||||
|
||||
@@ -26,6 +26,21 @@ docs](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html)).
|
||||
`--auth-key` is not provided then `serve s3` will allow anonymous
|
||||
access.
|
||||
|
||||
Alternatively `--auth-proxy` can be used to look up the secret for each
|
||||
access key ID and choose the backend it maps to (see [Auth
|
||||
Proxy](#auth-proxy) below). When an auth proxy is in use `--auth-key`
|
||||
is ignored and every request must be signed with the secret the proxy
|
||||
returns for its access key ID. Each access key ID is a separate user,
|
||||
whose multipart uploads and object metadata are private to it, even if
|
||||
the proxy maps several access key IDs to the same backend.
|
||||
|
||||
As on AWS, every `x-amz-*` header in an authenticated request must be
|
||||
in its signed headers list; a request with an unsigned `x-amz-*`
|
||||
header is refused with `AccessDenied`. S3 clients sign these headers
|
||||
as a matter of course, but a header added after signing (for example
|
||||
by a proxy in front of the server, or `x-amz-meta-*` headers sent
|
||||
with a presigned URL which only signs the host) is refused.
|
||||
|
||||
Like all rclone flags `--auth-key` can be set via environment
|
||||
variables, in this case `RCLONE_AUTH_KEY`. Since this flag can be
|
||||
repeated, the input to `RCLONE_AUTH_KEY` is CSV encoded. Because the
|
||||
@@ -60,6 +75,14 @@ part of the hostname (such as mybucket.local)
|
||||
Use `--etag-hash` if you want to change the hash uses for the `ETag`.
|
||||
Note that using anything other than `MD5` (the default) is likely to
|
||||
cause problems for S3 clients which rely on the Etag being the MD5.
|
||||
Use `--etag-hash auto` to use the best hash the backend supports - with
|
||||
`--auth-proxy` that of each user's backend.
|
||||
|
||||
The `ETag` of an object made by a multipart upload is its hash, like
|
||||
any other object, rather than the `-N` suffixed `ETag` AWS S3 gives
|
||||
these. If the remote doesn't have the MD5 of objects, `HeadObject`
|
||||
and listings only return the MD5 of objects uploaded through `serve
|
||||
s3` while the object's metadata is kept (see below).
|
||||
|
||||
## Quickstart
|
||||
|
||||
@@ -101,29 +124,78 @@ access_key_id = ACCESS_KEY_ID
|
||||
secret_access_key = SECRET_ACCESS_KEY
|
||||
```
|
||||
|
||||
## Object uploads (PUT)
|
||||
|
||||
A `PutObject` upload only ever changes the object at its key atomically, on
|
||||
success, a failed or interrupted PUT neither removes nor overwrites the
|
||||
object already stored at the key, and never leaves a partial object visible
|
||||
at it.
|
||||
|
||||
Remotes that upload atomically (e.g. object stores such as `s3`) are streamed
|
||||
straight to the destination. On remotes where a partial upload would
|
||||
otherwise be visible (e.g. `local`), and whenever `--vfs-cache-mode` is
|
||||
`writes` or above, the upload is written to a temporary object that is
|
||||
renamed into place on success; these remotes need to support a server-side
|
||||
move or copy for this (nearly all do - without move or copy the upload is
|
||||
written directly and a failed PUT may leave a partial object at the key). If
|
||||
`serve s3` is killed part-way through an upload the temporary object (named
|
||||
with a leading `.rclone_temp_put_`) may be left behind; it is hidden from
|
||||
S3 listings but must be removed manually.
|
||||
|
||||
## Multipart uploads
|
||||
|
||||
By default `serve s3` **streams** each multipart upload, in part-number
|
||||
order, into a single `PutStream` upload to the underlying remote, so the
|
||||
whole file is never buffered in memory - memory use stays bounded by the
|
||||
parts in flight. The remote then performs its own internal upload (for
|
||||
example its own multipart upload, still with bounded memory). This works
|
||||
for any remote that supports `PutStream`, which is nearly all of them,
|
||||
including through `crypt`.
|
||||
|
||||
The upload is atomic so the destination object only ever changes on a
|
||||
Multipart uploads are written, in part-number order, to a temporary
|
||||
object which is renamed into place, server-side, on completion, so the
|
||||
upload is atomic. The object at the key only ever changes on a
|
||||
successful completion. A failed or aborted upload never affects any
|
||||
object already stored under that name. Remotes that upload atomically
|
||||
already (object stores such as `s3`) are streamed straight to the
|
||||
destination. On remotes where a partial upload would otherwise be visible
|
||||
(such as `local`), the parts are streamed to a temporary object that is
|
||||
moved into place, server-side, on completion; these remotes therefore
|
||||
also need to support a server-side move or copy.
|
||||
object already stored under that name and a partly-uploaded object
|
||||
never becomes visible under it.
|
||||
|
||||
With the default `--vfs-cache-mode off` `serve s3` **streams** each
|
||||
multipart upload, in part-number order, into a single streaming upload
|
||||
to the underlying remote, so the whole file is never buffered in
|
||||
memory: only parts which arrive out of order are buffered, within the
|
||||
limits described below. The remote then performs its own internal upload (for example its own multipart
|
||||
upload, still with bounded memory). Remotes that don't support
|
||||
streaming uploads (those that must know the file size before the
|
||||
upload starts, such as `onedrive`, `pcloud`, `jottacloud`, `mailru`,
|
||||
`opendrive`, `putio`, `protondrive` and `zoho`) have the parts spooled
|
||||
to a temporary file on **local disk** instead, and uploaded with the
|
||||
size then known on completion, so they need local disk space for the
|
||||
largest objects in flight rather than memory.
|
||||
|
||||
With `--vfs-cache-mode writes` (or `full`) the parts are written to a
|
||||
temporary file in the VFS cache and uploaded by the VFS write-back -
|
||||
see [Multipart uploads and the VFS
|
||||
cache](#multipart-uploads-and-the-vfs-cache) below.
|
||||
|
||||
The rename into place needs the remote to support a server-side move
|
||||
or copy, which nearly all do. It is a cheap rename on most remotes,
|
||||
but on object stores without a real rename (such as `s3` itself) the
|
||||
move is performed as a server-side copy and delete of the whole
|
||||
object, which can take time and API calls for large objects.
|
||||
Concurrent multipart uploads of the same key (which S3 permits) are
|
||||
safe. Each writes its own temporary object and the last to complete
|
||||
wins.
|
||||
|
||||
On the few remotes that support neither server side move nor copy, the
|
||||
parts are written straight to the destination object instead and never
|
||||
buffered in memory. This is at some cost in atomicity - the incomplete
|
||||
object is visible under its final name while the upload is in flight,
|
||||
as it also is for a plain object PUT on such remotes, and concurrent
|
||||
multipart uploads of the same key write to the same object and can
|
||||
interleave. A failed or aborted upload still leaves any pre-existing
|
||||
object untouched provided the remote uploads atomically and the VFS
|
||||
cache is off; on a remote where partial uploads are visible it may
|
||||
leave partial data at the key (like a plain PUT there), and with
|
||||
`--vfs-cache-mode writes` (or `full`) a write to the cache cannot be
|
||||
abandoned, so an aborted upload's partial data is written back to the
|
||||
remote as if it had completed.
|
||||
|
||||
**Features**
|
||||
|
||||
- The whole object is never buffered in memory; memory use is bounded by
|
||||
the parts in flight, not the upload size.
|
||||
- The whole object is never buffered in memory; only parts arriving out
|
||||
of order are, within fixed limits, whatever the upload size.
|
||||
- Parts can be any size. Clients that don't produce uniform-sized parts
|
||||
work fine - for example PostgreSQL backup tools such as **pgBarman**
|
||||
and **pgBackRest**, which flush an upload buffer once it grows past
|
||||
@@ -133,69 +205,275 @@ also need to support a server-side move or copy.
|
||||
as one continuous stream.
|
||||
- The destination object only ever changes atomically, on completion: an
|
||||
aborted or failed upload leaves any pre-existing object of the same
|
||||
name untouched, and a partly-uploaded object never becomes visible.
|
||||
- Backend-agnostic - it only needs the remote to support `PutStream`
|
||||
(plus a server-side move or copy on remotes that don't upload
|
||||
atomically).
|
||||
name untouched, and a partly-uploaded object never becomes visible
|
||||
(except on the few remotes with no server-side move or copy, as
|
||||
above).
|
||||
- Multipart uploads go through the VFS like any other upload, so they
|
||||
show in rclone's transfer stats and obey `--bwlimit`.
|
||||
- Backend-agnostic - it only needs the remote to support a server-side
|
||||
move or copy for the rename into place, which nearly all do; a remote
|
||||
without streaming upload support spools to local disk as above.
|
||||
|
||||
**Limitations**
|
||||
|
||||
- Parts must arrive in ascending, contiguous part-number order
|
||||
(1, 2, 3, ...). Parts the client uploads concurrently or out of order
|
||||
are buffered until their turn. The memory used for this buffering is
|
||||
capped, per upload, by `--multipart-streaming-buffer-limit` (default
|
||||
`256M`, `0` for no limit): a part that would take the buffer over the
|
||||
limit is stalled until the stream drains, so a client that uploads
|
||||
faster than the remote can accept sees backpressure rather than
|
||||
unbounded server memory use. Since a stalled part holds its HTTP
|
||||
request open, clients whose upload concurrency times chunk size
|
||||
exceeds the limit may need a longer read timeout when the remote is
|
||||
slow. Non-contiguous part numbers are rejected on completion.
|
||||
Configure the client to upload in part order, ideally with low
|
||||
concurrency, for the lowest memory use.
|
||||
- Parts must arrive in ascending, contiguous part-number order (1, 2, 3,
|
||||
...). The part the stream needs next is written straight through as it
|
||||
arrives, so it is never buffered, whatever its size. Parts the client
|
||||
uploads concurrently or out of order are buffered until their turn.
|
||||
The memory used for this buffering is capped, per upload, by
|
||||
`--multipart-streaming-buffer-limit` (default `256M`, `0` for no
|
||||
limit), and across all the uploads of each user (each access key) by
|
||||
`--multipart-streaming-buffer-total` (default `1G`, `0` for no
|
||||
limit), counting each buffered part in the
|
||||
whole 1 MiB memory pages it occupies: a part that would take the
|
||||
buffer over either limit is stalled until the stream drains (or, if it
|
||||
is bigger than the limits, until it is the next part), so a client
|
||||
that uploads faster than the remote can accept sees backpressure
|
||||
rather than unbounded server memory use. A stalled part holds its HTTP
|
||||
request open, and one stalled for more than a minute is failed with a
|
||||
`SlowDown` error, which S3 clients retry. Clients whose upload
|
||||
concurrency times part size exceeds the limits will see these stalls
|
||||
and retries when the remote is slower than the client. Non-contiguous
|
||||
part numbers are rejected on completion. Configure the client to
|
||||
upload in part order, ideally with low concurrency, for the lowest
|
||||
memory use.
|
||||
- A part uploaded again before completion - typically a client retrying
|
||||
after a timeout - is accepted: if the earlier copy is still buffered
|
||||
it is replaced, and if it has already been streamed an identical
|
||||
re-upload is a no-op. What isn't possible is replacing a part that has
|
||||
already been streamed with *different* content - that is rejected. A
|
||||
failure in the stream to the remote itself still aborts the whole
|
||||
upload and the client must start it again. (The remote's own upload
|
||||
re-upload is a no-op (a re-upload which arrives while the part is
|
||||
being streamed waits for it to finish first). If a part fails part way
|
||||
through being streamed
|
||||
(for example the client's connection drops) the client's retry of it
|
||||
carries on where it stopped, provided it has the same content. What
|
||||
isn't possible is replacing a part that has already been streamed,
|
||||
in whole or in part, with *different* content - that is rejected. A
|
||||
part which arrives in full but is then rejected, for example because
|
||||
it doesn't match the `Content-MD5` the client declared, has already
|
||||
been streamed, so the whole upload is failed and the client must
|
||||
start it again. So is a failure in the stream to the remote itself. (The remote's own upload
|
||||
still retries its internal chunks.)
|
||||
- A `CompleteMultipartUpload` which fails because the parts it lists
|
||||
don't match those uploaded, or there is a gap in the part numbers,
|
||||
leaves the upload open, as on S3, so the client can upload any
|
||||
missing parts and complete it again. If writing the completed object
|
||||
to the remote fails, the upload is failed and must be started again.
|
||||
- Parts are serialised into one stream, so ingest from the client is
|
||||
effectively single-threaded, although the remote's own upload still
|
||||
runs concurrently.
|
||||
- On remotes that don't upload atomically (such as `local`), the
|
||||
completed object is moved into place with a server-side operation.
|
||||
This is a cheap rename on most such remotes. On these remotes, if
|
||||
`serve s3` is killed part-way through an upload the temporary object
|
||||
(named with a leading `.rclone_multipart_upload_`) may be left behind;
|
||||
it is hidden from S3 listings but must be removed manually.
|
||||
effectively single-threaded. When streaming, the remote's own upload
|
||||
runs concurrently with the parts arriving; with the local disk spool
|
||||
or the VFS cache the upload to the remote only starts on completion.
|
||||
- If `serve s3` is killed part-way through an upload the temporary
|
||||
object (named with a leading `.rclone_temp_multipart_`) may be left
|
||||
behind; it is hidden from S3 listings but must be removed manually.
|
||||
|
||||
### Multipart uploads and the VFS cache
|
||||
|
||||
With `--vfs-cache-mode writes` (or `full`) multipart uploads do not
|
||||
stream to the remote at all. The parts are written, in part-number
|
||||
order, to a temporary file in the VFS cache. On completion the file is
|
||||
renamed into place and uploaded by the VFS write-back, exactly like a
|
||||
plain object PUT. This needs no streaming upload support from the
|
||||
remote. The rename normally happens in the cache before the upload has
|
||||
started, but the VFS requires the remote to support a server-side move
|
||||
or copy to rename files at all (and uses one if the temporary file has
|
||||
already been written back, e.g. with `--vfs-write-back 0`). On remotes
|
||||
without either, the parts are written to the cache directly under the
|
||||
final key instead: the upload still never touches memory, but it loses
|
||||
its atomicity - the in-flight upload is visible at the key, and an
|
||||
aborted upload cannot be abandoned once in the cache, so its partial
|
||||
data is written back to the remote as if it were a completed object.
|
||||
|
||||
Remotes that benefit from `--vfs-cache-mode writes`:
|
||||
|
||||
- **Remotes over slow or unreliable links.** A failure in a streamed
|
||||
upload aborts the whole multipart upload and the client must start
|
||||
again from the first part; a failed write-back upload is retried by
|
||||
the VFS (see `--vfs-cache-max-age` and friends) without the client
|
||||
being involved. Ingest from the client also runs at local disk speed
|
||||
rather than being throttled to the remote's pace.
|
||||
- **Workloads that read back or overwrite what they just wrote.** The
|
||||
completed object stays in the cache, so subsequent `GET`/`HEAD`
|
||||
requests are served locally, and plain PUTs and multipart uploads to
|
||||
the same key go through the same cache entry so the last write wins
|
||||
regardless of upload style.
|
||||
|
||||
The trade-offs of the VFS cache:
|
||||
|
||||
- The whole object lands on local disk, so the cache (`--cache-dir`)
|
||||
needs space for the largest objects in flight; `--vfs-cache-max-size`
|
||||
cannot evict files which are still being uploaded.
|
||||
- The `200 OK` for `CompleteMultipartUpload` means the data is safely
|
||||
in the **local cache**, not yet on the remote - the same durability
|
||||
the cache gives plain PUTs. If an acknowledgement must mean the data
|
||||
has reached the remote (for example WAL archiving), use the default
|
||||
`--vfs-cache-mode off`.
|
||||
- The upload to the remote only starts on completion, rather than
|
||||
overlapping with the parts arriving, so the data reaches the remote
|
||||
later than with streaming.
|
||||
- If `serve s3` is killed part-way through an upload, the temporary
|
||||
file survives in the cache and the VFS cache recovery uploads it to
|
||||
the remote on restart as a temporary object (named with a leading
|
||||
`.rclone_temp_multipart_`); as with the streaming path, it is
|
||||
hidden from S3 listings but must be removed manually.
|
||||
|
||||
### Cleaning up temporary objects
|
||||
|
||||
If `serve s3` is killed part-way through an upload it can leave a
|
||||
temporary object behind, named with a leading `.rclone_temp_`. This
|
||||
whole prefix is reserved: any object whose name (the last
|
||||
`/`-separated segment of its key) starts with `.rclone_temp_` is
|
||||
hidden from S3 listings, so don't give real objects such names - an
|
||||
existing object with such a name disappears from listings (though it
|
||||
stays accessible directly by its key: only listings hide reserved
|
||||
names, `GET`, `HEAD` and `DELETE` of the exact key still work). A
|
||||
temporary object never holds acknowledged data - uploads whose
|
||||
temporary object survived were never confirmed to the client - so old
|
||||
ones are safe to delete:
|
||||
|
||||
rclone delete --min-age 24h --include ".rclone_temp_*" remote:path
|
||||
|
||||
The `--min-age` protects uploads which are still in progress: make sure
|
||||
it is longer than your longest upload, especially if several `serve s3`
|
||||
instances share the same remote.
|
||||
|
||||
rclone v1.75 named its temporary multipart objects
|
||||
`.rclone_multipart_upload_*`; leftovers from an older server are also
|
||||
hidden from listings and can be cleaned up the same way.
|
||||
|
||||
### Abandoned uploads
|
||||
|
||||
A client which starts a multipart upload and vanishes without either
|
||||
completing or aborting it would otherwise hold on to its resources
|
||||
forever.
|
||||
|
||||
An incomplete multipart upload which has had no activity for
|
||||
`--multipart-expiry` (default `24h`) is therefore aborted and cleaned
|
||||
up, exactly as if the client had called `AbortMultipartUpload`, and a
|
||||
`NOTICE` is logged.
|
||||
|
||||
An upload with a part still being received is never expired, however
|
||||
slowly the part is arriving, and each completed part restarts the
|
||||
clock, so the expiry only needs to outlast the client's pauses
|
||||
*between* parts, not the whole upload.
|
||||
|
||||
Late operations on an expired upload fail with `NoSuchUpload`, as they
|
||||
do on real S3 when a lifecycle rule has aborted the upload. Set
|
||||
`--multipart-expiry 0` to keep incomplete uploads forever - but note
|
||||
that abandoned uploads are then never cleaned up and go on counting
|
||||
towards `--multipart-max-uploads` below, so enough of them will stop
|
||||
the user starting any new multipart upload until the server is
|
||||
restarted.
|
||||
|
||||
Each multipart upload in progress holds server resources - for example
|
||||
the buffers the remote's own upload uses once the first part has
|
||||
arrived - so each user (each access key) can have no more than
|
||||
`--multipart-max-uploads` (default `1000`, `0` for no limit) in
|
||||
progress at once. Starting another fails with a `SlowDown` error,
|
||||
which S3 clients retry, and a one-off `NOTICE` is logged.
|
||||
|
||||
### Disabling streaming
|
||||
|
||||
If you pass `--disable-multipart-streaming`, or the remote doesn't
|
||||
support `PutStream` (or doesn't upload atomically and can't move or copy
|
||||
server-side), multipart uploads are instead **buffered in memory**
|
||||
by the underlying S3 library: every part is held in memory and the whole
|
||||
object is written out in one go when the upload completes (the previous
|
||||
behaviour). This removes the in-order/contiguous-part restriction above,
|
||||
so parts can be uploaded in any order, but **memory use grows with the
|
||||
size of the upload**, so it is only suitable for small objects. A one-off
|
||||
`NOTICE` is logged the first time this happens.
|
||||
If you pass `--disable-multipart-streaming`, multipart uploads are
|
||||
instead **buffered in memory** by the underlying S3 library: every
|
||||
part is held in memory and the whole object is written out in one go
|
||||
when the upload completes. This removes the in-order/contiguous-part
|
||||
restriction above, so parts can be uploaded in any order, but **memory
|
||||
use grows with the size of the upload**, so it is only suitable for
|
||||
small objects. A one-off `NOTICE` is logged the first time this
|
||||
happens. This flag is the only thing that makes multipart uploads
|
||||
buffer in memory - it is never done because of missing remote
|
||||
capabilities. The limits on multipart uploads above
|
||||
(`--multipart-streaming-buffer-limit`,
|
||||
`--multipart-streaming-buffer-total` and `--multipart-max-uploads`) do
|
||||
not apply to uploads buffered in memory, so don't use this flag if the
|
||||
server is open to clients you don't trust. Consider
|
||||
`--vfs-cache-mode writes` instead, which buffers the upload in the VFS
|
||||
cache on disk and takes precedence over
|
||||
`--disable-multipart-streaming`.
|
||||
|
||||
Alternatively, if the client is an rclone `s3` remote (like the
|
||||
`[serves3]` example above), you can set `use_multipart_uploads = false`
|
||||
on it so it uploads each object as a single stream and skips multipart
|
||||
uploads altogether.
|
||||
## Memory use
|
||||
|
||||
`serve s3` never buffers whole objects in memory (except with
|
||||
`--disable-multipart-streaming`, above), and limits the memory each
|
||||
kind of request can use, so that a client, even a hostile one, can't
|
||||
make it use unbounded memory.
|
||||
|
||||
- **Object data.** `PutObject` bodies and multipart parts arriving in
|
||||
order are streamed straight through to the remote. Parts arriving out
|
||||
of order are buffered, up to `--multipart-streaming-buffer-limit`
|
||||
per upload and `--multipart-streaming-buffer-total` per user.
|
||||
- **Uploads in progress.** Each user can have at most
|
||||
`--multipart-max-uploads` multipart uploads in progress. An upload
|
||||
holds little memory until its
|
||||
first part arrives. After that, with `--vfs-cache-mode off`, it holds
|
||||
a `--streaming-upload-cutoff` sized buffer plus whatever the remote's
|
||||
own upload buffers, which for many remotes is up to their chunk size
|
||||
times their upload concurrency (for example `--s3-chunk-size` times
|
||||
`--s3-upload-concurrency`). Plain `PutObject` uploads use the same
|
||||
while they are in progress.
|
||||
- **Metadata.** The metadata of at most `--metadata-max-objects`
|
||||
objects of each user is kept, each limited to 2 KB.
|
||||
- **Request bodies.** The XML bodies of requests such as
|
||||
`CompleteMultipartUpload` and `DeleteObjects` are limited to 10 MiB,
|
||||
and `DeleteObjects` to 1000 keys. A browser form (`POST`) upload
|
||||
holds at most 1 MiB in memory, spooling the rest to a temporary file,
|
||||
and is limited to 5 GB.
|
||||
- **Listings.** Each page of a `ListObjects` listing reads only the
|
||||
directories needed to fill it, and returns at most 1000 keys.
|
||||
Directory listings are cached by the [VFS directory
|
||||
cache](#vfs-directory-cache).
|
||||
|
||||
The largest of these is usually the remote's upload buffers, which can
|
||||
be up to `--multipart-max-uploads` times the buffers of one upload for
|
||||
each user if clients start many uploads and send part of each. The
|
||||
limits apply to each user separately, so that one user can't stop
|
||||
others uploading, which means the memory use grows with the number of
|
||||
users. To limit it, lower
|
||||
`--multipart-max-uploads`, the remote's chunk size or upload
|
||||
concurrency, or set `--max-buffer-memory` to limit the memory used by
|
||||
the buffers of all uploads to remotes which use rclone's buffer pool
|
||||
(including `s3`, `azureblob` and `b2`). Buffered multipart parts come
|
||||
from the same pool, so if you set `--max-buffer-memory` make it
|
||||
comfortably bigger than `--multipart-streaming-buffer-total` times the
|
||||
number of users uploading at once, otherwise
|
||||
buffered parts can use up all the memory the remote needs to upload the
|
||||
parts which would free them.
|
||||
|
||||
The number of connections is not limited, so if the server is open to
|
||||
clients you don't trust, use `--auth-key` or `--auth-proxy` and
|
||||
consider putting it behind a reverse proxy which limits connections.
|
||||
|
||||
## Design goals
|
||||
|
||||
These goals explain many of the limitations below.
|
||||
|
||||
- **Objects are plain files on the remote.** A bucket is a directory
|
||||
in the root and a key is a path in it, so the remote stays usable by
|
||||
other tools, such as `rclone mount` or `rclone sync`. So keys must
|
||||
be paths (see [Object names](#object-names)).
|
||||
- **No database.** `serve s3` stores nothing but the objects. What the
|
||||
remote can't hold, such as user metadata, tags, the MD5 `ETag` of an
|
||||
object on a remote without MD5 and the directory markers put, is
|
||||
kept in memory as a best effort, and lost on restart.
|
||||
- **Works with any rclone remote.** What `serve s3` can do depends on
|
||||
what the remote supports, such as the hashes used for `ETag`s and
|
||||
modification times, rather than needing a particular backend.
|
||||
- **Bounded memory.** Uploads, including multipart uploads, are
|
||||
streamed to the remote and the memory each request can use is
|
||||
limited (see [Memory use](#memory-use)). Nothing is written to local
|
||||
disk unless the VFS cache is used or the remote can't stream uploads
|
||||
(see [Multipart uploads](#multipart-uploads)).
|
||||
- **Refuse rather than ignore.** Unsupported features are refused, or
|
||||
answered as S3 answers when the feature isn't configured, so a
|
||||
client is never told something was done which wasn't (see
|
||||
[Compatibility](#compatibility)).
|
||||
- **A storage gateway, not a full S3.** `serve s3` implements the parts
|
||||
of the S3 API clients use to store and fetch objects. Versioning,
|
||||
ACLs, bucket policies, lifecycle rules and the like are out of scope.
|
||||
- **Compatible with rclone's s3 backend.** This includes its directory
|
||||
markers, which the tests check.
|
||||
|
||||
## Bugs
|
||||
|
||||
Multipart server side copies do not work (see
|
||||
[#7454](https://github.com/rclone/rclone/issues/7454)). These take a
|
||||
very long time and eventually fail. The default threshold for
|
||||
multipart server side copies is 5G which is the maximum it can be, so
|
||||
files above this side will fail to be server side copied.
|
||||
|
||||
For a current list of `serve s3` bugs see the [serve
|
||||
s3](https://github.com/rclone/rclone/labels/serve%20s3) bug category
|
||||
on GitHub.
|
||||
@@ -204,57 +482,124 @@ on GitHub.
|
||||
|
||||
`serve s3` will treat all directories in the root as buckets and
|
||||
ignore all files in the root. You can use `CreateBucket` to create
|
||||
folders under the root, but you can't create empty folders under other
|
||||
folders not in the root.
|
||||
folders under the root, and put a directory marker to create an empty
|
||||
folder below them (see [Object names](#object-names)).
|
||||
|
||||
When using `PutObject` or `DeleteObject`, rclone will automatically
|
||||
create or clean up empty folders. If you don't want to clean up empty
|
||||
folders automatically, use `--no-cleanup`.
|
||||
folders automatically, use `--directory-markers` (see [Object
|
||||
names](#object-names)). The deprecated `--no-cleanup` does the same.
|
||||
|
||||
When using `ListObjects`, rclone will use `/` when the delimiter is
|
||||
empty. This reduces backend requests with no effect on most
|
||||
operations, but if the delimiter is something other than `/` and
|
||||
empty, rclone will do a full recursive search of the backend, which
|
||||
can take some time.
|
||||
When using `ListObjects` with the delimiter `/`, rclone lists the
|
||||
directory the prefix is in, showing its subdirectories as common
|
||||
prefixes, including empty ones. Without a delimiter the listing is
|
||||
recursive: rclone walks the directory tree below the prefix, reading
|
||||
only as many directories as it needs to fill each page, and lists
|
||||
empty directories as their directory markers (see below). Any other
|
||||
delimiter is supported too, but needs the whole directory tree below
|
||||
the prefix walking, unless the delimiter is in the directory names.
|
||||
|
||||
Versioning is not currently supported.
|
||||
Versioning is not supported (see [Design goals](#design-goals)).
|
||||
|
||||
Metadata will only be saved in memory other than the rclone `mtime`
|
||||
metadata which will be set as the modification time of the file.
|
||||
Conditional writes, `PutObject` and `CompleteMultipartUpload` with
|
||||
`If-None-Match` or `If-Match`, are supported. The conditions are
|
||||
checked before the object is written, and again as it is moved into
|
||||
place when it is written to a temporary object first. This happens for
|
||||
multipart uploads and, for `PutObject`, with remotes which can upload
|
||||
partial files (such as local disk) or with `--vfs-cache-mode minimal`
|
||||
or above. The second check is atomic against other writes through
|
||||
`serve s3`, but neither is atomic against changes made to the remote
|
||||
some other way. If the remote doesn't support the `--etag-hash`,
|
||||
objects have no `ETag` so `If-Match` with an `ETag` always fails.
|
||||
|
||||
Metadata will only be saved in memory (see [Design
|
||||
goals](#design-goals)) other than the rclone `mtime` metadata which
|
||||
will be set as the modification time of the file. The
|
||||
metadata of at most `--metadata-max-objects` objects (default `100000`,
|
||||
`0` for no limit) of each user (each access key) is kept; after that
|
||||
the metadata of the user's least recently used object is forgotten. The metadata of an object is
|
||||
ignored once the object has been changed some other way, for example
|
||||
by another `--auth-proxy` user or directly on the backend. Object tags
|
||||
are kept with the metadata in the same way.
|
||||
|
||||
## Object names
|
||||
|
||||
`serve s3` stores objects as files in the backend, so object keys are
|
||||
mapped to file paths rather than treated as the opaque strings AWS S3
|
||||
allows. Keys must be in canonical path form: keys that contain `..` or
|
||||
`.` path segments, repeated slashes (`//`), or a leading or trailing
|
||||
slash are rejected with a `400 Bad Request` (`InvalidArgument`)
|
||||
instead of being normalised, since normalising them could alias two
|
||||
distinct keys to the same file or resolve a key outside its bucket.
|
||||
This matches the behaviour of other S3 servers such as MinIO.
|
||||
`.` path segments, repeated slashes (`//`), or a leading slash are
|
||||
rejected with a `400 Bad Request` (`InvalidArgument`) instead of being
|
||||
normalised, since normalising them could alias two distinct keys to
|
||||
the same file or resolve a key outside its bucket. This matches the
|
||||
behaviour of other S3 servers such as MinIO.
|
||||
|
||||
## Supported operations
|
||||
A key ending in `/`, such as `dir/`, is a directory marker, standing
|
||||
for the directory `dir`. Putting an empty directory marker creates the
|
||||
directory (one with data is rejected with `400 Bad Request`), and
|
||||
deleting it removes the directory if it is empty. Directory markers
|
||||
are found by `HeadObject`, `GetObject` and `CopyObject` for any
|
||||
directory, but only the markers of empty directories, and of the
|
||||
directories a marker was put for, are listed as objects, as other
|
||||
directories may not have been made by putting a marker. The markers
|
||||
put are remembered in memory with the metadata (see
|
||||
[Limitations](#limitations)), so after a restart, or once forgotten,
|
||||
the marker of a directory holding other keys is no longer listed.
|
||||
While a marker is remembered its directory isn't removed when the
|
||||
last key below it is deleted.
|
||||
|
||||
`serve s3` currently supports the following operations.
|
||||
With `--directory-markers` every directory is listed as a directory
|
||||
marker, so the markers are listed after a restart too, as needed by
|
||||
clients which rely on them, such as rclone's s3 backend with
|
||||
`--s3-directory-markers`. As every directory has a marker, a directory
|
||||
isn't removed when the last key below it is deleted. Deleting the
|
||||
marker of a directory which holds other keys stops it being listed,
|
||||
and the directory is then removed with the last key below it, but this
|
||||
is only remembered in memory, like the markers put without
|
||||
`--directory-markers`.
|
||||
|
||||
- Bucket
|
||||
- `ListBuckets`
|
||||
- `CreateBucket`
|
||||
- `DeleteBucket`
|
||||
- Object
|
||||
- `HeadObject`
|
||||
- `ListObjects`
|
||||
- `GetObject`
|
||||
- `PutObject`
|
||||
- `DeleteObject`
|
||||
- `DeleteObjects`
|
||||
- `CreateMultipartUpload`
|
||||
- `CompleteMultipartUpload`
|
||||
- `AbortMultipartUpload`
|
||||
- `CopyObject`
|
||||
- `UploadPart`
|
||||
As keys are file paths, a key can't be both an object and a directory
|
||||
holding other objects, for example `a/b` and `a/b/c`. Writing an
|
||||
object which would need this fails with `400 Bad Request`
|
||||
(`InvalidRequest`).
|
||||
|
||||
Other operations will return error `Unimplemented`.
|
||||
## Compatibility
|
||||
|
||||
`serve s3` implements the parts of the S3 API that S3 clients commonly
|
||||
use to store and fetch objects. Features it doesn't support are
|
||||
refused with `501 NotImplemented`, or answered as AWS S3 answers for a
|
||||
bucket without that feature configured, rather than being silently
|
||||
ignored.
|
||||
|
||||
| Feature | Supported | Notes |
|
||||
| ------- | --------- | ----- |
|
||||
| `ListBuckets`, `CreateBucket`, `DeleteBucket`, `HeadBucket`, `GetBucketLocation` | Yes | Buckets are the directories in the root of the remote. |
|
||||
| `ListObjects`, `ListObjectsV2` | Yes | Prefixes, delimiters, markers, `start-after`, continuation tokens, `fetch-owner` and `encoding-type=url` all work. Delimiters other than `/` need the whole directory tree walking. |
|
||||
| `HeadObject`, `GetObject` | Yes | Including `Range`, `partNumber`, the `response-*` header overrides and the `If-Match`, `If-None-Match`, `If-Modified-Since` and `If-Unmodified-Since` conditions. |
|
||||
| `PutObject` | Yes | Including `Content-MD5`, `aws-chunked` uploads and uploads with no `Content-Length`. |
|
||||
| `CopyObject` | Yes | Including the metadata and tagging directives and the `x-amz-copy-source-if-*` conditions. |
|
||||
| `DeleteObject`, `DeleteObjects` | Yes | |
|
||||
| Multipart uploads | Yes | `CreateMultipartUpload`, `UploadPart`, `UploadPartCopy`, `CompleteMultipartUpload`, `AbortMultipartUpload`, `ListMultipartUploads` and `ListParts`. The `ETag` of the object is its hash, not the `-N` suffixed one AWS gives. The 5 MiB minimum part size isn't enforced. |
|
||||
| Conditional writes | Partial | `If-Match` and `If-None-Match` on `PutObject` and `CompleteMultipartUpload` are checked, but not atomically against changes made to the remote some other way (see [Limitations](#limitations)). |
|
||||
| Authentication | Partial | AWS Signature Version 4, in headers, presigned URLs and browser form (`POST`) uploads. Signature Version 2 isn't supported. |
|
||||
| Anonymous access | Partial | All requests are allowed without `--auth-key` or `--auth-proxy`, and none are with them, as buckets and objects can't be made public. |
|
||||
| Metadata | Partial | `x-amz-meta-*`, the storage class and the standard headers such as `Content-Type` are kept in memory only (see [Limitations](#limitations)), except the modification time. The storage class is only recorded, so doesn't change how the object is stored. |
|
||||
| Directory markers | Partial | Keys ending in `/` are stored as directories, so can't hold data. A marker put for a directory holding other keys is only listed while it is remembered in memory, unless `--directory-markers` is set (see [Object names](#object-names)). |
|
||||
| Checksums | Partial | The `x-amz-checksum-*` of a `PutObject` (CRC32, CRC32C, CRC64NVME, SHA1 or SHA256) is checked and returned with the metadata. The `Content-MD5` and `x-amz-checksum-*` of the bodies of other requests, such as `DeleteObjects`, are checked. The checksums of multipart uploads aren't supported. |
|
||||
| `GetObjectAttributes` | Partial | Everything but the checksums of multipart uploads. |
|
||||
| Object tagging | Partial | `GetObjectTagging`, `PutObjectTagging` and `DeleteObjectTagging` work, but tags are kept in memory with the metadata. |
|
||||
| Bucket owner | No | `serve s3` has no AWS account IDs, so `x-amz-expected-bucket-owner` and `x-amz-source-expected-bucket-owner` are ignored. |
|
||||
| ACLs | Partial | `GetBucketAcl` and `GetObjectAcl` give the owner full control. Only the `private` ACL can be set. |
|
||||
| CORS | Partial | Preflight (`OPTIONS`) requests are answered, allowing any origin. CORS configuration (`PutBucketCors`) isn't supported. |
|
||||
| Server side encryption | No | SSE-S3 (`AES256`) is accepted but the data isn't encrypted. SSE-KMS and SSE-C are refused. |
|
||||
| Versioning | No | Buckets are reported as unversioned and `ListObjectVersions` lists each object as version `null`. Enabling versioning is refused. |
|
||||
| Object lock, retention and legal hold | No | |
|
||||
| Bucket configuration | No | Bucket policies, tagging, lifecycle, logging, encryption, website, replication, notifications and the like. Getting them fails as for a bucket without them configured. |
|
||||
| `SelectObjectContent`, `RestoreObject`, torrents | No | |
|
||||
|
||||
The [ceph s3-tests](https://github.com/ceph/s3-tests) can be run
|
||||
against `serve s3` to check its compatibility. See
|
||||
[cmd/serve/s3/s3tests](https://github.com/rclone/rclone/tree/master/cmd/serve/s3/s3tests)
|
||||
for how.
|
||||
|
||||
### Authentication
|
||||
|
||||
@@ -284,8 +629,20 @@ htpasswd -B htpasswd user
|
||||
htpasswd -B htpasswd anotherUser
|
||||
```
|
||||
|
||||
Use the same hash format and cost for every entry in the file. If the
|
||||
entries differ, the time taken to reject a wrong password can reveal
|
||||
which usernames exist.
|
||||
|
||||
The password file can be updated while rclone is running.
|
||||
|
||||
When authentication is enabled every request must be authenticated,
|
||||
including HTTP OPTIONS requests, as the answer to an OPTIONS request can
|
||||
reveal whether a path exists. Health checks or monitoring which use
|
||||
unauthenticated OPTIONS requests will need to send credentials. The
|
||||
exception is browser CORS preflight requests when `--allow-origin`
|
||||
is set, which are answered without authentication as browsers never send
|
||||
credentials with them.
|
||||
|
||||
Use `--realm` to set the authentication realm.
|
||||
|
||||
Use `--salt` to change the password hashing salt from the default.
|
||||
@@ -317,6 +674,13 @@ accept in the HTTP header.
|
||||
will overriding existing values. The flag may be repeated to add multiple
|
||||
headers. Use the format `Header-Name: value`.
|
||||
|
||||
`--allow-origin` enables cross-origin (CORS) requests from browsers
|
||||
by setting the `Access-Control-Allow-Origin` header on every response to the
|
||||
origin given, e.g. `--allow-origin https://app.example.com`. Browser
|
||||
CORS preflight OPTIONS requests are answered by rclone without needing
|
||||
authentication as browsers never send credentials with them. Setting this
|
||||
to `*` allows any origin which is a security risk on an authenticated server.
|
||||
|
||||
`--baseurl` controls the URL prefix that rclone serves from. By default
|
||||
rclone will serve from the root. If you used `--baseurl "/rclone"` then
|
||||
rclone would serve from a URL starting with "/rclone/". This is
|
||||
@@ -436,7 +800,7 @@ at all times. The buffered data is bound to one open file and won't be
|
||||
shared.
|
||||
|
||||
This flag is a upper limit for the used memory per open file. The
|
||||
buffer will only use memory for data that is downloaded but not not
|
||||
buffer will only use memory for data that is downloaded but not
|
||||
yet read. If the buffer is empty, only a small amount of memory will
|
||||
be used.
|
||||
|
||||
@@ -491,7 +855,8 @@ longest. This cache flushing strategy is efficient and more relevant
|
||||
files are likely to remain cached.
|
||||
|
||||
The `--vfs-cache-max-age` will evict files from the cache
|
||||
after the set time since last access has passed. The default value of
|
||||
after the set time since last access has passed; it is based on access time,
|
||||
not on when the file was first added to the cache. The default value of
|
||||
1 hour will start evicting files from cache that haven't been accessed
|
||||
for 1 hour. When a cached file is accessed the 1 hour timer is reset to 0
|
||||
and will wait for 1 more hour before evicting. Specify the time with
|
||||
@@ -645,7 +1010,7 @@ Rclone reads `--vfs-read-chunk-streams` chunks of size
|
||||
`--vfs-read-chunk-size` concurrently. The size for each read will stay
|
||||
constant.
|
||||
|
||||
This improves performance performance massively on high latency links
|
||||
This improves performance massively on high latency links
|
||||
or very high bandwidth links to high performance object stores.
|
||||
|
||||
Some experimentation will be needed to find the optimum values of
|
||||
@@ -862,6 +1227,135 @@ If the file has no metadata it will be returned as `{}` and if there
|
||||
is an error reading the metadata the error will be returned as
|
||||
`{"error":"error string"}`.
|
||||
|
||||
## Auth Proxy
|
||||
|
||||
If you supply the parameter `--auth-proxy /path/to/program` then
|
||||
rclone will use that program to generate backends on the fly which
|
||||
then are used to authenticate incoming requests. This uses a simple
|
||||
JSON based protocol with input on STDIN and output on STDOUT.
|
||||
|
||||
**PLEASE NOTE:** `--auth-proxy` and `--authorized-keys` cannot be used
|
||||
together, if `--auth-proxy` is set the authorized keys option will be
|
||||
ignored.
|
||||
|
||||
There is an example program
|
||||
[bin/test_proxy.py](https://github.com/rclone/rclone/blob/master/bin/test_proxy.py)
|
||||
in the rclone source code.
|
||||
|
||||
The program's job is to take a `user` and `pass` on the input and turn
|
||||
those into the config for a backend on STDOUT in JSON format. This
|
||||
config will have any default parameters for the backend added, but it
|
||||
won't use configuration from environment variables or command line
|
||||
options - it is the job of the proxy program to make a complete
|
||||
config.
|
||||
|
||||
This config generated must have this extra parameter
|
||||
|
||||
- `_root` - root to use for the backend
|
||||
|
||||
And it may have these parameters
|
||||
|
||||
- `_obscure` - comma separated strings for parameters to obscure
|
||||
- `_secret_access_key` - the secret for S3 access key auth (see below)
|
||||
|
||||
If password authentication was used by the client, input to the proxy
|
||||
process (on STDIN) would look similar to this:
|
||||
|
||||
```json
|
||||
{
|
||||
"user": "me",
|
||||
"pass": "mypassword",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
If public-key authentication was used by the client, input to the
|
||||
proxy process (on STDIN) would look similar to this:
|
||||
|
||||
```json
|
||||
{
|
||||
"user": "me",
|
||||
"public_key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDuwESFdAe14hVS6omeyX7edc...JQdf",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
If the client authenticated with an S3 access key (`rclone serve s3`),
|
||||
the client never sends its secret, only a signature made with it, so
|
||||
the input contains just the access key ID as the `user` with no `pass`
|
||||
or `public_key`:
|
||||
|
||||
```json
|
||||
{
|
||||
"user": "AKIAIOSFODNN7EXAMPLE",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
In this case the program must look up the secret access key for that
|
||||
access key ID and return it in the `_secret_access_key` field of the
|
||||
output. Rclone then uses that secret to verify the signature on the
|
||||
request, refusing the request if it does not match. This means the
|
||||
proxy program is the source of truth for both the credentials and the
|
||||
backend they map to. If the program does not return
|
||||
`_secret_access_key` or returns it empty the request is refused.
|
||||
|
||||
The program's answer for an access key ID is cached (see below) but
|
||||
is checked with the program again after 5 minutes even if the access
|
||||
key ID is in constant use, so revoking an access key ID in the
|
||||
program takes effect within 5 minutes. A rotated secret takes effect
|
||||
on the first request signed with it.
|
||||
|
||||
The `client_ip` key holds the IP address the client connected from,
|
||||
without a port number. It can be used to restrict logins to certain
|
||||
networks, or to log authentication attempts centrally. It is omitted if
|
||||
the client has no IP address, for example when connecting over a unix
|
||||
socket. Note that if rclone is behind a reverse proxy this will be the
|
||||
address of the reverse proxy and not the original client.
|
||||
|
||||
And as an example return this on STDOUT
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "sftp",
|
||||
"_root": "",
|
||||
"_obscure": "pass",
|
||||
"user": "me",
|
||||
"pass": "mypassword",
|
||||
"host": "sftp.example.com"
|
||||
}
|
||||
```
|
||||
|
||||
This would mean that an SFTP backend would be created on the fly for
|
||||
the `user` and `pass`/`public_key` returned in the output to the host given. Note
|
||||
that since `_obscure` is set to `pass`, rclone will obscure the `pass`
|
||||
parameter before creating the backend (which is required for sftp
|
||||
backends).
|
||||
|
||||
The program can manipulate the supplied `user` in any way, for example
|
||||
to make proxy to many different sftp backends, you could make the
|
||||
`user` be `user@example.com` and then set the `host` to `example.com`
|
||||
in the output and the user to `user`. For security you'd probably want
|
||||
to restrict the `host` to a limited list.
|
||||
|
||||
An internal cache of backends is keyed on the `user`, the kind of
|
||||
credential presented, a hash of the `pass` or `public_key`, and the
|
||||
`client_ip`. This means that if a user's password or public-key
|
||||
changes, the client connects from a new IP address, or the proxy
|
||||
returns different config parameters (eg a rotated `api_key`), a fresh
|
||||
backend will be created on the next request rather than the cached one
|
||||
being reused. A backend created for a public key login is never
|
||||
reused for a password login, so a public key cannot be sent as a
|
||||
password to skip the program.
|
||||
|
||||
A cached answer is checked with the program again after 5 minutes even
|
||||
if the user is in constant use, so revoking a user in the program
|
||||
takes effect within 5 minutes. For `serve sftp` this applies to new
|
||||
logins - an existing connection is not closed.
|
||||
|
||||
This can be used to build general purpose proxies to any kind of
|
||||
backend that rclone supports.
|
||||
|
||||
```
|
||||
rclone serve s3 remote:path [flags]
|
||||
```
|
||||
@@ -878,7 +1372,8 @@ rclone serve s3 remote:path [flags]
|
||||
--client-ca string Client certificate authority to verify clients with
|
||||
--dir-cache-time Duration Time to cache directory entries for (default 5m0s)
|
||||
--dir-perms FileMode Directory permissions (default 777)
|
||||
--disable-multipart-streaming Buffer multipart uploads in memory instead of streaming them to the backend (see the Multipart uploads docs section)
|
||||
--directory-markers List every directory as a directory marker object
|
||||
--disable-multipart-streaming Buffer multipart uploads in memory instead of streaming them to the backend
|
||||
--etag-hash string Which hash to use for the ETag, or auto or blank for off (default "MD5")
|
||||
--file-perms FileMode File permissions (default 666)
|
||||
--force-path-style If true use path style access if false use virtual hosted style (default true)
|
||||
@@ -888,10 +1383,14 @@ rclone serve s3 remote:path [flags]
|
||||
--key string TLS PEM Private key
|
||||
--link-perms FileMode Link permissions (default 666)
|
||||
--max-header-bytes int Maximum size of request header (default 4096)
|
||||
--metadata-max-objects int Maximum number of objects of a user whose metadata is kept in memory, 0 for unlimited (default 100000)
|
||||
--min-tls-version string Minimum TLS version that is acceptable (default "tls1.0")
|
||||
--multipart-streaming-buffer-limit SizeSuffix Maximum memory buffered per streamed multipart upload for parts arriving out of order, 0 for unlimited (see the Multipart uploads docs section) (default 256Mi)
|
||||
--multipart-expiry Duration Abort incomplete multipart uploads idle for longer than this, 0 to keep forever (default 1d)
|
||||
--multipart-max-uploads int Maximum number of streamed multipart uploads a user can have in progress at once, 0 for unlimited (default 1000)
|
||||
--multipart-streaming-buffer-limit SizeSuffix Maximum memory buffered per streamed multipart upload for parts arriving out of order, 0 for unlimited (default 256Mi)
|
||||
--multipart-streaming-buffer-total SizeSuffix Maximum memory buffered by all the streamed multipart uploads of a user for parts arriving out of order, 0 for unlimited (default 1Gi)
|
||||
--no-checksum Don't compare checksums on up/download
|
||||
--no-cleanup Not to cleanup empty folder after object is deleted
|
||||
--no-cleanup Deprecated: use --directory-markers instead
|
||||
--no-modtime Don't read/write the modification time (can speed things up)
|
||||
--no-seek Don't allow seeking in files
|
||||
--pass string Password for authentication
|
||||
|
||||
@@ -140,7 +140,7 @@ at all times. The buffered data is bound to one open file and won't be
|
||||
shared.
|
||||
|
||||
This flag is a upper limit for the used memory per open file. The
|
||||
buffer will only use memory for data that is downloaded but not not
|
||||
buffer will only use memory for data that is downloaded but not
|
||||
yet read. If the buffer is empty, only a small amount of memory will
|
||||
be used.
|
||||
|
||||
@@ -195,7 +195,8 @@ longest. This cache flushing strategy is efficient and more relevant
|
||||
files are likely to remain cached.
|
||||
|
||||
The `--vfs-cache-max-age` will evict files from the cache
|
||||
after the set time since last access has passed. The default value of
|
||||
after the set time since last access has passed; it is based on access time,
|
||||
not on when the file was first added to the cache. The default value of
|
||||
1 hour will start evicting files from cache that haven't been accessed
|
||||
for 1 hour. When a cached file is accessed the 1 hour timer is reset to 0
|
||||
and will wait for 1 more hour before evicting. Specify the time with
|
||||
@@ -349,7 +350,7 @@ Rclone reads `--vfs-read-chunk-streams` chunks of size
|
||||
`--vfs-read-chunk-size` concurrently. The size for each read will stay
|
||||
constant.
|
||||
|
||||
This improves performance performance massively on high latency links
|
||||
This improves performance massively on high latency links
|
||||
or very high bandwidth links to high performance object stores.
|
||||
|
||||
Some experimentation will be needed to find the optimum values of
|
||||
@@ -592,9 +593,10 @@ This config generated must have this extra parameter
|
||||
|
||||
- `_root` - root to use for the backend
|
||||
|
||||
And it may have this parameter
|
||||
And it may have these parameters
|
||||
|
||||
- `_obscure` - comma separated strings for parameters to obscure
|
||||
- `_secret_access_key` - the secret for S3 access key auth (see below)
|
||||
|
||||
If password authentication was used by the client, input to the proxy
|
||||
process (on STDIN) would look similar to this:
|
||||
@@ -602,7 +604,8 @@ process (on STDIN) would look similar to this:
|
||||
```json
|
||||
{
|
||||
"user": "me",
|
||||
"pass": "mypassword"
|
||||
"pass": "mypassword",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -612,10 +615,44 @@ proxy process (on STDIN) would look similar to this:
|
||||
```json
|
||||
{
|
||||
"user": "me",
|
||||
"public_key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDuwESFdAe14hVS6omeyX7edc...JQdf"
|
||||
"public_key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDuwESFdAe14hVS6omeyX7edc...JQdf",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
If the client authenticated with an S3 access key (`rclone serve s3`),
|
||||
the client never sends its secret, only a signature made with it, so
|
||||
the input contains just the access key ID as the `user` with no `pass`
|
||||
or `public_key`:
|
||||
|
||||
```json
|
||||
{
|
||||
"user": "AKIAIOSFODNN7EXAMPLE",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
In this case the program must look up the secret access key for that
|
||||
access key ID and return it in the `_secret_access_key` field of the
|
||||
output. Rclone then uses that secret to verify the signature on the
|
||||
request, refusing the request if it does not match. This means the
|
||||
proxy program is the source of truth for both the credentials and the
|
||||
backend they map to. If the program does not return
|
||||
`_secret_access_key` or returns it empty the request is refused.
|
||||
|
||||
The program's answer for an access key ID is cached (see below) but
|
||||
is checked with the program again after 5 minutes even if the access
|
||||
key ID is in constant use, so revoking an access key ID in the
|
||||
program takes effect within 5 minutes. A rotated secret takes effect
|
||||
on the first request signed with it.
|
||||
|
||||
The `client_ip` key holds the IP address the client connected from,
|
||||
without a port number. It can be used to restrict logins to certain
|
||||
networks, or to log authentication attempts centrally. It is omitted if
|
||||
the client has no IP address, for example when connecting over a unix
|
||||
socket. Note that if rclone is behind a reverse proxy this will be the
|
||||
address of the reverse proxy and not the original client.
|
||||
|
||||
And as an example return this on STDOUT
|
||||
|
||||
```json
|
||||
@@ -641,11 +678,20 @@ to make proxy to many different sftp backends, you could make the
|
||||
in the output and the user to `user`. For security you'd probably want
|
||||
to restrict the `host` to a limited list.
|
||||
|
||||
An internal cache of backends is keyed on the `user` and a hash of the
|
||||
`pass` or `public_key`. This means that if a user's password or
|
||||
public-key changes, or the proxy returns different config parameters
|
||||
(eg a rotated `api_key`), a fresh backend will be created on the next
|
||||
request rather than the cached one being reused.
|
||||
An internal cache of backends is keyed on the `user`, the kind of
|
||||
credential presented, a hash of the `pass` or `public_key`, and the
|
||||
`client_ip`. This means that if a user's password or public-key
|
||||
changes, the client connects from a new IP address, or the proxy
|
||||
returns different config parameters (eg a rotated `api_key`), a fresh
|
||||
backend will be created on the next request rather than the cached one
|
||||
being reused. A backend created for a public key login is never
|
||||
reused for a password login, so a public key cannot be sent as a
|
||||
password to skip the program.
|
||||
|
||||
A cached answer is checked with the program again after 5 minutes even
|
||||
if the user is in constant use, so revoking a user in the program
|
||||
takes effect within 5 minutes. For `serve sftp` this applies to new
|
||||
logins - an existing connection is not closed.
|
||||
|
||||
This can be used to build general purpose proxies to any kind of
|
||||
backend that rclone supports.
|
||||
|
||||
@@ -126,6 +126,13 @@ accept in the HTTP header.
|
||||
will overriding existing values. The flag may be repeated to add multiple
|
||||
headers. Use the format `Header-Name: value`.
|
||||
|
||||
`--allow-origin` enables cross-origin (CORS) requests from browsers
|
||||
by setting the `Access-Control-Allow-Origin` header on every response to the
|
||||
origin given, e.g. `--allow-origin https://app.example.com`. Browser
|
||||
CORS preflight OPTIONS requests are answered by rclone without needing
|
||||
authentication as browsers never send credentials with them. Setting this
|
||||
to `*` allows any origin which is a security risk on an authenticated server.
|
||||
|
||||
`--baseurl` controls the URL prefix that rclone serves from. By default
|
||||
rclone will serve from the root. If you used `--baseurl "/rclone"` then
|
||||
rclone would serve from a URL starting with "/rclone/". This is
|
||||
@@ -195,6 +202,13 @@ to be used within the template to server pages:
|
||||
| .Sort | | The current sort used. This is changeable via '?sort=' parameter. Possible values: namedirfirst, name, size, time (default namedirfirst). |
|
||||
| .Order | | The current ordering used. This is changeable via '?order=' parameter. Possible values: asc, desc (default asc). |
|
||||
| .Query | | Currently unused. |
|
||||
| .Path | | The path of the directory from the root with leading and trailing slashes, e.g. '/dir/'. |
|
||||
| .IsRoot | | Boolean for if this is the root directory. |
|
||||
| .UpLink | | The link to the parent directory. |
|
||||
| .Static | | Boolean for if the listing is being written as a static page by rclone index. |
|
||||
| .NumDirs | | The number of directories in the listing. |
|
||||
| .NumFiles | | The number of files in the listing. |
|
||||
| .TotalSize | | The total size in bytes of the files in the listing. |
|
||||
| .Breadcrumb | | Allows for creating a relative navigation. |
|
||||
| | .Link | The link of the Text relative to the root. |
|
||||
| | .Text | The Name of the directory. |
|
||||
@@ -204,6 +218,7 @@ to be used within the template to server pages:
|
||||
| | .IsDir | Boolean for if an entry is a directory or not. |
|
||||
| | .Size | Size in bytes of the entry. |
|
||||
| | .ModTime | The UTC timestamp of an entry. |
|
||||
| | .MimeType | The MIME type of an entry guessed from its name, or 'inode/directory'. |
|
||||
|
||||
The server also makes the following functions available so that they can be used
|
||||
within the template. These functions help extend the options for dynamic
|
||||
@@ -244,8 +259,20 @@ htpasswd -B htpasswd user
|
||||
htpasswd -B htpasswd anotherUser
|
||||
```
|
||||
|
||||
Use the same hash format and cost for every entry in the file. If the
|
||||
entries differ, the time taken to reject a wrong password can reveal
|
||||
which usernames exist.
|
||||
|
||||
The password file can be updated while rclone is running.
|
||||
|
||||
When authentication is enabled every request must be authenticated,
|
||||
including HTTP OPTIONS requests, as the answer to an OPTIONS request can
|
||||
reveal whether a path exists. Health checks or monitoring which use
|
||||
unauthenticated OPTIONS requests will need to send credentials. The
|
||||
exception is browser CORS preflight requests when `--allow-origin`
|
||||
is set, which are answered without authentication as browsers never send
|
||||
credentials with them.
|
||||
|
||||
Use `--realm` to set the authentication realm.
|
||||
|
||||
Use `--salt` to change the password hashing salt from the default.
|
||||
@@ -313,7 +340,7 @@ at all times. The buffered data is bound to one open file and won't be
|
||||
shared.
|
||||
|
||||
This flag is a upper limit for the used memory per open file. The
|
||||
buffer will only use memory for data that is downloaded but not not
|
||||
buffer will only use memory for data that is downloaded but not
|
||||
yet read. If the buffer is empty, only a small amount of memory will
|
||||
be used.
|
||||
|
||||
@@ -368,7 +395,8 @@ longest. This cache flushing strategy is efficient and more relevant
|
||||
files are likely to remain cached.
|
||||
|
||||
The `--vfs-cache-max-age` will evict files from the cache
|
||||
after the set time since last access has passed. The default value of
|
||||
after the set time since last access has passed; it is based on access time,
|
||||
not on when the file was first added to the cache. The default value of
|
||||
1 hour will start evicting files from cache that haven't been accessed
|
||||
for 1 hour. When a cached file is accessed the 1 hour timer is reset to 0
|
||||
and will wait for 1 more hour before evicting. Specify the time with
|
||||
@@ -522,7 +550,7 @@ Rclone reads `--vfs-read-chunk-streams` chunks of size
|
||||
`--vfs-read-chunk-size` concurrently. The size for each read will stay
|
||||
constant.
|
||||
|
||||
This improves performance performance massively on high latency links
|
||||
This improves performance massively on high latency links
|
||||
or very high bandwidth links to high performance object stores.
|
||||
|
||||
Some experimentation will be needed to find the optimum values of
|
||||
@@ -765,9 +793,10 @@ This config generated must have this extra parameter
|
||||
|
||||
- `_root` - root to use for the backend
|
||||
|
||||
And it may have this parameter
|
||||
And it may have these parameters
|
||||
|
||||
- `_obscure` - comma separated strings for parameters to obscure
|
||||
- `_secret_access_key` - the secret for S3 access key auth (see below)
|
||||
|
||||
If password authentication was used by the client, input to the proxy
|
||||
process (on STDIN) would look similar to this:
|
||||
@@ -775,7 +804,8 @@ process (on STDIN) would look similar to this:
|
||||
```json
|
||||
{
|
||||
"user": "me",
|
||||
"pass": "mypassword"
|
||||
"pass": "mypassword",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -785,10 +815,44 @@ proxy process (on STDIN) would look similar to this:
|
||||
```json
|
||||
{
|
||||
"user": "me",
|
||||
"public_key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDuwESFdAe14hVS6omeyX7edc...JQdf"
|
||||
"public_key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDuwESFdAe14hVS6omeyX7edc...JQdf",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
If the client authenticated with an S3 access key (`rclone serve s3`),
|
||||
the client never sends its secret, only a signature made with it, so
|
||||
the input contains just the access key ID as the `user` with no `pass`
|
||||
or `public_key`:
|
||||
|
||||
```json
|
||||
{
|
||||
"user": "AKIAIOSFODNN7EXAMPLE",
|
||||
"client_ip": "192.168.1.1"
|
||||
}
|
||||
```
|
||||
|
||||
In this case the program must look up the secret access key for that
|
||||
access key ID and return it in the `_secret_access_key` field of the
|
||||
output. Rclone then uses that secret to verify the signature on the
|
||||
request, refusing the request if it does not match. This means the
|
||||
proxy program is the source of truth for both the credentials and the
|
||||
backend they map to. If the program does not return
|
||||
`_secret_access_key` or returns it empty the request is refused.
|
||||
|
||||
The program's answer for an access key ID is cached (see below) but
|
||||
is checked with the program again after 5 minutes even if the access
|
||||
key ID is in constant use, so revoking an access key ID in the
|
||||
program takes effect within 5 minutes. A rotated secret takes effect
|
||||
on the first request signed with it.
|
||||
|
||||
The `client_ip` key holds the IP address the client connected from,
|
||||
without a port number. It can be used to restrict logins to certain
|
||||
networks, or to log authentication attempts centrally. It is omitted if
|
||||
the client has no IP address, for example when connecting over a unix
|
||||
socket. Note that if rclone is behind a reverse proxy this will be the
|
||||
address of the reverse proxy and not the original client.
|
||||
|
||||
And as an example return this on STDOUT
|
||||
|
||||
```json
|
||||
@@ -814,11 +878,20 @@ to make proxy to many different sftp backends, you could make the
|
||||
in the output and the user to `user`. For security you'd probably want
|
||||
to restrict the `host` to a limited list.
|
||||
|
||||
An internal cache of backends is keyed on the `user` and a hash of the
|
||||
`pass` or `public_key`. This means that if a user's password or
|
||||
public-key changes, or the proxy returns different config parameters
|
||||
(eg a rotated `api_key`), a fresh backend will be created on the next
|
||||
request rather than the cached one being reused.
|
||||
An internal cache of backends is keyed on the `user`, the kind of
|
||||
credential presented, a hash of the `pass` or `public_key`, and the
|
||||
`client_ip`. This means that if a user's password or public-key
|
||||
changes, the client connects from a new IP address, or the proxy
|
||||
returns different config parameters (eg a rotated `api_key`), a fresh
|
||||
backend will be created on the next request rather than the cached one
|
||||
being reused. A backend created for a public key login is never
|
||||
reused for a password login, so a public key cannot be sent as a
|
||||
password to skip the program.
|
||||
|
||||
A cached answer is checked with the program again after 5 minutes even
|
||||
if the user is in constant use, so revoking a user in the program
|
||||
takes effect within 5 minutes. For `serve sftp` this applies to new
|
||||
logins - an existing connection is not closed.
|
||||
|
||||
This can be used to build general purpose proxies to any kind of
|
||||
backend that rclone supports.
|
||||
|
||||
@@ -16,7 +16,7 @@ This command runs a series of uploads and downloads to the remote, measuring
|
||||
and printing the speed of each test using varying file sizes and numbers of
|
||||
files.
|
||||
|
||||
Test time can be innaccurate with small file caps and large files. As it
|
||||
Test time can be inaccurate with small file caps and large files. As it
|
||||
uses the results of an initial test to determine how many files to use in
|
||||
each subsequent test.
|
||||
|
||||
|
||||
@@ -494,6 +494,7 @@ Not all global variables make sense to be overridden like this as the config is
|
||||
only applied during the remote creation. Here is a non exhaustive list of ones
|
||||
which might be useful:
|
||||
|
||||
- `allow_https_downgrade`
|
||||
- `bind_addr`
|
||||
- `ca_cert`
|
||||
- `client_cert`
|
||||
@@ -995,6 +996,21 @@ See also [--human-readable](#human-readable).
|
||||
|
||||
## Main options
|
||||
|
||||
### --allow-https-downgrade
|
||||
|
||||
By default rclone refuses to follow a redirect from an `https://` URL
|
||||
to a plain `http://` URL, as any credentials or other headers in the
|
||||
request would then be sent unencrypted, and the response could be
|
||||
altered by anyone on the network path. The request fails with an error
|
||||
which mentions this flag.
|
||||
|
||||
Set `--allow-https-downgrade` to follow such redirects, for example
|
||||
when downloading from a mirror which redirects to plain HTTP. Some
|
||||
backends still refuse to follow them, as doing so would send their
|
||||
credentials in cleartext.
|
||||
|
||||
This option defaults to `false`.
|
||||
|
||||
### --backup-dir string
|
||||
|
||||
When using [sync](/commands/rclone_sync/), [copy](/commands/rclone_copy/) or
|
||||
|
||||
@@ -1131,7 +1131,7 @@ recommended usage is using the flag form --drive-size-as-quota when
|
||||
doing rclone ls/lsl/lsf/lsjson/etc only.
|
||||
|
||||
If you do use this flag for syncing (not recommended) then you will
|
||||
need to use --ignore size also.
|
||||
need to use --ignore-size also.
|
||||
|
||||
Properties:
|
||||
|
||||
@@ -1838,7 +1838,7 @@ The result is a JSON array of matches, for example:
|
||||
"webViewLink": "https://drive.google.com/file/d/0AxBe_CDEF4zkGHI4d0FjYko2QkD/view?usp=drivesdk\u0026resourcekey=0-ABCDEFGHIXJQpIGqBJq3MC"
|
||||
}
|
||||
]
|
||||
```
|
||||
```console
|
||||
|
||||
### rescue
|
||||
|
||||
|
||||
+31
-9
@@ -98,6 +98,7 @@ Flags used for check commands.
|
||||
Flags for general networking and HTTP stuff.
|
||||
|
||||
```
|
||||
--allow-https-downgrade Follow redirects from HTTPS to HTTP (insecure)
|
||||
--bind string Local address to bind to for outgoing connections, IPv4, IPv6 or name
|
||||
--bwlimit BwTimetable Bandwidth limit in KiB/s, or use suffix B|K|M|G|T|P or a full timetable
|
||||
--bwlimit-file BwTimetable Bandwidth limit per file in KiB/s, or use suffix B|K|M|G|T|P or a full timetable
|
||||
@@ -121,7 +122,7 @@ Flags for general networking and HTTP stuff.
|
||||
--tpslimit float Limit HTTP transactions per second to this
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit (default 1)
|
||||
--use-cookies Enable session cookiejar
|
||||
--user-agent string Set the user-agent to a specified string (default "rclone/v1.75.0")
|
||||
--user-agent string Set the user-agent to a specified string (default "rclone/v1.76.0")
|
||||
```
|
||||
|
||||
|
||||
@@ -302,11 +303,6 @@ Flags to control the Remote Control API.
|
||||
--rc-template string User-specified template
|
||||
--rc-user string User name for authentication
|
||||
--rc-user-from-header string User name from a defined HTTP header
|
||||
--rc-web-fetch-url string URL to fetch the releases for webgui (default "https://api.github.com/repos/rclone/rclone-webui-react/releases/latest")
|
||||
--rc-web-gui Launch WebGUI on localhost
|
||||
--rc-web-gui-force-update Force update to latest version of web gui
|
||||
--rc-web-gui-no-open-browser Don't open the browser automatically
|
||||
--rc-web-gui-update Check and update to latest version of web gui
|
||||
```
|
||||
|
||||
|
||||
@@ -368,8 +364,10 @@ Backend-only flags (these can be set in the config file also).
|
||||
--azureblob-encoding Encoding The encoding for the backend (default Slash,BackSlash,Del,Ctl,RightPeriod,InvalidUtf8)
|
||||
--azureblob-endpoint string Endpoint for the service
|
||||
--azureblob-env-auth Read credentials from runtime (environment variables, CLI or MSI)
|
||||
--azureblob-hns Tristate Set if the storage account has a hierarchical namespace (default unset)
|
||||
--azureblob-key string Storage Account Shared Key
|
||||
--azureblob-list-chunk int Size of blob list (default 5000)
|
||||
--azureblob-list-parallelism int Number of parallel shards to list a directory with
|
||||
--azureblob-msi-client-id string Object ID of the user-assigned MSI to use, if any
|
||||
--azureblob-msi-mi-res-id string Azure resource ID of the user-assigned MSI to use, if any
|
||||
--azureblob-msi-object-id string Object ID of the user-assigned MSI to use, if any
|
||||
@@ -382,6 +380,7 @@ Backend-only flags (these can be set in the config file also).
|
||||
--azureblob-tenant string ID of the service principal's tenant. Also called its directory ID
|
||||
--azureblob-upload-concurrency int Concurrency for multipart uploads (default 16)
|
||||
--azureblob-upload-cutoff string Cutoff for switching to chunked upload (<= 256 MiB) (deprecated)
|
||||
--azureblob-use-arrow-list Use the Apache Arrow listing format
|
||||
--azureblob-use-az Use Azure CLI tool az for authentication
|
||||
--azureblob-use-copy-blob Whether to use the Copy Blob API when copying to the same storage account (default true)
|
||||
--azureblob-use-emulator Uses local storage emulator if provided as 'true'
|
||||
@@ -514,6 +513,12 @@ Backend-only flags (these can be set in the config file also).
|
||||
--doi-doi string The DOI or the doi.org URL
|
||||
--doi-doi-resolver-api-url string The URL of the DOI resolver API to use
|
||||
--doi-provider string DOI provider
|
||||
--dosya-api-key string Your API Key, get it from https://dosya.dev/profile under "API keys"
|
||||
--dosya-api-url string API base URL (default "https://api.dosya.dev")
|
||||
--dosya-description string Description of the remote
|
||||
--dosya-encoding Encoding The encoding for the backend (default Slash,LtGt,DoubleQuote,SingleQuote,BackSlash,Del,Ctl,LeftSpace,RightSpace,InvalidUtf8,Dot)
|
||||
--dosya-upload-concurrency int Concurrency for multipart uploads (default 4)
|
||||
--dosya-workspace-id string Your workspace ID
|
||||
--drime-access-token string API Access token
|
||||
--drime-chunk-size SizeSuffix Chunk size to use for uploading (default 5Mi)
|
||||
--drime-description string Description of the remote
|
||||
@@ -736,6 +741,8 @@ Backend-only flags (these can be set in the config file also).
|
||||
--http-headers CommaSepList Set HTTP headers for all transactions
|
||||
--http-no-escape Do not escape URL metacharacters in path names
|
||||
--http-no-head Don't use HEAD requests
|
||||
--http-no-head-size SizeSuffix Set the reported file size for --http-no-head (default off)
|
||||
--http-no-head-time Time Set a default modification time for --http-no-head (default off)
|
||||
--http-no-slash Set this if the site doesn't end directories with /
|
||||
--http-url string URL of HTTP host to connect to
|
||||
--huaweidrive-auth-url string Auth server URL
|
||||
@@ -795,6 +802,17 @@ Backend-only flags (these can be set in the config file also).
|
||||
--jottacloud-token-url string Token server url
|
||||
--jottacloud-trashed-only Only show files that are in the trash
|
||||
--jottacloud-upload-resume-limit SizeSuffix Files bigger than this can be resumed if the upload fail's (default 10Mi)
|
||||
--kdrive-auth-url string Auth server URL
|
||||
--kdrive-chunk-size SizeSuffix Files above this size are uploaded in chunks of this size (default 20Mi)
|
||||
--kdrive-client-id string OAuth Client Id
|
||||
--kdrive-description string Description of the remote
|
||||
--kdrive-drive-id string ID of the kDrive to use
|
||||
--kdrive-encoding Encoding The encoding for the backend (default Slash,Del,Ctl,LeftSpace,RightSpace,InvalidUtf8,Dot)
|
||||
--kdrive-endpoint string The API endpoint to use
|
||||
--kdrive-root-folder-id string The folder to use as root
|
||||
--kdrive-token string OAuth Access Token as a JSON blob
|
||||
--kdrive-token-url string Token server url
|
||||
--kdrive-upload-concurrency int Concurrency for chunked uploads (default 4)
|
||||
--koofr-description string Description of the remote
|
||||
--koofr-encoding Encoding The encoding for the backend (default Slash,BackSlash,Del,Ctl,InvalidUtf8,Dot)
|
||||
--koofr-endpoint string The Koofr API endpoint to use
|
||||
@@ -880,6 +898,7 @@ Backend-only flags (these can be set in the config file also).
|
||||
--onedrive-root-folder-id string ID of the root folder
|
||||
--onedrive-server-side-across-configs Deprecated: use --server-side-across-configs instead
|
||||
--onedrive-tenant string ID of the service principal's tenant. Also called its directory ID
|
||||
--onedrive-tenant-api-version string The SharePoint API version to use with tenant_url (default "v2.0")
|
||||
--onedrive-tenant-url string The tenant URL for non-admin OneDrive access
|
||||
--onedrive-token string OAuth Access Token as a JSON blob
|
||||
--onedrive-token-url string Token server url
|
||||
@@ -894,7 +913,7 @@ Backend-only flags (these can be set in the config file also).
|
||||
--oos-decompress If set this will decompress gzip encoded objects
|
||||
--oos-description string Description of the remote
|
||||
--oos-disable-checksum Don't store MD5 checksum with object metadata
|
||||
--oos-encoding Encoding The encoding for the backend (default Slash,InvalidUtf8,Dot)
|
||||
--oos-encoding Encoding The encoding for the backend (default Slash,CrLf,InvalidUtf8,Dot)
|
||||
--oos-endpoint string Endpoint for Object storage API
|
||||
--oos-leave-parts-on-error If true avoid calling abort upload on a failure, leaving all successfully uploaded parts for manual recovery
|
||||
--oos-max-upload-parts int Maximum number of parts in a multipart upload (default 10000)
|
||||
@@ -1089,7 +1108,7 @@ Backend-only flags (these can be set in the config file also).
|
||||
--sftp-disable-concurrent-reads If set don't use concurrent reads
|
||||
--sftp-disable-concurrent-writes If set don't use concurrent writes
|
||||
--sftp-disable-hashcheck Disable the execution of SSH commands to determine if remote file hashing is available
|
||||
--sftp-encoding Encoding The encoding for the backend (default Slash,Del,Ctl,Dot)
|
||||
--sftp-encoding Encoding The encoding for the backend (default Slash,Dot)
|
||||
--sftp-hashes CommaSepList Comma separated list of supported checksum types
|
||||
--sftp-host string SSH host to connect to
|
||||
--sftp-host-key-algorithms SpaceSepList Space separated list of host key algorithms, ordered by preference
|
||||
@@ -1104,6 +1123,7 @@ Backend-only flags (these can be set in the config file also).
|
||||
--sftp-known-hosts-file string Optional path to known_hosts file
|
||||
--sftp-macs SpaceSepList Space separated list of MACs (message authentication code) algorithms, ordered by preference
|
||||
--sftp-md5sum-command string The command used to read MD5 hashes
|
||||
--sftp-multithread-upload Set this to use multi-thread (multi-connection) uploads
|
||||
--sftp-pass string SSH password, leave blank to use ssh-agent (obscured)
|
||||
--sftp-path-override string Override path used by SSH shell commands
|
||||
--sftp-pin-host-key Pin the server host key on first connection (Trust On First Use)
|
||||
@@ -1166,7 +1186,8 @@ Backend-only flags (these can be set in the config file also).
|
||||
--smb-port int SMB port number (default 445)
|
||||
--smb-spn string Service principal name
|
||||
--smb-use-kerberos Use Kerberos authentication
|
||||
--smb-user string SMB username (default "$USER")
|
||||
--smb-user string SMB username
|
||||
--smb-workstation string Workstation name sent in NTLM authentication
|
||||
--storj-access-grant string Access grant
|
||||
--storj-api-key string API key
|
||||
--storj-description string Description of the remote
|
||||
@@ -1241,6 +1262,7 @@ Backend-only flags (these can be set in the config file also).
|
||||
--webdav-url string URL of http host to connect to
|
||||
--webdav-user string User name
|
||||
--webdav-vendor string Name of the WebDAV site/service/software you are using
|
||||
--yandex-app-folder Use the application folder as the root
|
||||
--yandex-auth-url string Auth server URL
|
||||
--yandex-client-credentials Use client credentials OAuth flow
|
||||
--yandex-client-id string OAuth Client Id
|
||||
|
||||
@@ -212,6 +212,13 @@ For example, to set a Cookie use 'Cookie,name=value', or '"Cookie","name=value"'
|
||||
|
||||
You can set multiple headers, e.g. '"Cookie","name=value","Authorization","xxx"'.
|
||||
|
||||
The headers are only sent to the host in the configured URL. If the
|
||||
server redirects to another host (including a subdomain or a different
|
||||
port) the headers are not sent to it, or to any further hop in that
|
||||
redirect chain. When headers are set, a redirect from https to http is
|
||||
refused as it would send them in cleartext, even with
|
||||
--allow-https-downgrade.
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: headers
|
||||
@@ -265,6 +272,42 @@ Properties:
|
||||
- Type: bool
|
||||
- Default: false
|
||||
|
||||
#### --http-no-head-size
|
||||
|
||||
Set the reported file size for --http-no-head.
|
||||
|
||||
When HEAD requests are disabled, rclone normally reports an unknown file size.
|
||||
Set this option to a non-negative value to report that size for every file,
|
||||
including 0. Leave it unset (the default, shown as "off") to keep reporting
|
||||
an unknown size.
|
||||
|
||||
The configured size is authoritative. If it does not match the actual file
|
||||
size, transfers may fail their size check and retry unless --ignore-size is
|
||||
used. It can also make multi-thread transfers request incorrect ranges and
|
||||
make mounted files unreadable past the reported size.
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: no_head_size
|
||||
- Env Var: RCLONE_HTTP_NO_HEAD_SIZE
|
||||
- Type: SizeSuffix
|
||||
- Default: off
|
||||
|
||||
#### --http-no-head-time
|
||||
|
||||
Set a default modification time for --http-no-head.
|
||||
|
||||
When HEAD requests are disabled, rclone normally reports an unset modification
|
||||
time. Set this option to report the specified time for every file instead.
|
||||
Changing the configured time later makes every file appear modified to a sync.
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: no_head_time
|
||||
- Env Var: RCLONE_HTTP_NO_HEAD_TIME
|
||||
- Type: Time
|
||||
- Default: off
|
||||
|
||||
#### --http-description
|
||||
|
||||
Description of the remote.
|
||||
|
||||
+15
-6
@@ -583,6 +583,13 @@ deduplicated by default (i.e. having two identical files does not consume more
|
||||
storage than having just one.) However, for use cases where data redundancy is
|
||||
preferable, --local-no-clone can be used to disable cloning and force "deep" copies.
|
||||
|
||||
Cloning also preserves macOS-specific metadata such as extended attributes,
|
||||
which a normal copy does not, so this metadata is lost when cloning is disabled.
|
||||
|
||||
If the destination file already exists, cloning replaces it with a new file,
|
||||
even with --inplace, so hard links to it are broken. Use --local-no-clone to
|
||||
update existing files in place.
|
||||
|
||||
Currently, cloning is only supported when using APFS on macOS (support for other
|
||||
platforms may be added in the future.)
|
||||
|
||||
@@ -672,10 +679,10 @@ Properties:
|
||||
|
||||
Make out-of-space errors fatal during transfers.
|
||||
|
||||
When enabled, an ENOSPC error during a write returns a fatal error so
|
||||
that rclone aborts rather than retrying the operation. Useful for
|
||||
backup scripts that should halt loudly on a full disk rather than spin
|
||||
retrying.
|
||||
When enabled, an out of space error while writing, creating a directory,
|
||||
or creating a file returns a fatal error so that rclone aborts rather
|
||||
than retrying the operation. Useful for backup scripts that should halt
|
||||
loudly on a full disk rather than spin retrying.
|
||||
|
||||
Properties:
|
||||
|
||||
@@ -773,8 +780,10 @@ Metadata is supported on files and directories.
|
||||
When restoring metadata with `--metadata` rclone applies the
|
||||
"mode", "uid" and "gid" from the source. These come from the source
|
||||
remote which may not be trusted, so restoring metadata as root from an
|
||||
untrusted source can change file ownership and is not recommended. The
|
||||
setuid, setgid and sticky bits are not restored by default - see the
|
||||
untrusted source can change file ownership and is not recommended. A
|
||||
user other than root keeps its own uid and sets the gid only to a group
|
||||
it is a member of, as rsync does. The setuid, setgid and sticky bits are
|
||||
not restored by default - see the
|
||||
`--local-metadata-restore-special-bits` flag.
|
||||
|
||||
Here are the possible system metadata items for the local backend.
|
||||
|
||||
+68
-27
@@ -10,6 +10,10 @@ Paths are specified as `remote:path`
|
||||
|
||||
Paths may be as deep as required, e.g. `remote:directory/subdirectory`.
|
||||
|
||||
**Note**: OneDrive for Business and SharePoint users need rclone
|
||||
v1.76 or later from April 1, 2027 - see
|
||||
[Pre-authenticated URLs](#pre-authenticated-urls).
|
||||
|
||||
## Configuration
|
||||
|
||||
The initial setup for OneDrive involves getting a token from
|
||||
@@ -524,7 +528,7 @@ Properties:
|
||||
|
||||
The tenant URL for non-admin OneDrive access.
|
||||
|
||||
Set this to your SharePoint tenant URL to use the SharePoint v2.0 API
|
||||
Set this to your SharePoint tenant URL to use the SharePoint API
|
||||
endpoint instead of the standard Microsoft Graph API. This allows
|
||||
accessing business OneDrive without admin consent.
|
||||
|
||||
@@ -541,6 +545,22 @@ Properties:
|
||||
- Type: string
|
||||
- Required: false
|
||||
|
||||
#### --onedrive-tenant-api-version
|
||||
|
||||
The SharePoint API version to use with tenant_url.
|
||||
|
||||
Set this to the SharePoint API version matching the browser-extracted
|
||||
access token. For example, use v2.1 with a driveAccessTokenV21 token.
|
||||
|
||||
This only applies when tenant_url is set.
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: tenant_api_version
|
||||
- Env Var: RCLONE_ONEDRIVE_TENANT_API_VERSION
|
||||
- Type: string
|
||||
- Default: "v2.0"
|
||||
|
||||
#### --onedrive-chunk-size
|
||||
|
||||
Chunk size to upload files with - must be multiple of 320k (327,680 bytes).
|
||||
@@ -667,7 +687,7 @@ Properties:
|
||||
|
||||
Remove all versions on modifying operations.
|
||||
|
||||
Onedrive for business creates versions when rclone uploads new files
|
||||
Onedrive creates versions when rclone uploads new files
|
||||
overwriting an existing one and when it sets the modification time.
|
||||
|
||||
These versions take up space out of the quota.
|
||||
@@ -675,9 +695,6 @@ These versions take up space out of the quota.
|
||||
This flag checks for versions after file upload and setting
|
||||
modification time and removes all but the last version.
|
||||
|
||||
**NB** Onedrive personal can't currently delete versions so don't use
|
||||
this flag there.
|
||||
|
||||
|
||||
Properties:
|
||||
|
||||
@@ -693,8 +710,7 @@ Permanently delete files on removal.
|
||||
Normally files will get sent to the recycle bin on deletion. Setting
|
||||
this flag causes them to be permanently deleted. Use with care.
|
||||
|
||||
OneDrive personal accounts do not support the permanentDelete API,
|
||||
it only applies to OneDrive for Business and SharePoint document libraries.
|
||||
This works with OneDrive for Business, SharePoint document libraries, and OneDrive personal accounts, including free accounts.
|
||||
|
||||
|
||||
Properties:
|
||||
@@ -740,12 +756,17 @@ Properties:
|
||||
- Creates a read-write link to the item.
|
||||
- "embed"
|
||||
- Creates an embeddable link to the item.
|
||||
- Only available in OneDrive personal.
|
||||
|
||||
#### --onedrive-link-password
|
||||
|
||||
Set the password for links created by the link command.
|
||||
|
||||
At the time of writing this only works with OneDrive personal paid accounts.
|
||||
At the time of writing this works with OneDrive for Business and
|
||||
OneDrive personal paid accounts.
|
||||
|
||||
OneDrive personal free accounts can't set a password or an expiry time
|
||||
(with --expire) on links.
|
||||
|
||||
|
||||
Properties:
|
||||
@@ -844,21 +865,12 @@ Setting this flag speeds up these things greatly:
|
||||
rclone size onedrive:
|
||||
rclone rc vfs/refresh recursive=true
|
||||
|
||||
**However** the delta listing API **only** works at the root of the
|
||||
drive. If you use it not at the root then it recurses from the root
|
||||
and discards all the data that is not under the directory you asked
|
||||
for. So it will be correct but may not be very efficient.
|
||||
|
||||
This is why this flag is not set as the default.
|
||||
|
||||
As a rule of thumb if nearly all of your data is under rclone's root
|
||||
directory (the `root/directory` in `onedrive:root/directory`) then
|
||||
using this flag will be a big performance win. If your data is
|
||||
mostly not under the root then using this flag will be a big
|
||||
performance loss.
|
||||
|
||||
It is recommended if you are mounting your onedrive at the root
|
||||
(or near the root when using crypt) and using rclone `rc vfs/refresh`.
|
||||
Rclone asks for the delta listing of the directory being listed. If
|
||||
the drive only supports delta listings at the root of the drive (as
|
||||
some older OneDrive for Business and SharePoint drives do) then
|
||||
rclone lists from the root and discards all the data that is not
|
||||
under the directory you asked for. So it will be correct but may not
|
||||
be very efficient.
|
||||
|
||||
|
||||
Properties:
|
||||
@@ -1056,7 +1068,7 @@ Here are the possible system metadata items for the onedrive backend.
|
||||
|
||||
| Name | Help | Type | Example | Read Only |
|
||||
|------|------|------|---------|-----------|
|
||||
| btime | Time of file birth (creation) with S accuracy (mS for OneDrive Personal). | RFC 3339 | 2006-01-02T15:04:05Z | N |
|
||||
| btime | Time of file birth (creation) with S accuracy. | RFC 3339 | 2006-01-02T15:04:05Z | N |
|
||||
| content-type | The MIME type of the file. | string | text/plain | **Y** |
|
||||
| created-by-display-name | Display name of the user that created the item. | string | John Doe | **Y** |
|
||||
| created-by-id | ID of the user that created the item. | string | 48d31887-5fad-4d73-a9f5-3c356e68a038 | **Y** |
|
||||
@@ -1065,14 +1077,14 @@ Here are the possible system metadata items for the onedrive backend.
|
||||
| last-modified-by-display-name | Display name of the user that last modified the item. | string | John Doe | **Y** |
|
||||
| last-modified-by-id | ID of the user that last modified the item. | string | 48d31887-5fad-4d73-a9f5-3c356e68a038 | **Y** |
|
||||
| malware-detected | Whether OneDrive has detected that the item contains malware. | boolean | true | **Y** |
|
||||
| mtime | Time of last modification with S accuracy (mS for OneDrive Personal). | RFC 3339 | 2006-01-02T15:04:05Z | N |
|
||||
| mtime | Time of last modification with S accuracy. | RFC 3339 | 2006-01-02T15:04:05Z | N |
|
||||
| package-type | If present, indicates that this item is a package instead of a folder or file. Packages are treated like files in some contexts and folders in others. | string | oneNote | **Y** |
|
||||
| permissions | Permissions in a JSON dump of OneDrive format. Enable with --onedrive-metadata-permissions. Properties: id, grantedTo, grantedToIdentities, invitation, inheritedFrom, link, roles, shareId | JSON | {} | N |
|
||||
| shared-by-id | ID of the user that shared the item (if shared). | string | 48d31887-5fad-4d73-a9f5-3c356e68a038 | **Y** |
|
||||
| shared-owner-id | ID of the owner of the shared item (if shared). | string | 48d31887-5fad-4d73-a9f5-3c356e68a038 | **Y** |
|
||||
| shared-scope | If shared, indicates the scope of how the item is shared: anonymous, organization, or users. | string | users | **Y** |
|
||||
| shared-time | Time when the item was shared, with S accuracy (mS for OneDrive Personal). | RFC 3339 | 2006-01-02T15:04:05Z | **Y** |
|
||||
| utime | Time of upload with S accuracy (mS for OneDrive Personal). | RFC 3339 | 2006-01-02T15:04:05Z | **Y** |
|
||||
| shared-time | Time when the item was shared, with S accuracy. | RFC 3339 | 2006-01-02T15:04:05Z | **Y** |
|
||||
| utime | Time of upload with S accuracy. | RFC 3339 | 2006-01-02T15:04:05Z | **Y** |
|
||||
|
||||
See the [metadata](/docs/#metadata) docs for more info.
|
||||
|
||||
@@ -1226,6 +1238,35 @@ rclone cleanup remote:path/subdir # unconditionally remove all old
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Pre-authenticated URLs
|
||||
|
||||
Microsoft is [retiring pre-authenticated (tempauth) URLs](https://devblogs.microsoft.com/microsoft365dev/pre-authenticated-tempauth-urls-are-retiring-move-to-microsoft-entra-id-tokens-before-april-1-2027/)
|
||||
in OneDrive for Business and SharePoint from April 1, 2027.
|
||||
|
||||
**Upgrade to rclone v1.76 or later before April 1, 2027.** Earlier
|
||||
versions rely on pre-authenticated URLs, so after that date their
|
||||
downloads, chunked uploads and server-side copies will fail with
|
||||
OneDrive for Business and SharePoint. Rclone v1.76 and later keep
|
||||
working with the existing configuration, apart from the client
|
||||
credentials flow with a client secret (see below).
|
||||
|
||||
Rclone uses these URLs when downloading files, when uploading files
|
||||
bigger than `--onedrive-upload-cutoff` in chunks and when doing
|
||||
server-side copies. When SharePoint returns them without
|
||||
pre-authentication rclone authenticates them with a SharePoint token
|
||||
which it gets using the existing login, so no reconfiguration is
|
||||
needed. OneDrive Personal is not affected.
|
||||
|
||||
If rclone can't get a SharePoint token, or SharePoint refuses it, you
|
||||
will see the error `SharePoint refused to authenticate a request`. In
|
||||
this case rclone uploads files smaller than 250 MiB in a single
|
||||
request instead and copies files by downloading and uploading them,
|
||||
but bigger files can't be uploaded and downloads may fail.
|
||||
|
||||
SharePoint does not accept tokens from the client credentials flow
|
||||
which were got with a client secret, so this affects
|
||||
`client_credentials` users.
|
||||
|
||||
### Excessive throttling or blocked on SharePoint
|
||||
|
||||
If you experience excessive throttling or is being blocked on SharePoint then
|
||||
|
||||
@@ -610,7 +610,7 @@ Properties:
|
||||
- Config: encoding
|
||||
- Env Var: RCLONE_OOS_ENCODING
|
||||
- Type: Encoding
|
||||
- Default: Slash,InvalidUtf8,Dot
|
||||
- Default: Slash,CrLf,InvalidUtf8,Dot
|
||||
|
||||
#### --oos-leave-parts-on-error
|
||||
|
||||
|
||||
@@ -196,6 +196,8 @@ Properties:
|
||||
|
||||
Files bigger than this will be cached on disk to calculate hash if required.
|
||||
|
||||
Files of unknown size are always cached on disk.
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: hash_memory_limit
|
||||
|
||||
+107
-83
@@ -232,6 +232,9 @@ If this is set then no authorisation will be required on the server to
|
||||
use these methods. The alternative is to use `--rc-user` and
|
||||
`--rc-pass` and use these credentials in the request.
|
||||
|
||||
Without authorisation or this flag, POST request bodies are limited to
|
||||
64 KiB.
|
||||
|
||||
Default Off.
|
||||
|
||||
### --rc-baseurl
|
||||
@@ -1222,6 +1225,7 @@ Returns the following values:
|
||||
"totalTransfers": total number of transfers in the group,
|
||||
"transferTime" : total time spent on running jobs,
|
||||
"transfers": number of transferred files,
|
||||
"updatedDirs": number of directories updated (modtime or metadata set),
|
||||
"transferring": an array of currently active file transfers:
|
||||
[
|
||||
{
|
||||
@@ -1487,8 +1491,6 @@ Results:
|
||||
- runningIds - array of integer job ids that are running
|
||||
- finishedIds - array of integer job ids that are finished
|
||||
|
||||
**Authentication is not required for this call.**
|
||||
|
||||
### job/status: Reads the status of the job ID {#job-status}
|
||||
|
||||
Parameters:
|
||||
@@ -1509,8 +1511,6 @@ Results:
|
||||
- output - output of the job as would have been returned if called synchronously
|
||||
- progress - output of the progress related to the underlying job
|
||||
|
||||
**Authentication is not required for this call.**
|
||||
|
||||
### job/stop: Stop the running job {#job-stop}
|
||||
|
||||
Parameters:
|
||||
@@ -1840,6 +1840,25 @@ This command does not have a command line equivalent so use this instead:
|
||||
|
||||
rclone rc --loopback operations/fsinfo fs=remote:
|
||||
|
||||
### operations/getfile: Get a single file into a JSON response. {#operations-getfile}
|
||||
|
||||
This takes the following parameters:
|
||||
|
||||
- fs - a remote name string e.g. "drive:path/to/file" or "drive:path/to/dir"
|
||||
- remote - (optional) a path within that remote e.g. "file.txt"
|
||||
- offset - (optional) start reading at offset N (or from end if negative) (default 0)
|
||||
- count - (optional) only read N bytes (default -1)
|
||||
- head - (optional) only read the first N bytes (default 0)
|
||||
- tail - (optional) only read the last N bytes (default 0)
|
||||
- maxSize - (optional) maximum size limit in bytes (can only lower the built-in maximum) (default 2097152 / 2MiB)
|
||||
- base64 - (optional) if true, returns the file contents base64-encoded (default false)
|
||||
|
||||
Returns:
|
||||
|
||||
- result - contents of the file as string or base64-encoded string
|
||||
|
||||
For streaming file content over HTTP with Range support, use the --rc-serve flag instead.
|
||||
|
||||
### operations/hashsum: Produces a hashsum file for all the objects in the path. {#operations-hashsum}
|
||||
|
||||
Produces a hash file for all the objects in the path using the hash
|
||||
@@ -1914,6 +1933,26 @@ Example:
|
||||
|
||||
See the [hashsum](/commands/rclone_hashsum/) command for more information on the above.
|
||||
|
||||
### operations/index: Write static directory listings into a remote {#operations-index}
|
||||
|
||||
This takes the following parameters:
|
||||
|
||||
- fs - a remote name string e.g. "drive:"
|
||||
- opt - a dictionary of options to control the indexing (optional)
|
||||
- output - list of listings to write in each directory as "NAME=FORMAT" (default ["index.html=html"])
|
||||
- rules - which directories get listings, e.g. {"ExcludeRule": ["/private/**"]}
|
||||
- maxDepth - only make listings this many directories deep (default -1 for no limit)
|
||||
- linkIndex - link to "dir/NAME" rather than "dir/"
|
||||
- dirTime - how to work out directory times: "newest", "dir" or "none"
|
||||
- noModTime - don't show modification times
|
||||
- rewrite - write every listing even if it is unchanged
|
||||
- changed - list of changed paths for a partial run, directories ending in "/"
|
||||
- changedFrom - list of files of changed paths, one per line
|
||||
- changedCombined - list of files in the sync --combined report format
|
||||
- changedMaxDirs - do a full run if a partial one would list more directories than this
|
||||
|
||||
See the [index](/commands/rclone_index/) command for more information on the above.
|
||||
|
||||
### operations/list: List the given remote and path in JSON format {#operations-list}
|
||||
|
||||
This takes the following parameters:
|
||||
@@ -2133,85 +2172,6 @@ And this sets NOTICE level logs (normal without -v)
|
||||
|
||||
rclone rc options/set --json '{"main": {"LogLevel": "NOTICE"}}'
|
||||
|
||||
### pluginsctl/addPlugin: Add a plugin using url {#pluginsctl-addPlugin}
|
||||
|
||||
Used for adding a plugin to the webgui.
|
||||
|
||||
This takes the following parameters:
|
||||
|
||||
- url - http url of the github repo where the plugin is hosted (http://github.com/rclone/rclone-webui-react).
|
||||
|
||||
Example:
|
||||
|
||||
rclone rc pluginsctl/addPlugin
|
||||
|
||||
### pluginsctl/getPluginsForType: Get plugins with type criteria {#pluginsctl-getPluginsForType}
|
||||
|
||||
This shows all possible plugins by a mime type.
|
||||
|
||||
This takes the following parameters:
|
||||
|
||||
- type - supported mime type by a loaded plugin e.g. (video/mp4, audio/mp3).
|
||||
- pluginType - filter plugins based on their type e.g. (DASHBOARD, FILE_HANDLER, TERMINAL).
|
||||
|
||||
Returns:
|
||||
|
||||
- loadedPlugins - list of current production plugins.
|
||||
- testPlugins - list of temporarily loaded development plugins, usually running on a different server.
|
||||
|
||||
Example:
|
||||
|
||||
rclone rc pluginsctl/getPluginsForType type=video/mp4
|
||||
|
||||
### pluginsctl/listPlugins: Get the list of currently loaded plugins {#pluginsctl-listPlugins}
|
||||
|
||||
This allows you to get the currently enabled plugins and their details.
|
||||
|
||||
This takes no parameters and returns:
|
||||
|
||||
- loadedPlugins - list of current production plugins.
|
||||
- testPlugins - list of temporarily loaded development plugins, usually running on a different server.
|
||||
|
||||
E.g.
|
||||
|
||||
rclone rc pluginsctl/listPlugins
|
||||
|
||||
### pluginsctl/listTestPlugins: Show currently loaded test plugins {#pluginsctl-listTestPlugins}
|
||||
|
||||
Allows listing of test plugins with the rclone.test set to true in package.json of the plugin.
|
||||
|
||||
This takes no parameters and returns:
|
||||
|
||||
- loadedTestPlugins - list of currently available test plugins.
|
||||
|
||||
E.g.
|
||||
|
||||
rclone rc pluginsctl/listTestPlugins
|
||||
|
||||
### pluginsctl/removePlugin: Remove a loaded plugin {#pluginsctl-removePlugin}
|
||||
|
||||
This allows you to remove a plugin using it's name.
|
||||
|
||||
This takes parameters:
|
||||
|
||||
- name - name of the plugin in the format `author`/`plugin_name`.
|
||||
|
||||
E.g.
|
||||
|
||||
rclone rc pluginsctl/removePlugin name=rclone/video-plugin
|
||||
|
||||
### pluginsctl/removeTestPlugin: Remove a test plugin {#pluginsctl-removeTestPlugin}
|
||||
|
||||
This allows you to remove a plugin using it's name.
|
||||
|
||||
This takes the following parameters:
|
||||
|
||||
- name - name of the plugin in the format `author`/`plugin_name`.
|
||||
|
||||
Example:
|
||||
|
||||
rclone rc pluginsctl/removeTestPlugin name=rclone/rclone-webui-react
|
||||
|
||||
### rc/error: This returns an error {#rc-error}
|
||||
|
||||
This returns an error with the input as part of its error string.
|
||||
@@ -2386,6 +2346,8 @@ This takes the following parameters:
|
||||
- path1 (required) - (string) a remote directory string e.g. `drive:path1`
|
||||
- path2 (required) - (string) a remote directory string e.g. `drive:path2`
|
||||
- dryRun - (bool) dry-run mode
|
||||
- maxDelete - (int) Safety check on maximum percentage of deleted files
|
||||
allowed. If exceeded, the bisync run will abort. (default: 50%)
|
||||
- backupDir1 - (string) --backup-dir for Path1. Must be a non-overlapping path on
|
||||
the same remote.
|
||||
- backupDir2 - (string) --backup-dir for Path2. Must be a non-overlapping path on
|
||||
@@ -2415,6 +2377,8 @@ unavailable. (warning: may be slow and use lots of data!)
|
||||
using with --verbose
|
||||
- ignoreListingChecksum - (bool) Do not use checksums for listings (add --ignore-
|
||||
checksum to additionally skip post-copy checksum checks)
|
||||
- maxDeleteRenamesAware - (bool) Exclude tracked renames from the --max-delete
|
||||
safety check (requires --track-renames)
|
||||
- maxLock - (Duration) Consider lock files older than this to be expired
|
||||
(default: 0 (never expire)) (minimum: 2m)
|
||||
- noCleanup - (bool) Retain working files (useful for troubleshooting and
|
||||
@@ -2448,7 +2412,27 @@ This takes the following parameters:
|
||||
- srcFs - a remote name string e.g. "drive:src" for the source
|
||||
- dstFs - a remote name string e.g. "drive:dst" for the destination
|
||||
- createEmptySrcDirs - create empty src directories on destination if set
|
||||
- combined - make a combined report of changes (default false)
|
||||
- missingOnSrc - report all files missing from the source (default false)
|
||||
- missingOnDst - report all files missing from the destination (default false)
|
||||
- match - report all matching files (default false)
|
||||
- differ - report all non-matching files (default false)
|
||||
- error - report all files with errors (hashing or reading) (default false)
|
||||
- destAfter - report all files that exist on the destination post-copy (default false)
|
||||
|
||||
Returns:
|
||||
|
||||
- combined - array of strings of combined report of changes
|
||||
- missingOnSrc - array of strings of all files missing from the source
|
||||
- missingOnDst - array of strings of all files missing from the destination
|
||||
- match - array of strings of all matching files
|
||||
- differ - array of strings of all non-matching files
|
||||
- error - array of strings of all files with errors (hashing or reading)
|
||||
- destAfter - array of strings of all files that exist on the destination post-copy
|
||||
|
||||
Each report is only returned if its parameter is set to true. If the
|
||||
operation fails the reports are only available if it was run with
|
||||
`_async`, as part of the job output.
|
||||
|
||||
See the [copy](/commands/rclone_copy/) command for more information on the above.
|
||||
|
||||
@@ -2460,7 +2444,27 @@ This takes the following parameters:
|
||||
- dstFs - a remote name string e.g. "drive:dst" for the destination
|
||||
- createEmptySrcDirs - create empty src directories on destination if set
|
||||
- deleteEmptySrcDirs - delete empty src directories if set
|
||||
- combined - make a combined report of changes (default false)
|
||||
- missingOnSrc - report all files missing from the source (default false)
|
||||
- missingOnDst - report all files missing from the destination (default false)
|
||||
- match - report all matching files (default false)
|
||||
- differ - report all non-matching files (default false)
|
||||
- error - report all files with errors (hashing or reading) (default false)
|
||||
- destAfter - report all files that exist on the destination post-move (default false)
|
||||
|
||||
Returns:
|
||||
|
||||
- combined - array of strings of combined report of changes
|
||||
- missingOnSrc - array of strings of all files missing from the source
|
||||
- missingOnDst - array of strings of all files missing from the destination
|
||||
- match - array of strings of all matching files
|
||||
- differ - array of strings of all non-matching files
|
||||
- error - array of strings of all files with errors (hashing or reading)
|
||||
- destAfter - array of strings of all files that exist on the destination post-move
|
||||
|
||||
Each report is only returned if its parameter is set to true. If the
|
||||
operation fails the reports are only available if it was run with
|
||||
`_async`, as part of the job output.
|
||||
|
||||
See the [move](/commands/rclone_move/) command for more information on the above.
|
||||
|
||||
@@ -2471,7 +2475,27 @@ This takes the following parameters:
|
||||
- srcFs - a remote name string e.g. "drive:src" for the source
|
||||
- dstFs - a remote name string e.g. "drive:dst" for the destination
|
||||
- createEmptySrcDirs - create empty src directories on destination if set
|
||||
- combined - make a combined report of changes (default false)
|
||||
- missingOnSrc - report all files missing from the source (default false)
|
||||
- missingOnDst - report all files missing from the destination (default false)
|
||||
- match - report all matching files (default false)
|
||||
- differ - report all non-matching files (default false)
|
||||
- error - report all files with errors (hashing or reading) (default false)
|
||||
- destAfter - report all files that exist on the destination post-sync (default false)
|
||||
|
||||
Returns:
|
||||
|
||||
- combined - array of strings of combined report of changes
|
||||
- missingOnSrc - array of strings of all files missing from the source
|
||||
- missingOnDst - array of strings of all files missing from the destination
|
||||
- match - array of strings of all matching files
|
||||
- differ - array of strings of all non-matching files
|
||||
- error - array of strings of all files with errors (hashing or reading)
|
||||
- destAfter - array of strings of all files that exist on the destination post-sync
|
||||
|
||||
Each report is only returned if its parameter is set to true. If the
|
||||
operation fails the reports are only available if it was run with
|
||||
`_async`, as part of the job output.
|
||||
|
||||
See the [sync](/commands/rclone_sync/) command for more information on the above.
|
||||
|
||||
|
||||
+546
-74
@@ -34,6 +34,7 @@ The S3 backend can be used with a number of different providers:
|
||||
{{< provider name="IBM COS S3" home="http://www.ibm.com/cloud/object-storage" config="/s3/#ibm-cos-s3" >}}
|
||||
{{< provider name="IDrive e2" home="https://www.idrive.com/e2/?refer=rclone" config="/s3/#idrive-e2" >}}
|
||||
{{< provider name="Impossible Cloud" home="https://www.impossiblecloud.com/" config="/s3/#impossible-cloud" >}}
|
||||
{{< provider name="Infomaniak Swiss Backup" home="https://www.infomaniak.com/en/swiss-backup/cloud-storage" config="/s3/#infomaniak" >}}
|
||||
{{< provider name="Intercolo Object Storage" home="https://intercolo.de/object-storage" config="/s3/#intercolo" >}}
|
||||
{{< provider name="IONOS Cloud" home="https://cloud.ionos.com/storage/object-storage" config="/s3/#ionos" >}}
|
||||
{{< provider name="Leviia Object Storage" home="https://www.leviia.com/object-storage/" config="/s3/#leviia" >}}
|
||||
@@ -42,6 +43,7 @@ The S3 backend can be used with a number of different providers:
|
||||
{{< provider name="Magalu Object Storage" home="https://magalu.cloud/object-storage/" config="/s3/#magalu" >}}
|
||||
{{< provider name="MEGA S4 Object Storage" home="https://mega.io/objectstorage" config="/s3/#mega" >}}
|
||||
{{< provider name="Minio" home="https://www.minio.io/" config="/s3/#minio" >}}
|
||||
{{< provider name="Neon Object Storage" home="https://neon.com/docs/storage/overview" config="/s3/#neon" >}}
|
||||
{{< provider name="Outscale" home="https://en.outscale.com/storage/outscale-object-storage/" config="/s3/#outscale" >}}
|
||||
{{< provider name="OVHcloud" home="https://www.ovhcloud.com/en/public-cloud/object-storage/" config="/s3/#ovhcloud" >}}
|
||||
{{< provider name="Petabox" home="https://petabox.io/" config="/s3/#petabox" >}}
|
||||
@@ -973,7 +975,7 @@ mode from COMPLIANCE to GOVERNANCE while preserving the original retention date:
|
||||
<!-- autogenerated options start - DO NOT EDIT - instead edit fs.RegInfo in backend/s3/s3.go and run make backenddocs to verify --> <!-- markdownlint-disable-line line-length -->
|
||||
### Standard options
|
||||
|
||||
Here are the Standard options specific to s3 (Amazon S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, BizflyCloud, Ceph, ChinaMobile, Cloudflare, Cubbit, DigitalOcean, Dreamhost, Exaba, Fastly, FileLu, FlashBlade, GCS, HCP, Hetzner, HuaweiOBS, IBMCOS, IDrive, ImpossibleCloud, Intercolo, IONOS, Leviia, Liara, Linode, LyveCloud, Magalu, Mega, Minio, Netease, Outscale, OVHcloud, Petabox, Qiniu, Rabata, RackCorp, Rclone, Scaleway, Scality, SeaweedFS, Selectel, Servercore, SpectraLogic, Storj, Synology, TencentCOS, US3, Wasabi, Zadara, Zata, ZeroServices, Other).
|
||||
Here are the Standard options specific to s3 (Amazon S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, Autonomys, BizflyCloud, Cellar, Ceph, ChinaMobile, Cloudflare, Cubbit, DigitalOcean, Dreamhost, Exaba, Fastly, FileLu, FlashBlade, GCS, HCP, Hetzner, HuaweiOBS, IBMCOS, IDrive, ImpossibleCloud, Infomaniak, Intercolo, IONOS, Leviia, Liara, Linode, LyveCloud, Magalu, Mega, Minio, Neon, Netease, Outscale, OVHcloud, Petabox, Qiniu, Rabata, RackCorp, Rclone, RelAix, Scaleway, Scality, SeaweedFS, Selectel, Servercore, SpectraLogic, Storj, Synology, TencentCOS, US3, Wasabi, Zadara, Zata, ZeroServices, Other).
|
||||
|
||||
#### --s3-provider
|
||||
|
||||
@@ -992,8 +994,12 @@ Properties:
|
||||
- Alibaba Cloud Object Storage System (OSS) formerly Aliyun
|
||||
- "ArvanCloud"
|
||||
- Arvan Cloud Object Storage (AOS)
|
||||
- "Autonomys"
|
||||
- Autonomys Auto Drive
|
||||
- "BizflyCloud"
|
||||
- Bizfly Cloud Simple Storage
|
||||
- "Cellar"
|
||||
- Clever Cloud Cellar Object Storage
|
||||
- "Ceph"
|
||||
- Ceph Object Storage
|
||||
- "ChinaMobile"
|
||||
@@ -1028,6 +1034,8 @@ Properties:
|
||||
- IDrive e2
|
||||
- "ImpossibleCloud"
|
||||
- Impossible Cloud Object Storage
|
||||
- "Infomaniak"
|
||||
- Infomaniak Swiss Backup
|
||||
- "Intercolo"
|
||||
- Intercolo Object Storage
|
||||
- "IONOS"
|
||||
@@ -1046,6 +1054,8 @@ Properties:
|
||||
- MEGA S4 Object Storage
|
||||
- "Minio"
|
||||
- Minio Object Storage
|
||||
- "Neon"
|
||||
- Neon Object Storage
|
||||
- "Netease"
|
||||
- Netease Object Storage (NOS)
|
||||
- "Outscale"
|
||||
@@ -1062,6 +1072,8 @@ Properties:
|
||||
- RackCorp Object Storage
|
||||
- "Rclone"
|
||||
- Rclone S3 Server
|
||||
- "RelAix"
|
||||
- RelAix.Storage
|
||||
- "Scaleway"
|
||||
- Scaleway Object Storage
|
||||
- "Scality"
|
||||
@@ -1147,7 +1159,7 @@ Properties:
|
||||
|
||||
- Config: region
|
||||
- Env Var: RCLONE_S3_REGION
|
||||
- Provider: AWS,BizflyCloud,Ceph,Cloudflare,Cubbit,DigitalOcean,Dreamhost,Exaba,Fastly,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IBMCOS,ImpossibleCloud,Intercolo,IONOS,Leviia,LyveCloud,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,Rabata,RackCorp,Scaleway,Scality,SeaweedFS,Selectel,Servercore,Synology,Wasabi,Zadara,Zata,ZeroServices,Other
|
||||
- Provider: AWS,BizflyCloud,Ceph,Cloudflare,Cubbit,DigitalOcean,Dreamhost,Exaba,Fastly,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IBMCOS,ImpossibleCloud,Infomaniak,Intercolo,IONOS,Leviia,LyveCloud,Minio,Neon,Netease,Outscale,OVHcloud,Petabox,Qiniu,Rabata,RackCorp,Scaleway,Scality,SeaweedFS,Selectel,Servercore,Synology,Wasabi,Zadara,Zata,ZeroServices,Other
|
||||
- Type: string
|
||||
- Required: false
|
||||
- Examples:
|
||||
@@ -1282,6 +1294,9 @@ Properties:
|
||||
- "eu-central"
|
||||
- EU Central
|
||||
- Provider: Fastly
|
||||
- "eu-central-1"
|
||||
- EU Central 1
|
||||
- Provider: Fastly
|
||||
- "eu-south-1"
|
||||
- EU South 1
|
||||
- Provider: Fastly
|
||||
@@ -1333,50 +1348,104 @@ Properties:
|
||||
- "nbg1"
|
||||
- Nuremberg
|
||||
- Provider: Hetzner
|
||||
- "af-north-1"
|
||||
- AF-Cairo
|
||||
- Provider: HuaweiOBS
|
||||
- "af-south-1"
|
||||
- AF-Johannesburg
|
||||
- Provider: HuaweiOBS
|
||||
- "ap-southeast-1"
|
||||
- CN-Hong Kong
|
||||
- Provider: HuaweiOBS
|
||||
- "ap-southeast-2"
|
||||
- AP-Bangkok
|
||||
- Provider: HuaweiOBS
|
||||
- "ap-southeast-3"
|
||||
- AP-Singapore
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-east-3"
|
||||
- CN East-Shanghai1
|
||||
- "ap-southeast-4"
|
||||
- AP-Jakarta
|
||||
- Provider: HuaweiOBS
|
||||
- "ap-southeast-5"
|
||||
- AP-Manila
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-east-2"
|
||||
- CN East-Shanghai2
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-east-3"
|
||||
- CN East-Shanghai1
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-east-4"
|
||||
- CN East-Qingdao
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-east-5"
|
||||
- CN East-Suzhou
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-north-1"
|
||||
- CN North-Beijing1
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-north-2"
|
||||
- CN North-Beijing2
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-north-4"
|
||||
- CN North-Beijing4
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-north-9"
|
||||
- CN North-Ulanqab
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-north-11"
|
||||
- CN North-Hebei
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-north-12"
|
||||
- CN North-Hohhot
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-south-1"
|
||||
- CN South-Guangzhou
|
||||
- Provider: HuaweiOBS
|
||||
- "ap-southeast-1"
|
||||
- CN-Hong Kong
|
||||
- "cn-south-2"
|
||||
- CN South-Shenzhen
|
||||
- Provider: HuaweiOBS
|
||||
- "sa-argentina-1"
|
||||
- LA-Buenos Aires1
|
||||
- "cn-south-4"
|
||||
- CN South-Guangzhou-InvitationOnly
|
||||
- Provider: HuaweiOBS
|
||||
- "sa-peru-1"
|
||||
- LA-Lima1
|
||||
- "cn-southwest-2"
|
||||
- CN Southwest-Guiyang1
|
||||
- Provider: HuaweiOBS
|
||||
- "cn-southwest-3"
|
||||
- CN Southwest-Chongqing
|
||||
- Provider: HuaweiOBS
|
||||
- "eu-west-101"
|
||||
- EU-Dublin
|
||||
- Provider: HuaweiOBS
|
||||
- "la-north-2"
|
||||
- LA-Mexico City2
|
||||
- Provider: HuaweiOBS
|
||||
- "la-south-2"
|
||||
- LA-Santiago
|
||||
- Provider: HuaweiOBS
|
||||
- "me-east-1"
|
||||
- ME-Riyadh
|
||||
- Provider: HuaweiOBS
|
||||
- "na-mexico-1"
|
||||
- LA-Mexico City1
|
||||
- Provider: HuaweiOBS
|
||||
- "sa-chile-1"
|
||||
- LA-Santiago2
|
||||
- "ru-northwest-2"
|
||||
- RU-Moscow2
|
||||
- Provider: HuaweiOBS
|
||||
- "sa-argentina-1"
|
||||
- LA-Buenos Aires1
|
||||
- Provider: HuaweiOBS
|
||||
- "sa-brazil-1"
|
||||
- LA-Sao Paulo1
|
||||
- Provider: HuaweiOBS
|
||||
- "ru-northwest-2"
|
||||
- RU-Moscow2
|
||||
- "sa-chile-1"
|
||||
- LA-Santiago2
|
||||
- Provider: HuaweiOBS
|
||||
- "sa-peru-1"
|
||||
- LA-Lima1
|
||||
- Provider: HuaweiOBS
|
||||
- "tr-west-1"
|
||||
- TR-Istanbul
|
||||
- Provider: HuaweiOBS
|
||||
- "eu-central-2"
|
||||
- Frankfurt, Germany
|
||||
@@ -1399,6 +1468,10 @@ Properties:
|
||||
- "us-east-1"
|
||||
- New York, USA
|
||||
- Provider: ImpossibleCloud
|
||||
- "us-east-1"
|
||||
- Default region for compatibility.
|
||||
- All data is stored in Switzerland.
|
||||
- Provider: Infomaniak
|
||||
- "de-fra"
|
||||
- Frankfurt, Germany
|
||||
- Provider: Intercolo
|
||||
@@ -1420,6 +1493,18 @@ Properties:
|
||||
- "us-central-1"
|
||||
- Lenexa, USA
|
||||
- Provider: IONOS
|
||||
- "us-east-1"
|
||||
- US East (N. Virginia)
|
||||
- Provider: Neon,Petabox,Rabata
|
||||
- "us-east-2"
|
||||
- US East (Ohio)
|
||||
- Provider: Neon
|
||||
- "eu-central-1"
|
||||
- Europe (Frankfurt)
|
||||
- Provider: Neon,Petabox
|
||||
- "ap-southeast-1"
|
||||
- Asia Pacific (Singapore)
|
||||
- Provider: Neon,Petabox
|
||||
- "eu-west-2"
|
||||
- Paris, France
|
||||
- Provider: Outscale
|
||||
@@ -1477,15 +1562,6 @@ Properties:
|
||||
- "rbx-archive"
|
||||
- Roubaix, France (Cold Archive)
|
||||
- Provider: OVHcloud
|
||||
- "us-east-1"
|
||||
- US East (N. Virginia)
|
||||
- Provider: Petabox,Rabata
|
||||
- "eu-central-1"
|
||||
- Europe (Frankfurt)
|
||||
- Provider: Petabox
|
||||
- "ap-southeast-1"
|
||||
- Asia Pacific (Singapore)
|
||||
- Provider: Petabox
|
||||
- "me-south-1"
|
||||
- Middle East (Bahrain)
|
||||
- Provider: Petabox
|
||||
@@ -1593,6 +1669,9 @@ Properties:
|
||||
- "pl-waw"
|
||||
- Warsaw, Poland
|
||||
- Provider: Scaleway
|
||||
- "it-mil"
|
||||
- Milan, Italy
|
||||
- Provider: Scaleway
|
||||
- "ru-1"
|
||||
- St. Petersburg
|
||||
- Provider: Selectel,Servercore
|
||||
@@ -1659,7 +1738,7 @@ Properties:
|
||||
|
||||
- Config: endpoint
|
||||
- Env Var: RCLONE_S3_ENDPOINT
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Ceph,ChinaMobile,Cloudflare,Cubbit,DigitalOcean,Dreamhost,Exaba,Fastly,FileLu,FlashBlade,GCS,HCP,Hetzner,HuaweiOBS,IBMCOS,ImpossibleCloud,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Mega,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,Rabata,RackCorp,Rclone,Scaleway,Scality,SeaweedFS,Selectel,Servercore,SpectraLogic,Storj,Synology,TencentCOS,US3,Wasabi,Zadara,Zata,ZeroServices,Other
|
||||
- Provider: AWS,Alibaba,ArvanCloud,Autonomys,BizflyCloud,Cellar,Ceph,ChinaMobile,Cloudflare,Cubbit,DigitalOcean,Dreamhost,Exaba,Fastly,FileLu,FlashBlade,GCS,HCP,Hetzner,HuaweiOBS,IBMCOS,ImpossibleCloud,Infomaniak,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Mega,Minio,Neon,Netease,Outscale,OVHcloud,Petabox,Qiniu,Rabata,RackCorp,Rclone,RelAix,Scaleway,Scality,SeaweedFS,Selectel,Servercore,SpectraLogic,Storj,Synology,TencentCOS,US3,Wasabi,Zadara,Zata,ZeroServices,Other
|
||||
- Type: string
|
||||
- Required: false
|
||||
- Examples:
|
||||
@@ -1745,12 +1824,18 @@ Properties:
|
||||
- "s3.ir-tbz-sh1.arvanstorage.ir"
|
||||
- Tabriz Iran (Shahriar)
|
||||
- Provider: ArvanCloud
|
||||
- "s3.auto-drive.autonomys.xyz"
|
||||
- Auto Drive mainnet S3 endpoint
|
||||
- Provider: Autonomys
|
||||
- "hn.ss.bfcplatform.vn"
|
||||
- Hanoi endpoint
|
||||
- Provider: BizflyCloud
|
||||
- "hcm.ss.bfcplatform.vn"
|
||||
- Ho Chi Minh endpoint
|
||||
- Provider: BizflyCloud
|
||||
- "cellar-c2.services.clever-cloud.com"
|
||||
- Paris, France
|
||||
- Provider: Cellar
|
||||
- "eos-wuxi-1.cmecloud.cn"
|
||||
- The default endpoint - a good choice if you are unsure.
|
||||
- East China (Suzhou)
|
||||
@@ -1887,6 +1972,9 @@ Properties:
|
||||
- "eu-central.object.fastlystorage.app"
|
||||
- EU Central
|
||||
- Provider: Fastly
|
||||
- "eu-central-1.object.fastlystorage.app"
|
||||
- EU Central 1
|
||||
- Provider: Fastly
|
||||
- "eu-south-1.object.fastlystorage.app"
|
||||
- EU South 1
|
||||
- Provider: Fastly
|
||||
@@ -1941,50 +2029,104 @@ Properties:
|
||||
- "nbg1.your-objectstorage.com"
|
||||
- Nuremberg
|
||||
- Provider: Hetzner
|
||||
- "obs.af-north-1.myhuaweicloud.com"
|
||||
- AF-Cairo
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.af-south-1.myhuaweicloud.com"
|
||||
- AF-Johannesburg
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.ap-southeast-1.myhuaweicloud.com"
|
||||
- CN-Hong Kong
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.ap-southeast-2.myhuaweicloud.com"
|
||||
- AP-Bangkok
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.ap-southeast-3.myhuaweicloud.com"
|
||||
- AP-Singapore
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-east-3.myhuaweicloud.com"
|
||||
- CN East-Shanghai1
|
||||
- "obs.ap-southeast-4.myhuaweicloud.com"
|
||||
- AP-Jakarta
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.ap-southeast-5.myhuaweicloud.com"
|
||||
- AP-Manila
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-east-2.myhuaweicloud.com"
|
||||
- CN East-Shanghai2
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-east-3.myhuaweicloud.com"
|
||||
- CN East-Shanghai1
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-east-4.myhuaweicloud.com"
|
||||
- CN East-Qingdao
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-east-5.myhuaweicloud.com"
|
||||
- CN East-Suzhou
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-north-1.myhuaweicloud.com"
|
||||
- CN North-Beijing1
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-north-2.myhuaweicloud.com"
|
||||
- CN North-Beijing2
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-north-4.myhuaweicloud.com"
|
||||
- CN North-Beijing4
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-north-9.myhuaweicloud.com"
|
||||
- CN North-Ulanqab
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-north-11.myhuaweicloud.com"
|
||||
- CN North-Hebei
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-north-12.myhuaweicloud.com"
|
||||
- CN North-Hohhot
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-south-1.myhuaweicloud.com"
|
||||
- CN South-Guangzhou
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.ap-southeast-1.myhuaweicloud.com"
|
||||
- CN-Hong Kong
|
||||
- "obs.cn-south-2.myhuaweicloud.com"
|
||||
- CN South-Shenzhen
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.sa-argentina-1.myhuaweicloud.com"
|
||||
- LA-Buenos Aires1
|
||||
- "obs.cn-south-4.myhuaweicloud.com"
|
||||
- CN South-Guangzhou-InvitationOnly
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.sa-peru-1.myhuaweicloud.com"
|
||||
- LA-Lima1
|
||||
- "obs.cn-southwest-2.myhuaweicloud.com"
|
||||
- CN Southwest-Guiyang1
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.cn-southwest-3.myhuaweicloud.com"
|
||||
- CN Southwest-Chongqing
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.eu-west-101.myhuaweicloud.eu"
|
||||
- EU-Dublin
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.la-north-2.myhuaweicloud.com"
|
||||
- LA-Mexico City2
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.la-south-2.myhuaweicloud.com"
|
||||
- LA-Santiago
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.me-east-1.myhuaweicloud.com"
|
||||
- ME-Riyadh
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.na-mexico-1.myhuaweicloud.com"
|
||||
- LA-Mexico City1
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.sa-chile-1.myhuaweicloud.com"
|
||||
- LA-Santiago2
|
||||
- "obs.ru-northwest-2.myhuaweicloud.com"
|
||||
- RU-Moscow2
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.sa-argentina-1.myhuaweicloud.com"
|
||||
- LA-Buenos Aires1
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.sa-brazil-1.myhuaweicloud.com"
|
||||
- LA-Sao Paulo1
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.ru-northwest-2.myhuaweicloud.com"
|
||||
- RU-Moscow2
|
||||
- "obs.sa-chile-1.myhuaweicloud.com"
|
||||
- LA-Santiago2
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.sa-peru-1.myhuaweicloud.com"
|
||||
- LA-Lima1
|
||||
- Provider: HuaweiOBS
|
||||
- "obs.tr-west-1.myhuaweicloud.com"
|
||||
- TR-Istanbul
|
||||
- Provider: HuaweiOBS
|
||||
- "s3.us.cloud-object-storage.appdomain.cloud"
|
||||
- US Cross Region Endpoint
|
||||
@@ -2193,6 +2335,18 @@ Properties:
|
||||
- "us-east-1.storage.impossibleapi.net"
|
||||
- New York, USA
|
||||
- Provider: ImpossibleCloud
|
||||
- "s3.swiss-backup01.infomaniak.com"
|
||||
- Swiss Backup Location 01
|
||||
- Provider: Infomaniak
|
||||
- "s3.swiss-backup02.infomaniak.com"
|
||||
- Swiss Backup Location 02
|
||||
- Provider: Infomaniak
|
||||
- "s3.swiss-backup03.infomaniak.com"
|
||||
- Swiss Backup Location 03
|
||||
- Provider: Infomaniak
|
||||
- "s3.swiss-backup04.infomaniak.com"
|
||||
- Swiss Backup Location 04
|
||||
- Provider: Infomaniak
|
||||
- "de-fra.i3storage.com"
|
||||
- Frankfurt, Germany
|
||||
- Provider: Intercolo
|
||||
@@ -2297,38 +2451,47 @@ Properties:
|
||||
- "br-ne1.magaluobjects.com"
|
||||
- Fortaleza, CE (BR), br-ne1
|
||||
- Provider: Magalu
|
||||
- "s3.eu-amsterdam.megas4.com"
|
||||
- Mega S4 Amsterdam
|
||||
- "s3.eu-luxembourg-1.megas4.com"
|
||||
- Mega S4 Luxembourg 1
|
||||
- Provider: Mega
|
||||
- "s3.eu-luxembourg.megas4.com"
|
||||
- Mega S4 Luxembourg
|
||||
- "s3.eu-luxembourg-2.megas4.com"
|
||||
- Mega S4 Luxembourg 2
|
||||
- Provider: Mega
|
||||
- "s3.eu-paris.megas4.com"
|
||||
- Mega S4 Paris
|
||||
- "s3.eu-amsterdam-1.megas4.com"
|
||||
- Mega S4 Amsterdam 1
|
||||
- Provider: Mega
|
||||
- "s3.eu-barcelona.megas4.com"
|
||||
- Mega S4 Barcelona
|
||||
- "s3.eu-amsterdam-2.megas4.com"
|
||||
- Mega S4 Amsterdam 2
|
||||
- Provider: Mega
|
||||
- "s3.ca-montreal.megas4.com"
|
||||
- Mega S4 Montreal
|
||||
- "s3.eu-paris-1.megas4.com"
|
||||
- Mega S4 Paris 1
|
||||
- Provider: Mega
|
||||
- "s3.ca-vancouver.megas4.com"
|
||||
- Mega S4 Vancouver
|
||||
- "s3.eu-paris-2.megas4.com"
|
||||
- Mega S4 Paris 2
|
||||
- Provider: Mega
|
||||
- "s3.ap-tokyo.megas4.com"
|
||||
- Mega S4 Tokyo
|
||||
- "s3.eu-barcelona-1.megas4.com"
|
||||
- Mega S4 Barcelona 1
|
||||
- Provider: Mega
|
||||
- "s3.eu-central-1.s4.mega.io"
|
||||
- Mega S4 eu-central-1 (Amsterdam, legacy)
|
||||
- "s3.eu-barcelona-2.megas4.com"
|
||||
- Mega S4 Barcelona 2
|
||||
- Provider: Mega
|
||||
- "s3.eu-central-2.s4.mega.io"
|
||||
- Mega S4 eu-central-2 (Bettembourg, legacy)
|
||||
- "s3.ca-montreal-1.megas4.com"
|
||||
- Mega S4 Montreal 1
|
||||
- Provider: Mega
|
||||
- "s3.ca-central-1.s4.mega.io"
|
||||
- Mega S4 ca-central-1 (Montreal, legacy)
|
||||
- "s3.ca-montreal-2.megas4.com"
|
||||
- Mega S4 Montreal 2
|
||||
- Provider: Mega
|
||||
- "s3.ca-west-1.s4.mega.io"
|
||||
- Mega S4 ca-west-1 (Vancouver, legacy)
|
||||
- "s3.ca-vancouver-1.megas4.com"
|
||||
- Mega S4 Vancouver 1
|
||||
- Provider: Mega
|
||||
- "s3.ca-vancouver-2.megas4.com"
|
||||
- Mega S4 Vancouver 2
|
||||
- Provider: Mega
|
||||
- "s3.ap-tokyo-1.megas4.com"
|
||||
- Mega S4 Tokyo 1
|
||||
- Provider: Mega
|
||||
- "s3.ap-tokyo-2.megas4.com"
|
||||
- Mega S4 Tokyo 2
|
||||
- Provider: Mega
|
||||
- "oos.eu-west-2.outscale.com"
|
||||
- Outscale EU West 2 (Paris)
|
||||
@@ -2495,6 +2658,12 @@ Properties:
|
||||
- "nz.s3.rackcorp.com"
|
||||
- Auckland (New Zealand) Endpoint
|
||||
- Provider: RackCorp
|
||||
- "s3-gw1.relaix.net"
|
||||
- Aachen-1, Germany
|
||||
- Provider: RelAix
|
||||
- "s3-gw2.relaix.net"
|
||||
- Aachen-2, Germany
|
||||
- Provider: RelAix
|
||||
- "s3.nl-ams.scw.cloud"
|
||||
- Amsterdam Endpoint
|
||||
- Provider: Scaleway
|
||||
@@ -2504,6 +2673,9 @@ Properties:
|
||||
- "s3.pl-waw.scw.cloud"
|
||||
- Warsaw Endpoint
|
||||
- Provider: Scaleway
|
||||
- "s3.it-mil.scw.cloud"
|
||||
- Milan Endpoint
|
||||
- Provider: Scaleway
|
||||
- "localhost:8333"
|
||||
- SeaweedFS S3 localhost
|
||||
- Provider: SeaweedFS
|
||||
@@ -2740,7 +2912,7 @@ Properties:
|
||||
|
||||
- Config: location_constraint
|
||||
- Env Var: RCLONE_S3_LOCATION_CONSTRAINT
|
||||
- Provider: AWS,ArvanCloud,Ceph,ChinaMobile,DigitalOcean,Dreamhost,Exaba,GCS,HCP,Hetzner,IBMCOS,ImpossibleCloud,LyveCloud,Minio,Netease,Qiniu,Rabata,RackCorp,Scality,SeaweedFS,Synology,Wasabi,Zata,ZeroServices,Other
|
||||
- Provider: AWS,ArvanCloud,Ceph,ChinaMobile,DigitalOcean,Dreamhost,Exaba,GCS,HCP,Hetzner,IBMCOS,ImpossibleCloud,Infomaniak,LyveCloud,Minio,Netease,Qiniu,Rabata,RackCorp,Scality,SeaweedFS,Synology,Wasabi,Zata,ZeroServices,Other
|
||||
- Type: string
|
||||
- Required: false
|
||||
- Examples:
|
||||
@@ -3121,36 +3293,36 @@ Properties:
|
||||
|
||||
- Config: acl
|
||||
- Env Var: RCLONE_S3_ACL
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Ceph,ChinaMobile,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IBMCOS,IDrive,ImpossibleCloud,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,Scaleway,Scality,SeaweedFS,TencentCOS,US3,Wasabi,Zata,ZeroServices,Other
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Cellar,Ceph,ChinaMobile,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IBMCOS,IDrive,ImpossibleCloud,Infomaniak,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,RelAix,Scaleway,Scality,SeaweedFS,TencentCOS,US3,Wasabi,Zata,ZeroServices,Other
|
||||
- Type: string
|
||||
- Required: false
|
||||
- Examples:
|
||||
- "private"
|
||||
- Owner gets FULL_CONTROL.
|
||||
- No one else has access rights (default).
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Ceph,ChinaMobile,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IDrive,ImpossibleCloud,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,Scaleway,Scality,SeaweedFS,US3,Wasabi,Zata,ZeroServices,Other
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Cellar,Ceph,ChinaMobile,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IDrive,ImpossibleCloud,Infomaniak,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,RelAix,Scaleway,Scality,SeaweedFS,US3,Wasabi,Zata,ZeroServices,Other
|
||||
- "public-read"
|
||||
- Owner gets FULL_CONTROL.
|
||||
- The AllUsers group gets READ access.
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Ceph,ChinaMobile,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IDrive,ImpossibleCloud,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,Scaleway,Scality,SeaweedFS,TencentCOS,US3,Wasabi,Zata,ZeroServices,Other
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Cellar,Ceph,ChinaMobile,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IDrive,ImpossibleCloud,Infomaniak,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,RelAix,Scaleway,Scality,SeaweedFS,TencentCOS,US3,Wasabi,Zata,ZeroServices,Other
|
||||
- "public-read-write"
|
||||
- Owner gets FULL_CONTROL.
|
||||
- The AllUsers group gets READ and WRITE access.
|
||||
- Granting this on a bucket is generally not recommended.
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Ceph,ChinaMobile,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IDrive,ImpossibleCloud,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,Scaleway,Scality,SeaweedFS,TencentCOS,Wasabi,Zata,ZeroServices,Other
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Cellar,Ceph,ChinaMobile,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IDrive,ImpossibleCloud,Infomaniak,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,RelAix,Scaleway,Scality,SeaweedFS,TencentCOS,Wasabi,Zata,ZeroServices,Other
|
||||
- "authenticated-read"
|
||||
- Owner gets FULL_CONTROL.
|
||||
- The AuthenticatedUsers group gets READ access.
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Ceph,ChinaMobile,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IDrive,ImpossibleCloud,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,Scaleway,Scality,SeaweedFS,TencentCOS,Wasabi,Zata,ZeroServices,Other
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Cellar,Ceph,ChinaMobile,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IDrive,ImpossibleCloud,Infomaniak,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,RelAix,Scaleway,Scality,SeaweedFS,TencentCOS,Wasabi,Zata,ZeroServices,Other
|
||||
- "bucket-owner-read"
|
||||
- Object owner gets FULL_CONTROL.
|
||||
- Bucket owner gets READ access.
|
||||
- If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Ceph,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IDrive,ImpossibleCloud,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,Scaleway,Scality,SeaweedFS,TencentCOS,Wasabi,Zata,ZeroServices,Other
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Cellar,Ceph,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IDrive,ImpossibleCloud,Infomaniak,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,RelAix,Scaleway,Scality,SeaweedFS,TencentCOS,Wasabi,Zata,ZeroServices,Other
|
||||
- "bucket-owner-full-control"
|
||||
- Both the object owner and the bucket owner get FULL_CONTROL over the object.
|
||||
- If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Ceph,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IDrive,ImpossibleCloud,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,Scaleway,Scality,SeaweedFS,TencentCOS,Wasabi,Zata,ZeroServices,Other
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Cellar,Ceph,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IDrive,ImpossibleCloud,Infomaniak,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,RelAix,Scaleway,Scality,SeaweedFS,TencentCOS,Wasabi,Zata,ZeroServices,Other
|
||||
- "private"
|
||||
- Owner gets FULL_CONTROL.
|
||||
- No one else has access rights (default).
|
||||
@@ -3344,7 +3516,7 @@ Properties:
|
||||
|
||||
### Advanced options
|
||||
|
||||
Here are the Advanced options specific to s3 (Amazon S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, BizflyCloud, Ceph, ChinaMobile, Cloudflare, Cubbit, DigitalOcean, Dreamhost, Exaba, Fastly, FileLu, FlashBlade, GCS, HCP, Hetzner, HuaweiOBS, IBMCOS, IDrive, ImpossibleCloud, Intercolo, IONOS, Leviia, Liara, Linode, LyveCloud, Magalu, Mega, Minio, Netease, Outscale, OVHcloud, Petabox, Qiniu, Rabata, RackCorp, Rclone, Scaleway, Scality, SeaweedFS, Selectel, Servercore, SpectraLogic, Storj, Synology, TencentCOS, US3, Wasabi, Zadara, Zata, ZeroServices, Other).
|
||||
Here are the Advanced options specific to s3 (Amazon S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, Autonomys, BizflyCloud, Cellar, Ceph, ChinaMobile, Cloudflare, Cubbit, DigitalOcean, Dreamhost, Exaba, Fastly, FileLu, FlashBlade, GCS, HCP, Hetzner, HuaweiOBS, IBMCOS, IDrive, ImpossibleCloud, Infomaniak, Intercolo, IONOS, Leviia, Liara, Linode, LyveCloud, Magalu, Mega, Minio, Neon, Netease, Outscale, OVHcloud, Petabox, Qiniu, Rabata, RackCorp, Rclone, RelAix, Scaleway, Scality, SeaweedFS, Selectel, Servercore, SpectraLogic, Storj, Synology, TencentCOS, US3, Wasabi, Zadara, Zata, ZeroServices, Other).
|
||||
|
||||
#### --s3-bucket-acl
|
||||
|
||||
@@ -3363,7 +3535,7 @@ Properties:
|
||||
|
||||
- Config: bucket_acl
|
||||
- Env Var: RCLONE_S3_BUCKET_ACL
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Ceph,ChinaMobile,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IBMCOS,IDrive,ImpossibleCloud,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Mega,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,Scaleway,SeaweedFS,Servercore,TencentCOS,US3,Wasabi,Zata,ZeroServices,Other
|
||||
- Provider: AWS,Alibaba,ArvanCloud,BizflyCloud,Cellar,Ceph,ChinaMobile,Cubbit,DigitalOcean,Dreamhost,Exaba,FileLu,GCS,HCP,Hetzner,HuaweiOBS,IBMCOS,IDrive,ImpossibleCloud,Infomaniak,Intercolo,IONOS,Leviia,Liara,Linode,LyveCloud,Magalu,Mega,Minio,Netease,Outscale,OVHcloud,Petabox,Qiniu,RackCorp,RelAix,Scaleway,SeaweedFS,Servercore,TencentCOS,US3,Wasabi,Zata,ZeroServices,Other
|
||||
- Type: string
|
||||
- Required: false
|
||||
- Examples:
|
||||
@@ -3401,7 +3573,7 @@ Properties:
|
||||
|
||||
- Config: sse_customer_algorithm
|
||||
- Env Var: RCLONE_S3_SSE_CUSTOMER_ALGORITHM
|
||||
- Provider: AWS,Ceph,ChinaMobile,Minio
|
||||
- Provider: AWS,Cellar,Ceph,ChinaMobile,Minio
|
||||
- Type: string
|
||||
- Required: false
|
||||
- Examples:
|
||||
@@ -3414,13 +3586,13 @@ Properties:
|
||||
|
||||
To use SSE-C you may provide the secret encryption key used to encrypt/decrypt your data.
|
||||
|
||||
Alternatively you can provide --sse-customer-key-base64.
|
||||
Alternatively you can provide --s3-sse-customer-key-base64.
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: sse_customer_key
|
||||
- Env Var: RCLONE_S3_SSE_CUSTOMER_KEY
|
||||
- Provider: AWS,Ceph,ChinaMobile,Minio
|
||||
- Provider: AWS,Cellar,Ceph,ChinaMobile,Minio
|
||||
- Type: string
|
||||
- Required: false
|
||||
- Examples:
|
||||
@@ -3431,13 +3603,13 @@ Properties:
|
||||
|
||||
If using SSE-C you must provide the secret encryption key encoded in base64 format to encrypt/decrypt your data.
|
||||
|
||||
Alternatively you can provide --sse-customer-key.
|
||||
Alternatively you can provide --s3-sse-customer-key.
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: sse_customer_key_base64
|
||||
- Env Var: RCLONE_S3_SSE_CUSTOMER_KEY_BASE64
|
||||
- Provider: AWS,Ceph,ChinaMobile,Minio
|
||||
- Provider: AWS,Cellar,Ceph,ChinaMobile,Minio
|
||||
- Type: string
|
||||
- Required: false
|
||||
- Examples:
|
||||
@@ -3455,7 +3627,7 @@ Properties:
|
||||
|
||||
- Config: sse_customer_key_md5
|
||||
- Env Var: RCLONE_S3_SSE_CUSTOMER_KEY_MD5
|
||||
- Provider: AWS,Ceph,ChinaMobile,Minio
|
||||
- Provider: AWS,Cellar,Ceph,ChinaMobile,Minio
|
||||
- Type: string
|
||||
- Required: false
|
||||
- Examples:
|
||||
@@ -4545,6 +4717,47 @@ info on how to pass options and arguments.
|
||||
These can be run on a running backend using the rc command
|
||||
[backend/command](/rc/#backend-command).
|
||||
|
||||
### link
|
||||
|
||||
Generate a signed link with response header overrides.
|
||||
|
||||
```console
|
||||
rclone backend link remote: [options] [<arguments>+]
|
||||
```
|
||||
|
||||
This command generates a signed download link for one file, with optional
|
||||
overrides for the HTTP response headers. Pass the file path as a separate
|
||||
argument, relative to the remote path.
|
||||
|
||||
Usage examples:
|
||||
|
||||
```console
|
||||
rclone backend link s3:bucket path/to/file -o expire=1h
|
||||
rclone backend link s3:bucket path/to/file -o response-expires="Thu, 01 Jan 1970 00:00:00 GMT"
|
||||
rclone backend link s3:bucket path/to/file -o response-content-disposition='attachment; filename="download.txt"'
|
||||
```
|
||||
|
||||
The link expires after 7 days by default. Use `-o expire=1h` to change
|
||||
its lifetime. Durations must be at least 1 second; values above 7 days are
|
||||
limited to 7 days, as with `rclone link`.
|
||||
|
||||
The `response-expires` option sets the HTTP Expires response header,
|
||||
not the lifetime of the signed link. It must be an HTTP date, such as
|
||||
`Thu, 01 Jan 1970 00:00:00 GMT`.
|
||||
|
||||
The overrides are included in the signature and must not be changed in the
|
||||
returned URL. They do not modify the object's stored metadata.
|
||||
|
||||
Options:
|
||||
|
||||
- "expire": How long the link will be valid (default 7d, maximum 7d).
|
||||
- "response-cache-control": Set the Cache-Control response header.
|
||||
- "response-content-disposition": Set the Content-Disposition response header.
|
||||
- "response-content-encoding": Set the Content-Encoding response header.
|
||||
- "response-content-language": Set the Content-Language response header.
|
||||
- "response-content-type": Set the Content-Type response header.
|
||||
- "response-expires": Set the Expires response header to an HTTP date.
|
||||
|
||||
### restore
|
||||
|
||||
Restore objects from GLACIER or INTELLIGENT-TIERING archive tier.
|
||||
@@ -6992,6 +7205,114 @@ endpoint = eu-central-2.storage.impossibleapi.net
|
||||
acl = private
|
||||
```
|
||||
|
||||
### Infomaniak Swiss Backup {#infomaniak}
|
||||
|
||||
[Infomaniak Swiss Backup](https://www.infomaniak.com/en/swiss-backup/cloud-storage) is a cloud backup space in Switzerland that you can use however you want with the script or software of your choice that is compatible with Swift, S3 or SFTP.
|
||||
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
Create and setup your Swiss Backup product following [this documentation](https://www.infomaniak.com/en/support/faq/2546/create-an-s3-location-on-swiss-backup). Memorize the generated `Endpoint`, `Access Key`, and `Secret Key`:
|
||||
|
||||
#### Configuration
|
||||
|
||||
To configure access to an S3 location on Swiss Backup, follow the steps below:
|
||||
|
||||
1. Run `rclone config` and select `n` for a new remote.
|
||||
|
||||
```sh
|
||||
rclone config
|
||||
No remotes found, make a new one?
|
||||
n) New remote
|
||||
s) Set configuration password
|
||||
q) Quit config
|
||||
n/s/q> n
|
||||
```
|
||||
|
||||
2. Give the name of the configuration. For example, name it 'swissbackup'.
|
||||
|
||||
```sh
|
||||
name> swissbackup
|
||||
```
|
||||
|
||||
3. Select `s3` storage.
|
||||
|
||||
```sh
|
||||
Type of storage to configure.
|
||||
XX / Amazon S3 Compliant Storage Providers including AWS, ... - Tier 1
|
||||
\ (s3)
|
||||
Storage> s3
|
||||
```
|
||||
|
||||
4. Select `Infomaniak` provider.
|
||||
|
||||
```sh
|
||||
Choose your S3 provider.
|
||||
xx / Infomaniak Swiss Backup
|
||||
\ (Infomaniak)
|
||||
provider> Infomaniak
|
||||
```
|
||||
|
||||
5. Enter your Access Key and Secret Key. _You can generate new ones by clicking 'Generate new keys' on your Swiss Backup product dashboard._
|
||||
|
||||
```sh
|
||||
Option env_auth.
|
||||
1 / Enter AWS credentials in the next step
|
||||
\ (false)
|
||||
2 / Get AWS credentials from the environment (env vars or IAM)
|
||||
\ (true)
|
||||
env_auth> 1
|
||||
|
||||
AWS Access Key ID.
|
||||
access_key_id> {YOUR-ACCESS-ID}
|
||||
|
||||
AWS Secret Access Key (password)
|
||||
secret_access_key> {YOUR-ACCESS-SECRET}
|
||||
```
|
||||
|
||||
6. Select `us-east-1` region for compatibility.
|
||||
|
||||
```sh
|
||||
Region to connect to.
|
||||
/ Default region for compatibility.
|
||||
1 | All data is stored in Switzerland.
|
||||
\ (us-east-1)
|
||||
region> 1
|
||||
```
|
||||
|
||||
7. Select the endpoint corresponding to the one generated with your Access and Secret Keys.
|
||||
|
||||
```sh
|
||||
Endpoint for S3 API.
|
||||
1 / Swiss Backup Location 01
|
||||
\ (s3.swiss-backup01.infomaniak.com)
|
||||
2 / Swiss Backup Location 02
|
||||
\ (s3.swiss-backup02.infomaniak.com)
|
||||
3 / Swiss Backup Location 03
|
||||
\ (s3.swiss-backup03.infomaniak.com)
|
||||
4 / Swiss Backup Location 04
|
||||
\ (s3.swiss-backup04.infomaniak.com)
|
||||
endpoint> 1
|
||||
```
|
||||
|
||||
8. Adjust other parameters and advanced config at your convenience. Leave blank if not sure.
|
||||
|
||||
9. You should obtain something like this.
|
||||
|
||||
```sh
|
||||
Configuration complete.
|
||||
Options:
|
||||
- type: s3
|
||||
- provider: Infomaniak
|
||||
- access_key_id: xxxxxxxxxx
|
||||
- secret_access_key: xxxxxxxxxx
|
||||
- region: us-east-1
|
||||
- endpoint: s3.swiss-backup01.infomaniak.com
|
||||
```
|
||||
|
||||
10. Press `y` to validate. Then `q` to quit.
|
||||
|
||||
|
||||
### Intercolo Object Storage {#intercolo}
|
||||
|
||||
[Intercolo Object Storage](https://intercolo.de/object-storage) offers
|
||||
@@ -7995,6 +8316,157 @@ So once set up, for example, to copy files into a bucket
|
||||
rclone copy /path/to/files minio:bucket
|
||||
```
|
||||
|
||||
### Neon Object Storage {#neon}
|
||||
|
||||
[Neon Object Storage](https://neon.com/docs/storage/overview) is S3
|
||||
compatible object storage in a Neon project. Each branch of the project
|
||||
has its own copy of the buckets and its own S3 endpoint. The endpoint
|
||||
looks like `https://<branch_id>.storage.<cell>.<region>.aws.neon.tech`.
|
||||
|
||||
In the Neon Console, click **Connect**, open the **Storage** tab and
|
||||
choose **Parameters only**. Use `AWS_ACCESS_KEY_ID`,
|
||||
`AWS_SECRET_ACCESS_KEY`, `AWS_ENDPOINT_URL_S3` and `AWS_REGION` as
|
||||
`access_key_id`, `secret_access_key`, `endpoint` and `region`. To make
|
||||
a separate credential, use **Settings** > **Credentials** or run
|
||||
`neon credentials create --scope storage:read --scope storage:write`.
|
||||
|
||||
A credential works on the branch it was made on and on that branch's
|
||||
child branches. To use a child branch, change only `endpoint`.
|
||||
|
||||
Neon also has these limits (see the
|
||||
[S3 compatibility docs](https://neon.com/docs/storage/s3-compatibility)):
|
||||
|
||||
- The maximum object size is 5 GiB for a single upload and 10 GiB for
|
||||
a multipart upload.
|
||||
- Neon rejects object keys containing control characters with
|
||||
`400 InvalidURI`. To store files with these names, add `Ctl,Del` to
|
||||
the encoding, for example `encoding = Slash,InvalidUtf8,Dot,Ctl,Del`.
|
||||
- Neon doesn't support ACLs over the S3 API. Leave `acl` and
|
||||
`bucket_acl` empty and set bucket access (`private` or `public_read`)
|
||||
in Neon.
|
||||
- Neon stores versioning and lifecycle configurations but doesn't
|
||||
enforce them.
|
||||
- Neon may throttle heavy use with `503 SlowDown` errors. rclone retries
|
||||
these.
|
||||
|
||||
Here is an example of making a Neon Object Storage configuration. First run:
|
||||
|
||||
```console
|
||||
rclone config
|
||||
```
|
||||
|
||||
This will guide you through an interactive setup process.
|
||||
|
||||
```text
|
||||
No remotes found, make a new one?
|
||||
n) New remote
|
||||
s) Set configuration password
|
||||
q) Quit config
|
||||
n/s/q> n
|
||||
|
||||
Enter name for new remote.
|
||||
name> neon
|
||||
|
||||
Option Storage.
|
||||
Type of storage to configure.
|
||||
Choose a number from below, or type in your own value.
|
||||
[snip]
|
||||
XX / Amazon S3 Compliant Storage Providers including AWS, ... Neon, ...
|
||||
\ (s3)
|
||||
[snip]
|
||||
Storage> s3
|
||||
|
||||
Option provider.
|
||||
Choose your S3 provider.
|
||||
Choose a number from below, or type in your own value.
|
||||
Press Enter to leave empty.
|
||||
[snip]
|
||||
XX / Neon Object Storage
|
||||
\ (Neon)
|
||||
[snip]
|
||||
provider> Neon
|
||||
|
||||
Option env_auth.
|
||||
Get AWS credentials from runtime (environment variables or EC2/ECS meta data if no env vars).
|
||||
Only applies if access_key_id and secret_access_key is blank.
|
||||
Choose a number from below, or type in your own boolean value (true or false).
|
||||
Press Enter for the default (false).
|
||||
1 / Enter AWS credentials in the next step.
|
||||
\ (false)
|
||||
2 / Get AWS credentials from the environment (env vars or IAM).
|
||||
\ (true)
|
||||
env_auth>
|
||||
|
||||
Option access_key_id.
|
||||
AWS Access Key ID.
|
||||
Leave blank for anonymous access or runtime credentials.
|
||||
Enter a value. Press Enter to leave empty.
|
||||
access_key_id> NEON_ACCESS_KEY_ID
|
||||
|
||||
Option secret_access_key.
|
||||
AWS Secret Access Key (password).
|
||||
Leave blank for anonymous access or runtime credentials.
|
||||
Enter a value. Press Enter to leave empty.
|
||||
secret_access_key> NEON_SECRET_ACCESS_KEY
|
||||
|
||||
Option region.
|
||||
Region to connect to.
|
||||
Leave blank if you are using an S3 clone and you don't have a region.
|
||||
Choose a number from below, or type in your own value.
|
||||
Press Enter to leave empty.
|
||||
1 / US East (N. Virginia)
|
||||
\ (us-east-1)
|
||||
2 / US East (Ohio)
|
||||
\ (us-east-2)
|
||||
3 / Europe (Frankfurt)
|
||||
\ (eu-central-1)
|
||||
4 / Asia Pacific (Singapore)
|
||||
\ (ap-southeast-1)
|
||||
region> us-east-2
|
||||
|
||||
Option endpoint.
|
||||
Endpoint for S3 API.
|
||||
Required when using an S3 clone.
|
||||
Enter a value. Press Enter to leave empty.
|
||||
endpoint> https://<branch_id>.storage.<cell>.<region>.aws.neon.tech
|
||||
|
||||
Option bucket_object_lock_enabled.
|
||||
Enable Object Lock when creating new buckets.
|
||||
Enter a boolean value (true or false). Press Enter for the default (false).
|
||||
bucket_object_lock_enabled>
|
||||
|
||||
Edit advanced config?
|
||||
y) Yes
|
||||
n) No (default)
|
||||
y/n> n
|
||||
|
||||
Configuration complete.
|
||||
Options:
|
||||
- type: s3
|
||||
- provider: Neon
|
||||
- access_key_id: NEON_ACCESS_KEY_ID
|
||||
- secret_access_key: NEON_SECRET_ACCESS_KEY
|
||||
- region: us-east-2
|
||||
- endpoint: https://<branch_id>.storage.<cell>.<region>.aws.neon.tech
|
||||
Keep this "neon" remote?
|
||||
y) Yes this is OK (default)
|
||||
e) Edit this remote
|
||||
d) Delete this remote
|
||||
y/e/d> y
|
||||
```
|
||||
|
||||
This will leave the config file looking like this.
|
||||
|
||||
```ini
|
||||
[neon]
|
||||
type = s3
|
||||
provider = Neon
|
||||
access_key_id = NEON_ACCESS_KEY_ID
|
||||
secret_access_key = NEON_SECRET_ACCESS_KEY
|
||||
region = us-east-2
|
||||
endpoint = https://<branch_id>.storage.<cell>.<region>.aws.neon.tech
|
||||
```
|
||||
|
||||
### Netease NOS
|
||||
|
||||
For Netease NOS configure as per the configurator `rclone config`
|
||||
|
||||
+29
-1
@@ -920,7 +920,7 @@ Properties:
|
||||
- Config: encoding
|
||||
- Env Var: RCLONE_SFTP_ENCODING
|
||||
- Type: Encoding
|
||||
- Default: Slash,Del,Ctl,Dot
|
||||
- Default: Slash,Dot
|
||||
|
||||
#### --sftp-set-modtime
|
||||
|
||||
@@ -1169,6 +1169,34 @@ Properties:
|
||||
- Type: bool
|
||||
- Default: false
|
||||
|
||||
#### --sftp-multithread-upload
|
||||
|
||||
Set this to use multi-thread (multi-connection) uploads.
|
||||
|
||||
Normally rclone uploads a single large file over one SFTP connection.
|
||||
With this set rclone uploads large files over several SFTP connections
|
||||
at once (one per chunk), which greatly improves throughput on high
|
||||
latency links, the same way multi-thread downloads already work. Each
|
||||
connection writes a different, non-overlapping byte range of the file,
|
||||
so this requires a server that allows several handles to the same file
|
||||
with writes at arbitrary offsets, which OpenSSH does.
|
||||
|
||||
This is off by default because many SFTP servers only accept sequential
|
||||
writes (for example some object storage backed SFTP gateways) and would
|
||||
fail large uploads with "truncate failed" or "invalid offset" style
|
||||
errors.
|
||||
|
||||
This is ignored (uploads stay single-threaded) when
|
||||
--sftp-disable-concurrent-writes or --sftp-connections is in use.
|
||||
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: multithread_upload
|
||||
- Env Var: RCLONE_SFTP_MULTITHREAD_UPLOAD
|
||||
- Type: bool
|
||||
- Default: false
|
||||
|
||||
#### --sftp-idle-timeout
|
||||
|
||||
Max time before closing idle connections.
|
||||
|
||||
+20
-1
@@ -137,12 +137,14 @@ Properties:
|
||||
|
||||
SMB username.
|
||||
|
||||
Leave blank to use the current user name.
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: user
|
||||
- Env Var: RCLONE_SMB_USER
|
||||
- Type: string
|
||||
- Default: "$USER"
|
||||
- Required: false
|
||||
|
||||
#### --smb-port
|
||||
|
||||
@@ -219,6 +221,23 @@ Properties:
|
||||
|
||||
Here are the Advanced options specific to smb (SMB / CIFS).
|
||||
|
||||
#### --smb-workstation
|
||||
|
||||
Workstation name sent in NTLM authentication.
|
||||
|
||||
The NetBIOS name sent as the client workstation in the NTLM AUTHENTICATE
|
||||
message. Some servers (e.g. domain-joined Windows servers with per-account
|
||||
workstation restrictions or NTLM allow-lists) require this to match a
|
||||
specific name. Leave blank to send no workstation name (the default).
|
||||
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: workstation
|
||||
- Env Var: RCLONE_SMB_WORKSTATION
|
||||
- Type: string
|
||||
- Required: false
|
||||
|
||||
#### --smb-idle-timeout
|
||||
|
||||
Max time before closing idle connections.
|
||||
|
||||
@@ -15,6 +15,7 @@ Commercial implementations of that being:
|
||||
- [Oracle Cloud Storage](https://docs.oracle.com/en-us/iaas/integration/doc/configure-object-storage.html)
|
||||
- [Blomp Cloud Storage](https://www.blomp.com/cloud-storage/)
|
||||
- [IBM Bluemix Cloud ObjectStorage Swift](https://console.bluemix.net/docs/infrastructure/objectstorage-swift/index.html)
|
||||
- [Infomaniak Swiss Backup](https://www.infomaniak.com/en/swiss-backup/cloud-storage)
|
||||
|
||||
Paths are specified as `remote:container` (or `remote:` for the `lsd`
|
||||
command.) You may put subdirectories in too, e.g. `remote:container/path/to/dir`.
|
||||
@@ -327,6 +328,14 @@ Properties:
|
||||
- OVH
|
||||
- "https://authenticate.ain.net"
|
||||
- Blomp Cloud Storage
|
||||
- "https://swiss-backup01.infomaniak.com/identity/v3"
|
||||
- Infomaniak Swiss Backup Location 01
|
||||
- "https://swiss-backup02.infomaniak.com/identity/v3"
|
||||
- Infomaniak Swiss Backup Location 02
|
||||
- "https://swiss-backup03.infomaniak.com/identity/v3"
|
||||
- Infomaniak Swiss Backup Location 03
|
||||
- "https://swiss-backup04.infomaniak.com/identity/v3"
|
||||
- Infomaniak Swiss Backup Location 04
|
||||
|
||||
#### --swift-user-id
|
||||
|
||||
|
||||
@@ -249,6 +249,13 @@ For example, to set a Cookie use 'Cookie,name=value', or '"Cookie","name=value"'
|
||||
|
||||
You can set multiple headers, e.g. '"Cookie","name=value","Authorization","xxx"'.
|
||||
|
||||
The headers are only sent to the host in the configured URL. If the
|
||||
server redirects to another host (including a subdomain or a different
|
||||
port) the headers are not sent to it, or to any further hop in that
|
||||
redirect chain. The exception is the directory listing and file
|
||||
download requests when auth_redirect is set, as that keeps all
|
||||
credentials across redirects.
|
||||
|
||||
|
||||
Properties:
|
||||
|
||||
|
||||
@@ -278,6 +278,26 @@ Properties:
|
||||
- Type: Duration
|
||||
- Default: 0s
|
||||
|
||||
#### --yandex-app-folder
|
||||
|
||||
Use the application folder as the root.
|
||||
|
||||
If you registered your own OAuth application with Yandex with only
|
||||
the "Application Folder" permission (cloud_api:disk.app_folder)
|
||||
instead of full disk access, then rclone needs to address paths with
|
||||
the "app:/" prefix instead of the usual "disk:/" prefix, otherwise
|
||||
all requests fail with a 403 Forbidden error.
|
||||
|
||||
Set this to true if your OAuth token only has access to the
|
||||
application folder.
|
||||
|
||||
Properties:
|
||||
|
||||
- Config: app_folder
|
||||
- Env Var: RCLONE_YANDEX_APP_FOLDER
|
||||
- Type: bool
|
||||
- Default: false
|
||||
|
||||
#### --yandex-description
|
||||
|
||||
Description of the remote.
|
||||
|
||||
@@ -147,6 +147,11 @@ var ConfigOptionsInfo = Options{{
|
||||
Default: false,
|
||||
Help: "Do not verify the server SSL certificate (insecure)",
|
||||
Groups: "Networking",
|
||||
}, {
|
||||
Name: "allow_https_downgrade",
|
||||
Default: false,
|
||||
Help: "Follow redirects from HTTPS to HTTP (insecure)",
|
||||
Groups: "Networking",
|
||||
}, {
|
||||
Name: "ask_password",
|
||||
Default: true,
|
||||
@@ -605,6 +610,7 @@ type ConfigInfo struct {
|
||||
ExpectContinueTimeout Duration `config:"expect_continue_timeout"`
|
||||
Dump DumpFlags `config:"dump"`
|
||||
InsecureSkipVerify bool `config:"no_check_certificate"` // Skip server certificate verification
|
||||
AllowHTTPSDowngrade bool `config:"allow_https_downgrade"`
|
||||
DeleteMode DeleteMode `config:"delete_mode"`
|
||||
MaxDelete int64 `config:"max_delete"`
|
||||
MaxDeleteSize SizeSuffix `config:"max_delete_size"`
|
||||
|
||||
@@ -616,8 +616,32 @@ func redirectLeavesHost(req *http.Request) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// isHTTPSDowngrade reports whether req is a plaintext HTTP redirect
|
||||
// hop in a chain whose original request was HTTPS.
|
||||
func isHTTPSDowngrade(req *http.Request) bool {
|
||||
if req.URL.Scheme != "http" {
|
||||
return false
|
||||
}
|
||||
origin := req
|
||||
for origin.Response != nil && origin.Response.Request != nil {
|
||||
origin = origin.Response.Request
|
||||
}
|
||||
return origin.URL.Scheme == "https"
|
||||
}
|
||||
|
||||
// RoundTrip implements the RoundTripper interface.
|
||||
func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error) {
|
||||
// Refuse HTTPS to HTTP redirects here rather than in
|
||||
// CheckRedirect since backends and libraries replace the client's
|
||||
// CheckRedirect but still use this transport, and any credentials
|
||||
// they set would be sent in cleartext.
|
||||
if !t.ci.AllowHTTPSDowngrade && isHTTPSDowngrade(req) {
|
||||
if req.Body != nil {
|
||||
_ = req.Body.Close()
|
||||
}
|
||||
return nil, fmt.Errorf("%w: redirect to %s (use --allow-https-downgrade to follow it)", rest.ErrHTTPSDowngrade, req.URL.Redacted())
|
||||
}
|
||||
|
||||
// Check if certificates are being used and the certificates are expired
|
||||
if isCertificateExpired(t.TLSClientConfig) {
|
||||
t.reloadCertificates()
|
||||
|
||||
+88
-1
@@ -19,6 +19,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/lib/rest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"moul.io/http2curl/v2"
|
||||
@@ -301,7 +302,7 @@ func TestRedirectLeavesHost(t *testing.T) {
|
||||
// TestRedirectStripsGlobalHeadersOnDowngrade checks the headers set
|
||||
// with --header are not sent over plaintext HTTP when an HTTPS
|
||||
// request is redirected to an http:// URL with the same host and
|
||||
// port.
|
||||
// port and --allow-https-downgrade permits the redirect.
|
||||
//
|
||||
// The https:// request is made to the plain server's host and port
|
||||
// with a TLS dialer which ignores the address and connects to the
|
||||
@@ -322,6 +323,7 @@ func TestRedirectStripsGlobalHeadersOnDowngrade(t *testing.T) {
|
||||
|
||||
ctx, ci := fs.AddConfig(context.Background())
|
||||
ci.Headers = []*fs.HTTPOption{{Key: "X-Potato", Value: "sausage"}}
|
||||
ci.AllowHTTPSDowngrade = true
|
||||
client := NewClientCustom(ctx, func(tr *http.Transport) {
|
||||
tr.DialTLSContext = func(ctx context.Context, network, _ string) (net.Conn, error) {
|
||||
return (&tls.Dialer{Config: tlsConfig}).DialContext(ctx, network, secure.Listener.Addr().String())
|
||||
@@ -336,3 +338,88 @@ func TestRedirectStripsGlobalHeadersOnDowngrade(t *testing.T) {
|
||||
assert.Equal(t, "sausage", gotTLS.Get("X-Potato"))
|
||||
assert.Equal(t, "", gotPlain.Get("X-Potato"))
|
||||
}
|
||||
|
||||
// TestRefuseHTTPSDowngrade checks the transport refuses to follow a
|
||||
// redirect from HTTPS to HTTP unless --allow-https-downgrade is set,
|
||||
// whatever CheckRedirect policy the client uses.
|
||||
func TestRefuseHTTPSDowngrade(t *testing.T) {
|
||||
var plainHits int
|
||||
plain := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
plainHits++
|
||||
}))
|
||||
defer plain.Close()
|
||||
secure := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case "/downgrade":
|
||||
http.Redirect(w, r, plain.URL+"/final", http.StatusFound)
|
||||
case "/secure":
|
||||
http.Redirect(w, r, "/final", http.StatusFound)
|
||||
}
|
||||
}))
|
||||
defer secure.Close()
|
||||
tlsConfig := secure.Client().Transport.(*http.Transport).TLSClientConfig
|
||||
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
allow bool
|
||||
checkRedirect func(req *http.Request, via []*http.Request) error
|
||||
path string
|
||||
wantErr bool
|
||||
wantPlainHits int
|
||||
}{
|
||||
{name: "Default", path: "/downgrade", wantErr: true},
|
||||
{name: "CustomCheckRedirect", checkRedirect: func(*http.Request, []*http.Request) error { return nil }, path: "/downgrade", wantErr: true},
|
||||
{name: "Allowed", allow: true, path: "/downgrade", wantPlainHits: 1},
|
||||
{name: "HTTPSToHTTPS", path: "/secure"},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
plainHits = 0
|
||||
ctx, ci := fs.AddConfig(context.Background())
|
||||
ci.AllowHTTPSDowngrade = test.allow
|
||||
client := NewClientCustom(ctx, func(tr *http.Transport) {
|
||||
tr.TLSClientConfig = tlsConfig
|
||||
})
|
||||
if test.checkRedirect != nil {
|
||||
client.CheckRedirect = test.checkRedirect
|
||||
}
|
||||
resp, err := client.Get(secure.URL + test.path)
|
||||
if test.wantErr {
|
||||
require.Error(t, err)
|
||||
assert.ErrorIs(t, err, rest.ErrHTTPSDowngrade)
|
||||
assert.Contains(t, err.Error(), "--allow-https-downgrade")
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, resp.Body.Close())
|
||||
}
|
||||
assert.Equal(t, test.wantPlainHits, plainHits)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestRefuseHTTPSDowngradeClosesBody checks the transport closes the
|
||||
// request body when it refuses a redirect, as RoundTrip must.
|
||||
func TestRefuseHTTPSDowngradeClosesBody(t *testing.T) {
|
||||
body := &closeRecorder{Reader: strings.NewReader("potato")}
|
||||
req, err := http.NewRequest(http.MethodPost, "http://a.test/x", body)
|
||||
require.NoError(t, err)
|
||||
origin, err := http.NewRequest(http.MethodPost, "https://a.test/", nil)
|
||||
require.NoError(t, err)
|
||||
req.Response = &http.Response{Request: origin}
|
||||
|
||||
ctx, _ := fs.AddConfig(context.Background())
|
||||
_, err = NewTransport(ctx).RoundTrip(req)
|
||||
assert.ErrorIs(t, err, rest.ErrHTTPSDowngrade)
|
||||
assert.True(t, body.closed)
|
||||
}
|
||||
|
||||
// closeRecorder is an io.ReadCloser which records whether it was closed
|
||||
type closeRecorder struct {
|
||||
*strings.Reader
|
||||
closed bool
|
||||
}
|
||||
|
||||
// Close records the close
|
||||
func (c *closeRecorder) Close() error {
|
||||
c.closed = true
|
||||
return nil
|
||||
}
|
||||
Loaded 100 of 127 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user