How to apply fail2ban to Tracks 's authorization page?

33 views
Skip to first unread message

for.socia...@gmail.com

unread,
Oct 14, 2018, 11:34:08 PM10/14/18
to TracksApp
First of all, I would like to thank all those who have created and maintained such a good program.

I setup Tracks on raspberry pi(OS raspberian). following instruction .It works!!

I want to apply fail2ban to Tracks 's authorization page..for preventing of brute attacks.

But I donot know how It can be do.

I found a article about these

https://dradisframework.com/academy/knowledge-base/ruby/ruby-on-rails/protect-rails-application-with-fail2ban.html

following above articles

___________________________
Finally, configure the new notifier in your config/environments/production.rb file:
config.middleware.use ExceptionNotification::Rack,
:email => { ... },
:fail2ban => {}
__________________________


at this step..
I am wondering what to change into this part. ( ;fail2ban => {} )

help me..

or

Is there any other way to apply fail2ban to Tracks's authorization page

help me!

Matt Rogers

unread,
Oct 16, 2018, 2:34:44 PM10/16/18
to TracksApp
I'm not sure that you need to change anything in the example code that's on the blog post. My advice to you is to give a try just the way it is and see if it works.

I'm afraid I don't know anything about how to do this myself, as it's not something I've applied to any of the Tracks installs that I've run before.

Thanks!
--
Matt

--
You received this message because you are subscribed to the Google Groups "TracksApp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tracksapp+...@googlegroups.com.
To post to this group, send email to trac...@googlegroups.com.
Visit this group at https://groups.google.com/group/tracksapp.
For more options, visit https://groups.google.com/d/optout.

for.socia...@gmail.com

unread,
Oct 17, 2018, 1:50:01 AM10/17/18
to TracksApp
When I succeed launching Tracks, Terminal shows

pi@raspberrypi:~/Tracks $ sh for_start_Tracks_sever.sh
/var/lib/gems/2.3.0/gems/htmlentities-4.3.2/lib/htmlentities/mappings/expanded.rb:465: warning: key "inodot" is duplicated and overwritten on line 466
=> Booting Thin
=> Rails 4.1.11 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
/home/pi/Tracks/tracks-2.3.0/app/models/recurring_todos/abstract_recurring_todos_builder.rb:80: warning: key :target is duplicated and overwritten on line 85
Thin web server (v1.7.2 codename Bachmanity)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop

After I add

config.middleware.use ExceptionNotification::Rack,
  :email => { ... },
  :fail2ban => {}

in config/environments/production.rb

When I try launching Tracks, Terminal shows

sh for_start_Tracks_sever.sh
/var/lib/gems/2.3.0/gems/htmlentities-4.3.2/lib/htmlentities/mappings/expanded.rb:465: warning: key "inodot" is duplicated and overwritten on line 466
=> Booting Thin
=> Rails 4.1.11 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
/var/lib/gems/2.3.0/gems/activesupport-4.1.11/lib/active_support/dependencies.rb:247:in `require': /home/pi/Tracks/tracks-2.3.0/config/environments/production.rb:81: syntax error, unexpected ..., expecting '}' (SyntaxError)
  :email => { ... },
                 ^
    from /var/lib/gems/2.3.0/gems/activesupport-4.1.11/lib/active_support/dependencies.rb:247:in `block in require'
    from /var/lib/gems/2.3.0/gems/activesupport-4.1.11/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /var/lib/gems/2.3.0/gems/activesupport-4.1.11/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/engine.rb:594:in `block (2 levels) in <class:Engine>'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/engine.rb:593:in `each'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/engine.rb:593:in `block in <class:Engine>'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/initializable.rb:30:in `instance_exec'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/initializable.rb:30:in `run'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /usr/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
    from /usr/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /usr/lib/ruby/2.3.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    from /usr/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /usr/lib/ruby/2.3.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/initializable.rb:44:in `each'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/initializable.rb:44:in `tsort_each_child'
    from /usr/lib/ruby/2.3.0/tsort.rb:415:in `call'
    from /usr/lib/ruby/2.3.0/tsort.rb:415:in `each_strongly_connected_component_from'
    from /usr/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /usr/lib/ruby/2.3.0/tsort.rb:347:in `each'
    from /usr/lib/ruby/2.3.0/tsort.rb:347:in `call'
    from /usr/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
    from /usr/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
    from /usr/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/initializable.rb:54:in `run_initializers'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/application.rb:300:in `initialize!'
    from /home/pi/Tracks/tracks-2.3.0/config/environment.rb:5:in `<top (required)>'
    from /var/lib/gems/2.3.0/gems/activesupport-4.1.11/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/2.3.0/gems/activesupport-4.1.11/lib/active_support/dependencies.rb:247:in `block in require'
    from /var/lib/gems/2.3.0/gems/activesupport-4.1.11/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /var/lib/gems/2.3.0/gems/activesupport-4.1.11/lib/active_support/dependencies.rb:247:in `require'
    from /home/pi/Tracks/tracks-2.3.0/config.ru:3:in `block in <main>'
    from /var/lib/gems/2.3.0/gems/rack-1.5.4/lib/rack/builder.rb:55:in `instance_eval'
    from /var/lib/gems/2.3.0/gems/rack-1.5.4/lib/rack/builder.rb:55:in `initialize'
    from /home/pi/Tracks/tracks-2.3.0/config.ru:in `new'
    from /home/pi/Tracks/tracks-2.3.0/config.ru:in `<main>'
    from /var/lib/gems/2.3.0/gems/rack-1.5.4/lib/rack/builder.rb:49:in `eval'
    from /var/lib/gems/2.3.0/gems/rack-1.5.4/lib/rack/builder.rb:49:in `new_from_string'
    from /var/lib/gems/2.3.0/gems/rack-1.5.4/lib/rack/builder.rb:40:in `parse_file'
    from /var/lib/gems/2.3.0/gems/rack-1.5.4/lib/rack/server.rb:277:in `build_app_and_options_from_config'
    from /var/lib/gems/2.3.0/gems/rack-1.5.4/lib/rack/server.rb:199:in `app'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/commands/server.rb:50:in `app'
    from /var/lib/gems/2.3.0/gems/rack-1.5.4/lib/rack/server.rb:314:in `wrapped_app'
    from /var/lib/gems/2.3.0/gems/rack-1.5.4/lib/rack/server.rb:250:in `start'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/commands/server.rb:69:in `start'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/commands/commands_tasks.rb:81:in `block in server'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/commands/commands_tasks.rb:76:in `tap'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/commands/commands_tasks.rb:76:in `server'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /var/lib/gems/2.3.0/gems/railties-4.1.11/lib/rails/commands.rb:17:in `<top (required)>'
    from /home/pi/Tracks/tracks-2.3.0/bin/rails:10:in `require'
    from /home/pi/Tracks/tracks-2.3.0/bin/rails:10:in `<top (required)>'
    from /var/lib/gems/2.3.0/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
    from /var/lib/gems/2.3.0/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
    from /var/lib/gems/2.3.0/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
    from /var/lib/gems/2.3.0/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
    from /var/lib/gems/2.3.0/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
    from /var/lib/gems/2.3.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
    from /var/lib/gems/2.3.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
    from /home/pi/Tracks/tracks-2.3.0/bin/spring:16:in `require'
    from /home/pi/Tracks/tracks-2.3.0/bin/spring:16:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

and Tracks doesnot start( I cannnot connect Tracks login page)

So...I think...
It maybe need to change this part. ( ;fail2ban => {} )

Is there no way for preventing of brute attacks?

thanks for reading..!!

2018년 10월 17일 수요일 오전 3시 34분 44초 UTC+9, Matt Rogers 님의 말:

Matt Rogers

unread,
Oct 18, 2018, 11:02:21 AM10/18/18
to TracksApp
We don't include anything for preventing brute attacks by default, as most sites tend to be small and fly under the radar. 

It looks like the  fail2ban configuration will definitely need some tweaking based on your needs. For example, the three dots between the curly braces need to a string with your email address in it.


for.socia...@gmail.com

unread,
Oct 19, 2018, 1:05:41 AM10/19/18
to TracksApp
Thanks for help!!!

2018년 10월 19일 금요일 오전 12시 2분 21초 UTC+9, Matt Rogers 님의 말:
Reply all
Reply to author
Forward
0 new messages