
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
Remote DiskService through SFTP, for ActiveStorage.
Add this line to your application's Gemfile:
gem 'activestorage-sftp'
And then execute:
$ bundle
Or install it yourself as:
$ gem install activestorage-sftp
Each application server saves blobs to file server through SFTP:
# config/storage.yml
sftp:
service: SFTP
user: user
root: /var/www/proj/shared/storage
host: file.intranet
public_host: https://file.internet
password: <%= ENV['PASSWORD'] %> # optional
File server serves blobs using DiskService:
# config/storage.yml
local:
service: Disk
root: <%= Rails.root.join("storage") %>
Or use it as backup for your primary service:
# config/storage.yml
mirrored:
service: Mirror
primary: local #/S3/AzureStorage/GCS
mirrors:
- sftp
sftp:
service: SFTP
user: user
root: /etc/backup/proj
host: secure.backup
By default the generated URLs will include parameters for content_disposition, expiration hints etc. A generated blobs URL might thus look like:
https://publichost/PATH/rails/active_storage/disk/hash-hash/name.JPG?content_type=image%2Fjpeg&disposition=inline%3B+filename%3D
If you prefer simple URLs like
https://publichost/PATH/hash
you can set a configuration option:
# config/storage.yml
sftp:
simple_public_urls: true # defaults to false
The default way of verifying that a blob does exist is to login to the sftp server and stat() the relevant file. This is done e.g. before re-transforming and uploading an image variant. While other "caching" solutions exist to speed up that process, a simple and efficient way of verifying the existence of a file is to query the relevant server with an HTTP HEAD request. Depending on the setup this might not always be a viable way, so it can be switched on with a configuration option.
# config/storage.yml
sftp:
verify_via_http_get: true # defaults to false
Bug reports and pull requests are welcome on GitHub at https://github.com/treenewbee/activestorage-sftp.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that activestorage-sftp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.