how to connect a single redis server with auth?

3,271 views
Skip to first unread message

Dengpan Huang

unread,
Apr 9, 2018, 7:25:08 AM4/9/18
to Canvas LMS Users

Hi everyone,

Do you know how to connect a single redis server with auth? My redis server has password.

Here is my redis.yml settings:


production:

  servers:

    - redis://r-uf6ff66451csdfasdfasdsg



Does it need password/auth or something ?

Graham Ballantyne

unread,
Apr 9, 2018, 10:07:12 AM4/9/18
to canvas-l...@googlegroups.com
You need to pass the auth password in the Redis URL: redis://password@hostname. 

– 
Graham Ballantyne 
Senior Software Engineer | IT Services 
Simon Fraser University | Strand Hall 1001 
8888 University Dr., Burnaby, B.C. V5A 1S6 
604-837-6698  | gra...@sfu.ca

--

---
You received this message because you are subscribed to the Google Groups "Canvas LMS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to canvas-lms-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dengpan Huang

unread,
Apr 9, 2018, 11:00:52 AM4/9/18
to Canvas LMS Users
Hi Graham,
Thank you very much !
I change the settings like below, but it show the error as picture:

production:
  servers:
  port: 6379
  database: DB0



在 2018年4月9日星期一 UTC+8下午10:07:12,Graham Ballantyne写道:

Graham Ballantyne

unread,
Apr 9, 2018, 11:48:28 AM4/9/18
to canvas-l...@googlegroups.com
Sorry - the password should be preceded by a colon. Autocomplete removed it. redis://:password@hostname. 


– 
Graham Ballantyne 
Senior Software Engineer | IT Services 
Simon Fraser University | Strand Hall 1001 
8888 University Dr., Burnaby, B.C. V5A 1S6 
604-837-6698  | gra...@sfu.ca

Message has been deleted

Dengpan Huang

unread,
Apr 9, 2018, 12:01:03 PM4/9/18
to Canvas LMS Users
Thank you Graham, 
It shows another error, and I searched it on google, but no results.

production:
  servers:
  database: DB0


Redis method `auth` is potentially dangerous, and should only be called from console, and only if you fully understand the consequences. If you're sure, retry after running Shackles.activate!(:deploy) (Canvas::Redis::UnsupportedRedisMethod)

Graham Ballantyne

unread,
Apr 9, 2018, 12:14:02 PM4/9/18
to canvas-l...@googlegroups.com, Dengpan Huang
The error message is telling you what to do (in a Rails console)… 
Shackles.activate!(:deploy)

The 'AUTH' command is included in a list of potentially-unsafe redis commands that aren't normally allowed (see https://github.com/instructure/canvas-lms/blob/e5a181caa320bcec6ca8394dc2a0d35b02e207a2/lib/canvas/redis.rb#L254). I'll leave it to someone from Instructure to say why AUTH is in there (Redis' AUTH doesn't really offer much in the way of security; you're better off using firewall rules to restrict access to your redis server from only your Canvas server). Note that by running that command you'll enable *all* the potentially-unsafe Redis commands, not just AUTH.


– 
Graham Ballantyne 
Senior Software Engineer | IT Services 
Simon Fraser University | Strand Hall 1001 
8888 University Dr., Burnaby, B.C. V5A 1S6 
604-837-6698  | gra...@sfu.ca

--

Dengpan Huang

unread,
Apr 9, 2018, 12:32:47 PM4/9/18
to Canvas LMS Users
Dear Graham,

I appreciated for your help, it works now.
Have a nice day ! ^_^

Connie J

unread,
Feb 28, 2019, 5:16:09 AM2/28/19
to Canvas LMS Users
Hello Graham,

May I know that if we use Redis's SSL port 6380, how do I pass it to the Redis URL?

I tried redis://:password@hostname:port but the following errors occur while trying to compile assets:

NoMethodError: NoMethodError
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/switchman-1.12.16/lib/switchman/action_controller/caching.rb:15:in `cache_store='

Graham Ballantyne

unread,
Feb 28, 2019, 1:40:31 PM2/28/19
to canvas-l...@googlegroups.com

Redis doesn't have a "SSL port"; there's no SSL support built into Redis. The default port is 6379, though you can configure it to listen on whatever port you want. Is your redis server actually listening on port 6380? You can try to telnet to your redis server on that port and issue an INFO command (telnet yourredisserver 6380).


If you're using a redis-as-a-service provider that offers SSL you should consult the documentation for that provider.




From: canvas-l...@googlegroups.com <canvas-l...@googlegroups.com> on behalf of Connie J <constanc...@gmail.com>
Sent: February 28, 2019 02:16
To: Canvas LMS Users
Subject: Re: [Canvas] how to connect a single redis server with auth?
 

Connie J

unread,
Feb 28, 2019, 9:23:46 PM2/28/19
to Canvas LMS Users
We use Azure Cache for Redis which provides a SSL port 6380 and port 6379 is disabled by default for security concern. Is it not possible for Canvas to connect to other Redis ports except the default one (6379)?

Graham Ballantyne

unread,
Feb 28, 2019, 9:38:53 PM2/28/19
to canvas-l...@googlegroups.com
It is, you pass the port number in the URL. redis://youreedisserver:6380


– 
Graham Ballantyne 
Senior Software Engineer | IT Services 
Simon Fraser University | Strand Hall 1001 
8888 University Dr., Burnaby, B.C. V5A 1S6 
604-837-6698  | gra...@sfu.ca

Connie J

unread,
Feb 28, 2019, 11:46:07 PM2/28/19
to Canvas LMS Users
I changed redis.yml to 

production:
  servers:

But the following errors occur while trying to compile assets:

rake aborted!
NoMethodError: NoMethodError
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/switchman-1.12.16/lib/switchman/action_controller/caching.rb:15:in `cache_store='
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.6.1/lib/action_controller/railtie.rb:63:in `block (3 levels) in <class:Railtie>'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.6.1/lib/action_controller/railtie.rb:60:in `each'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.6.1/lib/action_controller/railtie.rb:60:in `block (2 levels) in <class:Railtie>'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.1/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.1/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.1/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.1/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.1/lib/active_support/lazy_load_hooks.rb:41:in `block in on_load'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.1/lib/active_support/lazy_load_hooks.rb:40:in `each'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.1/lib/active_support/lazy_load_hooks.rb:40:in `on_load'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.6.1/lib/action_controller/railtie.rb:55:in `block in <class:Railtie>'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.1/lib/rails/initializable.rb:30:in `instance_exec'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.1/lib/rails/initializable.rb:30:in `run'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.1/lib/rails/initializable.rb:59:in `block in run_initializers'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.1/lib/rails/initializable.rb:58:in `run_initializers'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.1/lib/rails/application.rb:353:in `initialize!'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.1/lib/rails/railtie.rb:185:in `public_send'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.1/lib/rails/railtie.rb:185:in `method_missing'
/opt/canvas/htdocs/config/environment.rb:28:in `<top (required)>'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.1/lib/active_support/dependencies.rb:292:in `require'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.1/lib/active_support/dependencies.rb:292:in `block in require'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.1/lib/active_support/dependencies.rb:258:in `load_dependency'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.1/lib/active_support/dependencies.rb:292:in `require'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.1/lib/rails/application.rb:329:in `require_environment!'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.1/lib/rails/application.rb:445:in `block in run_tasks_blocks'
/opt/canvas/htdocs/lib/tasks/css.rake:18:in `block (3 levels) in <top (required)>'
/opt/canvas/htdocs/lib/tasks/css.rake:16:in `block (2 levels) in <top (required)>'
/opt/canvas/htdocs/lib/tasks/canvas.rake:40:in `block (2 levels) in <top (required)>'
/opt/canvas/htdocs/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => brand_configs:write => environment
Reply all
Reply to author
Forward
0 new messages