Is it possible to install Apache mod_security Amaz

2019-09-03 11:34发布

问题:

I have 4 ec2 instances (running Amazon Linux AMI) and i'am using elastic beanstalk to deploy my Java app to Tomcat.

I would like to know if it was possible to install the apache mod_security using the .ebextensions ?

ps: I know how to install mod_security and configure the rulse if I have to do it by hand. As I'm not really familiar with ebextensions I would like to know first if is this would be possible?

ps2: I would like to install mod_security to have a protection against simple DOS attack Thank you!

回答1:

Yes it is possible. At the simplest you can create a file in .ebextensions called 10_mod_security.config

and inside contain

packages:
  yum:
    mod_security: []

if you wish to create an extra config file you can do so in the same file, like;

files:
  "/etc/httpd/conf.d/mod_security.conf":
    mode: "000644"
    owner: root
    group: root
    content: |
      insert your apache config here
    encoding: plain

that will install the package via yum, and then create a config file in the appropriate directory (although I believe yum creates the file for you automatically, you'd have to do some testing with this)

Hope this helps.