Redis
 sql >> Baza danych >  >> NoSQL >> Redis

Jak mogę zabezpieczyć hasłem moją trasę /sidekiq (tj. wymagać uwierzytelnienia dla narzędzia Sidekiq::Web)?

Umieść następujące elementy w inicjatorze sidekiq

require 'sidekiq'
require 'sidekiq/web'

Sidekiq::Web.use(Rack::Auth::Basic) do |user, password|
  # Protect against timing attacks:
  # - See https://codahale.com/a-lesson-in-timing-attacks/
  # - See https://thisdata.com/blog/timing-attacks-against-string-comparison/
  # - Use & (do not use &&) so that it doesn't short circuit.
  # - Use digests to stop length information leaking
  Rack::Utils.secure_compare(::Digest::SHA256.hexdigest(user), ::Digest::SHA256.hexdigest(ENV["SIDEKIQ_USER"])) &
  Rack::Utils.secure_compare(::Digest::SHA256.hexdigest(password), ::Digest::SHA256.hexdigest(ENV["SIDEKIQ_PASSWORD"]))
end

A w pliku tras:

mount Sidekiq::Web => '/sidekiq'


  1. Redis
  2.   
  3. MongoDB
  4.   
  5. Memcached
  6.   
  7. HBase
  8.   
  9. CouchDB
  1. Czy Redis to tylko pamięć podręczna?

  2. Zmniejsz wynik w Redis lub usuń, jeśli 0

  3. Uruchamianie Redisa w Travis CI

  4. Obraz dokowany strażnika Redis / plik Dockerfile

  5. Przełączanie awaryjne Redis za pomocą StackExchange / Sentinel z C#