diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 81ef3a9a..f517aad4 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -174,21 +174,21 @@ jobs: - name: Upload Windows installer x86_64 artifact if: ${{ startsWith(matrix.os, 'windows-') && github.event_name != 'pull_request' }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_windows_installer_x86_64 path: ./sftpgo_windows_x86_64.exe - name: Upload Windows installer arm64 artifact if: ${{ startsWith(matrix.os, 'windows-') && github.event_name != 'pull_request' }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_windows_installer_arm64 path: ./sftpgo_windows_arm64.exe - name: Upload Windows installer x86 artifact if: ${{ startsWith(matrix.os, 'windows-') && github.event_name != 'pull_request' }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_windows_installer_x86 path: ./sftpgo_windows_x86.exe @@ -214,7 +214,7 @@ jobs: - name: Upload build artifact if: startsWith(matrix.os, 'ubuntu-') != true - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo-${{ matrix.os }}-go-${{ matrix.go }} path: output @@ -430,7 +430,7 @@ jobs: cp sftpgo output/ - name: Upload build artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo-linux-${{ matrix.arch }}-go-${{ matrix.go }} path: output @@ -445,13 +445,13 @@ jobs: echo "::set-output name=pkg-version::${PKG_VERSION}" - name: Upload Debian Package - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo-${{ steps.build_linux_pkgs.outputs.pkg-version }}-${{ matrix.go-arch }}-deb path: pkgs/dist/deb/* - name: Upload RPM Package - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo-${{ steps.build_linux_pkgs.outputs.pkg-version }}-${{ matrix.go-arch }}-rpm path: pkgs/dist/rpm/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5b3f44ac..455e690e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: SFTPGO_VERSION: ${{ steps.get_version.outputs.VERSION }} - name: Upload build artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_${{ steps.get_version.outputs.VERSION }}_src_with_deps.tar.xz path: ./sftpgo_${{ steps.get_version.outputs.VERSION }}_src_with_deps.tar.xz @@ -206,7 +206,7 @@ jobs: - name: Upload macOS x86_64 artifact if: startsWith(matrix.os, 'macos-') - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_x86_64.tar.xz path: ./sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_x86_64.tar.xz @@ -214,7 +214,7 @@ jobs: - name: Upload macOS arm64 artifact if: startsWith(matrix.os, 'macos-') - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_arm64.tar.xz path: ./sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_arm64.tar.xz @@ -222,7 +222,7 @@ jobs: - name: Upload Windows installer x86_64 artifact if: startsWith(matrix.os, 'windows-') - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_x86_64.exe path: ./sftpgo_windows_x86_64.exe @@ -230,7 +230,7 @@ jobs: - name: Upload Windows installer arm64 artifact if: startsWith(matrix.os, 'windows-') - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_arm64.exe path: ./sftpgo_windows_arm64.exe @@ -238,7 +238,7 @@ jobs: - name: Upload Windows installer x86 artifact if: startsWith(matrix.os, 'windows-') - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_x86.exe path: ./sftpgo_windows_x86.exe @@ -246,7 +246,7 @@ jobs: - name: Upload Windows portable artifact if: startsWith(matrix.os, 'windows-') - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_portable.zip path: ./sftpgo_portable.zip @@ -373,7 +373,7 @@ jobs: cd .. - name: Upload build artifact for ${{ matrix.arch }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_${{ matrix.tar-arch }}.tar.xz path: ./output/sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_${{ matrix.tar-arch }}.tar.xz @@ -391,14 +391,14 @@ jobs: SFTPGO_VERSION: ${{ steps.get_version.outputs.SFTPGO_VERSION }} - name: Upload Deb Package - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_${{ steps.build_linux_pkgs.outputs.pkg-version }}-1_${{ matrix.deb-arch}}.deb path: ./pkgs/dist/deb/sftpgo_${{ steps.build_linux_pkgs.outputs.pkg-version }}-1_${{ matrix.deb-arch}}.deb retention-days: 1 - name: Upload RPM Package - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo-${{ steps.build_linux_pkgs.outputs.pkg-version }}-1.${{ matrix.rpm-arch}}.rpm path: ./pkgs/dist/rpm/sftpgo-${{ steps.build_linux_pkgs.outputs.pkg-version }}-1.${{ matrix.rpm-arch}}.rpm @@ -455,7 +455,7 @@ jobs: SFTPGO_VERSION: ${{ steps.get_version.outputs.SFTPGO_VERSION }} - name: Upload Linux bundle - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_bundle.tar.xz path: ./bundle/sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_bundle.tar.xz diff --git a/common/common.go b/common/common.go index df0d41ed..2a94616e 100644 --- a/common/common.go +++ b/common/common.go @@ -209,8 +209,9 @@ func LimitRate(protocol, ip string) (time.Duration, error) { return 0, nil } -// Reload reloads the whitelist and the defender's block and safe lists +// Reload reloads the whitelist, the IP filter plugin and the defender's block and safe lists func Reload() error { + plugin.Handler.ReloadFilter() var errWithelist error if Config.whitelist != nil { errWithelist = Config.whitelist.reload() diff --git a/go.mod b/go.mod index 024597bf..1c5cfe5b 100644 --- a/go.mod +++ b/go.mod @@ -8,12 +8,12 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0 github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 github.com/alexedwards/argon2id v0.0.0-20211130144151-3585854a6387 - github.com/aws/aws-sdk-go-v2 v1.15.0 - github.com/aws/aws-sdk-go-v2/config v1.15.0 - github.com/aws/aws-sdk-go-v2/credentials v1.10.0 - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.0 - github.com/aws/aws-sdk-go-v2/service/s3 v1.26.0 - github.com/aws/aws-sdk-go-v2/service/sts v1.16.0 + github.com/aws/aws-sdk-go-v2 v1.16.0 + github.com/aws/aws-sdk-go-v2/config v1.15.1 + github.com/aws/aws-sdk-go-v2/credentials v1.11.0 + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.1 + github.com/aws/aws-sdk-go-v2/service/s3 v1.26.1 + github.com/aws/aws-sdk-go-v2/service/sts v1.16.1 github.com/cockroachdb/cockroach-go/v2 v2.2.8 github.com/coreos/go-oidc/v3 v3.1.0 github.com/eikenb/pipeat v0.0.0-20210730190139-06b3e6902001 @@ -47,7 +47,7 @@ require ( github.com/rs/cors v1.8.2 github.com/rs/xid v1.4.0 github.com/rs/zerolog v1.26.2-0.20220227173336-263b0bde3672 - github.com/sftpgo/sdk v0.1.1-0.20220323095514-1e4782d9c52e + github.com/sftpgo/sdk v0.1.1-0.20220323191209-5d4ff81576b4 github.com/shirou/gopsutil/v3 v3.22.2 github.com/spf13/afero v1.8.2 github.com/spf13/cobra v1.4.0 @@ -76,15 +76,15 @@ require ( cloud.google.com/go/iam v0.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.0 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.6 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.0 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.7 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.1 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.7 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.1 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.8 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.11.0 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.1 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.11.1 // indirect github.com/aws/smithy-go v1.11.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/boombuler/barcode v1.0.1 // indirect @@ -147,7 +147,7 @@ require ( golang.org/x/tools v0.1.10 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2 // indirect + google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 // indirect google.golang.org/grpc v1.45.0 // indirect google.golang.org/protobuf v1.28.0 // indirect gopkg.in/ini.v1 v1.66.4 // indirect diff --git a/go.sum b/go.sum index 9e5f09d8..ea1e5493 100644 --- a/go.sum +++ b/go.sum @@ -137,48 +137,48 @@ github.com/aws/aws-sdk-go v1.15.27/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZo github.com/aws/aws-sdk-go v1.37.0/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.40.34/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= github.com/aws/aws-sdk-go-v2 v1.9.0/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= -github.com/aws/aws-sdk-go-v2 v1.15.0 h1:f9kWLNfyCzCB43eupDAk3/XgJ2EpgktiySD6leqs0js= -github.com/aws/aws-sdk-go-v2 v1.15.0/go.mod h1:lJYcuZZEHWNIb6ugJjbQY1fykdoobWbOS7kJYb4APoI= +github.com/aws/aws-sdk-go-v2 v1.16.0 h1:cBAYjiiexRAg9v2z9vb6IdxAa7ef4KCtjW7w7e3GxGo= +github.com/aws/aws-sdk-go-v2 v1.16.0/go.mod h1:lJYcuZZEHWNIb6ugJjbQY1fykdoobWbOS7kJYb4APoI= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.0 h1:J/tiyHbl07LL4/1i0rFrW5pbLMvo7M6JrekBUNpLeT4= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.0/go.mod h1:ohZjRmiToJ4NybwWTGOCbzlUQU8dxSHxYKzuX7k5l6Y= github.com/aws/aws-sdk-go-v2/config v1.7.0/go.mod h1:w9+nMZ7soXCe5nT46Ri354SNhXDQ6v+V5wqDjnZE+GY= -github.com/aws/aws-sdk-go-v2/config v1.15.0 h1:cibCYF2c2uq0lsbu0Ggbg8RuGeiHCmXwUlTMS77CiK4= -github.com/aws/aws-sdk-go-v2/config v1.15.0/go.mod h1:NccaLq2Z9doMmeQXHQRrt2rm+2FbkrcPvfdbCaQn5hY= +github.com/aws/aws-sdk-go-v2/config v1.15.1 h1:hTIZFepYESYyowQUBo47lu69WSxsYqGUILY9Nu8+7pY= +github.com/aws/aws-sdk-go-v2/config v1.15.1/go.mod h1:MZHGbuW2WnqIOQQBKu2ZkhTjuutZSTnn56TDq4QyydE= github.com/aws/aws-sdk-go-v2/credentials v1.4.0/go.mod h1:dgGR+Qq7Wjcd4AOAW5Rf5Tnv3+x7ed6kETXyS9WCuAY= -github.com/aws/aws-sdk-go-v2/credentials v1.10.0 h1:M/FFpf2w31F7xqJqJLgiM0mFpLOtBvwZggORr6QCpo8= -github.com/aws/aws-sdk-go-v2/credentials v1.10.0/go.mod h1:HWJMr4ut5X+Lt/7epc7I6Llg5QIcoFHKAeIzw32t6EE= +github.com/aws/aws-sdk-go-v2/credentials v1.11.0 h1:gc4Uhs80s60nmLon5Z4JXWinX2BkAGT0YROoUT8h8U4= +github.com/aws/aws-sdk-go-v2/credentials v1.11.0/go.mod h1:EdV1ZFgtZ4XM5RDHWcRWK8H+xW5duNVBqWj2oLu7tRo= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.5.0/go.mod h1:CpNzHK9VEFUCknu50kkB8z58AH2B5DvPP7ea1LHve/Y= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.0 h1:gUlb+I7NwDtqJUIRcFYDiheYa97PdVHG/5Iz+SwdoHE= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.0/go.mod h1:prX26x9rmLwkEE1VVCelQOQgRN9sOVIssgowIJ270SE= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.0 h1:G/5sApTwgC9qCw1TTtrVsZyZjgNIvo0rl9jjGEICcoY= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.0/go.mod h1:1vV+vjdjBD9ZzATKf7rlze/RwvjvluywiMzY12sNGo4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.6 h1:xiGjGVQsem2cxoIX61uRGy+Jux2s9C/kKbTrWLdrU54= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.6/go.mod h1:SSPEdf9spsFgJyhjrXvawfpyzrXHBCUe+2eQ1CjC1Ak= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.0 h1:bt3zw79tm209glISdMRCIVRCwvSDXxgAxh5KWe2qHkY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.0/go.mod h1:viTrxhAuejD+LszDahzAE2x40YjYWhMqzHxv2ZiWaME= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.1 h1:F9Je1nq5YXfMOv6451NHvMf6U0iTWeMnsG0MMIQoUmk= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.1/go.mod h1:Yph0XsTbQ5GGZ2+mO1a03P/SO9fdX3t1nejIp2tq79g= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.1 h1:2lGuOytsLs4N2z1UmZ9s7BuhHMcZxNkm612YsLHK/8g= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.1/go.mod h1:hkzjqerOQhhBGAL/DdmKLsP8hGZvtyvukCLvrU5twz4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.7 h1:KUErSJgdqmqAPBWAp6Zx9CjL0YXfytXJeXcsWnuCM1c= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.7/go.mod h1:oB9nZcxH1cGq7NPGurVJwxrO2vmJ9mmEBayCwcAlmT8= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.1 h1:feVfa9eJonhJiss7g51ikjNB2DrUzbNZNvPL8pw/54k= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.1/go.mod h1:K4vz7lRYCyLYpYAMCLObODahFgARdD3YVa0MvQte9Co= github.com/aws/aws-sdk-go-v2/internal/ini v1.2.2/go.mod h1:BQV0agm+JEhqR+2RT5e1XTFIDcAAV0eW6z2trp+iduw= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.7 h1:QOMEP8jnO8sm0SX/4G7dbaIq2eEP2wcWEsF0jzrXLJc= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.7/go.mod h1:P5sjYYf2nc5dE6cZIzEMsVtq6XeLD7c4rM+kQJPrByA= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.8 h1:adr3PfiggFtqgFofAMUFCtdvwzpf3QxPES4ezK4M3iI= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.8/go.mod h1:wLbQYt36AJqaRZUQiCNXzbtkNigyPfKHrotHuIDiCy8= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.0 h1:uhb7moM7VjqIEpWzTpCvceLDSwrWpaleXm39OnVjuLE= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.0/go.mod h1:pA2St3Pu2Ldy6fBPY45Azoh1WBG4oS7eIKOd4XN7Meg= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.0 h1:IhiVUezzcKlszx6wXSDQYDjEn/bIO6Mc73uNQ1YfTmA= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.0/go.mod h1:kLKc4lo+XKlMhENIpKbp7dCePpyUqUG1PqGIAXoxwNE= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.1 h1:iq77O8kBduROlzJ6mhN8zqxXxctDZ1PnWY0kyCfYMGc= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.1/go.mod h1:1R7cjoiEG9cgMCBpIOuCyZWT0Dn87vNUeAaC8Reiaow= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.0/go.mod h1:R1KK+vY8AfalhG1AOu5e35pOD2SdoPKQCFLTvnxiohk= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.0 h1:YQ3fTXACo7xeAqg0NiqcCmBOXJruUfh+4+O2qxF2EjQ= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.0/go.mod h1:R31ot6BgESRCIoxwfKtIHzZMo/vsZn2un81g9BJ4nmo= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.0 h1:i+7ve93k5G0S2xWBu60CKtmzU5RjBj9g7fcSypQNLR0= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.0/go.mod h1:L8EoTDLnnN2zL7MQPhyfCbmiZqEs8Cw7+1d9RlLXT5s= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.1 h1:B/SPX7J+Y0Yrcjv60Nhbh1gC2uBN47SfN8JYre6Mp4M= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.1/go.mod h1:2Hhr9Eh1gJzDatwACX/ozAZ/ljq5vzvPRu5cdu25tzc= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.1 h1:sjASzLVAG9okVe5HgLur36itaOY4UC90VZNXAtcn0+s= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.1/go.mod h1:ELGakx1J1qEJqWkwiN0jh3CMDTN6v17kOgN8kZgo6LQ= github.com/aws/aws-sdk-go-v2/service/kms v1.5.0/go.mod h1:w7JuP9Oq1IKMFQPkNe3V6s9rOssXzOVEMNEqK1L1bao= -github.com/aws/aws-sdk-go-v2/service/s3 v1.26.0 h1:6IdBZVY8zod9umkwWrtbH2opcM00eKEmIfZKGUg5ywI= -github.com/aws/aws-sdk-go-v2/service/s3 v1.26.0/go.mod h1:WJzrjAFxq82Hl42oh8HuvwpugTgxmoiJBBX8SLwVs74= +github.com/aws/aws-sdk-go-v2/service/s3 v1.26.1 h1:FSoVdUKHxAzZKXuemm+7vVj3eOUY5u01SSwwkfhWpqA= +github.com/aws/aws-sdk-go-v2/service/s3 v1.26.1/go.mod h1:ZS+sYP2DfetYS7n42MLAoz8x50T/w5su+rZmhaqTubg= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.6.0/go.mod h1:B+7C5UKdVq1ylkI/A6O8wcurFtaux0R1njePNPtKwoA= github.com/aws/aws-sdk-go-v2/service/ssm v1.10.0/go.mod h1:4dXS5YNqI3SNbetQ7X7vfsMlX6ZnboJA2dulBwJx7+g= github.com/aws/aws-sdk-go-v2/service/sso v1.4.0/go.mod h1:+1fpWnL96DL23aXPpMGbsmKe8jLTEfbjuQoA4WS1VaA= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.0 h1:gZLEXLH6NiU8Y52nRhK1jA+9oz7LZzBK242fi/ziXa4= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.0/go.mod h1:d1WcT0OjggjQCAdOkph8ijkr5sUwk1IH/VenOn7W1PU= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.1 h1:DyHctRsJIAWIvom1Itb4T84D2jwpIu+KIi3d0SFaswg= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.1/go.mod h1:CvFTucADIx7U/M44vjLs/ZttpQHdpxwK+62+dUGhDeY= github.com/aws/aws-sdk-go-v2/service/sts v1.7.0/go.mod h1:0qcSMCyASQPN2sk/1KQLQ2Fh6yq8wm0HSDAimPhzCoM= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.0 h1:0+X/rJ2+DTBKWbUsn7WtF0JvNk/fRf928vkFsXkbbZs= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.0/go.mod h1:+8k4H2ASUZZXmjx/s3DFLo9tGBb44lkz3XcgfypJY7s= +github.com/aws/aws-sdk-go-v2/service/sts v1.16.1 h1:xsOtPAvHqhvQvBza5ohaUcfq1LceH2lZKMUGZJKiZiM= +github.com/aws/aws-sdk-go-v2/service/sts v1.16.1/go.mod h1:Aq2/Qggh2oemSfyHH+EO4UBbgWG6zFCXLHYI4ILTY7w= github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.11.1 h1:IQ+lPZVkSM3FRtyaDox41R8YS6iwPMYIreejOgPW49g= github.com/aws/smithy-go v1.11.1/go.mod h1:3xHYmszWVx2c0kIwQeEVf9uSm4fYZt67FBJnwub1bgM= @@ -662,8 +662,8 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/secsy/goftp v0.0.0-20200609142545-aa2de14babf4 h1:PT+ElG/UUFMfqy5HrxJxNzj3QBOf7dZwupeVC+mG1Lo= -github.com/sftpgo/sdk v0.1.1-0.20220323095514-1e4782d9c52e h1:MZA1K8cG6Z31a788iOzidP4xARhsTIs0wvhxgPeVWXE= -github.com/sftpgo/sdk v0.1.1-0.20220323095514-1e4782d9c52e/go.mod h1:m5J7DH8unhD5RUsREFRiidP8zgBjup0+iQaxQnYHJOM= +github.com/sftpgo/sdk v0.1.1-0.20220323191209-5d4ff81576b4 h1:zpu89DMnl3d5Bu3YlvQuu3/KsjkhERgvqgqz+Lnn4CY= +github.com/sftpgo/sdk v0.1.1-0.20220323191209-5d4ff81576b4/go.mod h1:m5J7DH8unhD5RUsREFRiidP8zgBjup0+iQaxQnYHJOM= github.com/shirou/gopsutil/v3 v3.22.2 h1:wCrArWFkHYIdDxx/FSfF5RB4dpJYW6t7rcp3+zL8uks= github.com/shirou/gopsutil/v3 v3.22.2/go.mod h1:WapW1AOOPlHyXr+yOyw3uYx36enocrtSoSBy0L5vUHY= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= @@ -1131,8 +1131,8 @@ google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2 google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2 h1:3n0D2NdPGm0g0wrVJzXJWW5CBOoqgGBkDX9cRMJHZAY= -google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 h1:17TOyVD+9MLIDtDJW9PdtMuVT7gNLEkN+G/xFYjZmr8= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= diff --git a/plugin/plugin.go b/plugin/plugin.go index db63c643..8d7096f4 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -366,6 +366,20 @@ func (m *Manager) IsIPBanned(ip string) bool { return plugin.filter.CheckIP(ip) != nil } +// ReloadFilter sends a reload request to the IP filter plugin +func (m *Manager) ReloadFilter() { + if !m.hasIPFilter { + return + } + m.ipFilterLock.RLock() + plugin := m.filter + m.ipFilterLock.RUnlock() + + if err := plugin.filter.Reload(); err != nil { + logger.Error(logSender, "", "unable to reload IP filter plugin: %v", err) + } +} + func (m *Manager) kmsEncrypt(secret kms.BaseSecret, url string, masterKey string, kmsID int) (string, string, int32, error) { m.kmsLock.RLock() plugin := m.kms[kmsID] diff --git a/tests/ipfilter/go.mod b/tests/ipfilter/go.mod index 129abe7a..fbcf1fe4 100644 --- a/tests/ipfilter/go.mod +++ b/tests/ipfilter/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/hashicorp/go-plugin v1.4.3 - github.com/sftpgo/sdk v0.1.1-0.20220323095514-1e4782d9c52e + github.com/sftpgo/sdk v0.1.1-0.20220323191209-5d4ff81576b4 ) require ( diff --git a/tests/ipfilter/go.sum b/tests/ipfilter/go.sum index 9c9b5377..548fde17 100644 --- a/tests/ipfilter/go.sum +++ b/tests/ipfilter/go.sum @@ -80,8 +80,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/sftpgo/sdk v0.1.1-0.20220323095514-1e4782d9c52e h1:MZA1K8cG6Z31a788iOzidP4xARhsTIs0wvhxgPeVWXE= -github.com/sftpgo/sdk v0.1.1-0.20220323095514-1e4782d9c52e/go.mod h1:m5J7DH8unhD5RUsREFRiidP8zgBjup0+iQaxQnYHJOM= +github.com/sftpgo/sdk v0.1.1-0.20220323191209-5d4ff81576b4 h1:zpu89DMnl3d5Bu3YlvQuu3/KsjkhERgvqgqz+Lnn4CY= +github.com/sftpgo/sdk v0.1.1-0.20220323191209-5d4ff81576b4/go.mod h1:m5J7DH8unhD5RUsREFRiidP8zgBjup0+iQaxQnYHJOM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/tests/ipfilter/main.go b/tests/ipfilter/main.go index f7b4b0ae..e5bc6b66 100644 --- a/tests/ipfilter/main.go +++ b/tests/ipfilter/main.go @@ -16,6 +16,10 @@ func (f *Filter) CheckIP(ip string) error { return nil } +func (f *Filter) Reload() error { + return nil +} + func main() { plugin.Serve(&plugin.ServeConfig{ HandshakeConfig: ipfilter.Handshake,