Error mailer type control

I am really not interested in getting error mails for crap like people
scanning to see if I have some outdated version of phpmyadmin,
roundcube, etc… the typical stuff hackers are will look for.

So within my application controller before it sends me an e-mail, I want
to search to see if it’s a valid ‘controller’ that’s being requested
before it actually sends me an error e-mail.

Thus I need something like…

if [ LIST_OF_MY_CONTROLLERS ].include?(params[:action])

how do I get a list of my controllers?

Craig


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Craig W. wrote:

I am really not interested in getting error mails for crap like people
scanning to see if I have some outdated version of phpmyadmin,
roundcube, etc… the typical stuff hackers are will look for.

So within my application controller before it sends me an e-mail, I want
to search to see if it’s a valid ‘controller’ that’s being requested
before it actually sends me an error e-mail.

Thus I need something like…

if [ LIST_OF_MY_CONTROLLERS ].include?(params[:action])

how do I get a list of my controllers?

Craig


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

I don’t know of a good way to list of all your app’s controllers (you
could search for all Constants that descend from
ApplicationController, but that seems prettttty grody). I’m assuming
the emails are being sent from a rescue_from or somesuch similar in your
ApplicationController… would it work for your requirements to instead
just create a catchall route and then send a 404 error/page?

On Sun, 2010-02-14 at 03:23 +0100, Paul H. wrote:

if [ LIST_OF_MY_CONTROLLERS ].include?(params[:action])

how do I get a list of my controllers?

I don’t know of a good way to list of all your app’s controllers (you
could search for all Constants that descend from
ApplicationController, but that seems prettttty grody). I’m assuming
the emails are being sent from a rescue_from or somesuch similar in your
ApplicationController… would it work for your requirements to instead
just create a catchall route and then send a 404 error/page?


well I am certainly trying to deal with a ‘rescue_from’.

In essence, all the various crap that people scan web servers in hopes
of finding exploitable software for are generating 404 errors…that’s
to be expected.

I just don’t want to see an e-mail if the URL’s they are requesting
aren’t a controller in my application.

Obviously I can provide a defined list of my controllers to this but
that is rather analog and rails should be able to give me a list of my
controllers or an array that I can flatten.

Thanks

Craig


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

On Sat, 2010-02-13 at 22:16 -0700, Craig W. wrote:

Thus I need something like…
ApplicationController… would it work for your requirements to instead

Obviously I can provide a defined list of my controllers to this but
that is rather analog and rails should be able to give me a list of my
controllers or an array that I can flatten.


this gets me awfully close…

@conts = []
controllers = Dir.new("#{RAILS_ROOT}/app/controllers").entries
controllers.each do |controller|
if controller =~ /_controller/ and not controller.index(".swp") then
cont =
controller.gsub(".rb~","").gsub(".rb","").gsub("_controller","")
@conts << [cont]
end
end
and I can flatten @conts at that point and I could spend the time to
toss .svn out but for now, I’m good.

Craig


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs