Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

FOP2 Community Forum

  1. Home
  2. Support
  3. FOP2 logs

FOP2 logs

Scheduled Pinned Locked Moved Support
9 Posts 3 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    S
    sbasan
    wrote on last edited by
    #1

    Hi,

    I want to add the fop2 login attempts to fail2ban.
    There are no logs for login attempts under httpd log.
    How can I add the login attempts or login failures to fail2ban?

    זה בלובינט IP מרכזיות

    1 Reply Last reply
    0
    • N
      N
      nicolas
      wrote on last edited by
      #2

      Enable the audit log with the -a command line variable. Edit /etc/sysconfig/fop2 and change the OPTIONS variable to include it, something similar to this:

      OPTIONS="-d -a /var/log/fop2_audit.log"

      Then you can add that log to fail2ban rules.

      Best regards,

      1 Reply Last reply
      0
      • A
        A
        avayax
        wrote on last edited by
        #3

        Also trying to accomplish that.
        I got this in /etc/sysconfig/fop2:
        OPTIONS="-d -a /var/log/fop2_audit.log"

        Created fop2_audit.log in /var/log/.
        Now nothing gets written into fop2_audit.log, the file stays empty.
        What am I missing?

        1 Reply Last reply
        0
        • N
          N
          nicolas
          wrote on last edited by
          #4

          Do not create the file, it should be created by fop2.. if you create the file you might do it with incorrect permissions, so it is better to let the software do it for you. Also, are you sure you restarted FOP2? what is the output from

          ps uax | grep fop2

          ?

          1 Reply Last reply
          0
          • A
            A
            avayax
            wrote on last edited by
            #5

            Yes. It is working now after a fop2 restart.
            Can you verify that this entry in /etc/sysconfig is correct?
            Running High Availability and my Ethernet interface is em1.
            OPTIONS="-d -i em1 -c /etc/asterisk/fop2 -a /var/log/fop2_audit.log"

            1 Reply Last reply
            0
            • N
              N
              nicolas
              wrote on last edited by
              #6

              Seems correct, rough human translation:

              daemonize, use interface em1 MAC address for license, use /etc/asterisk/fop2 for configuration directories and generate an audit log in /var/log/fop2_audit.log

              1 Reply Last reply
              0
              • A
                A
                avayax
                wrote on last edited by
                #7

                This is working.
                Just posting the working config I used for other users who want to do the same. This is for PIAF and FreePBX distro, which come with a preconfigured fail2ban setup.

                Create a fop2.conf file in /etc/fail2ban/filter.d/ and put the following content in there:
                [INCLUDES]

                Read common prefixes. If any customizations available -- read them from

                common.local

                before = common.conf

                [Definition]

                _daemon = fop2_server

                Option: failregex

                Notes.: regex to match the password failures messages in the logfile. The

                host must be matched by a group named "host". The tag "<HOST>" can

                be used for standard IP/hostname matching and is only an alias for

                (?:::f{4,6}:)?(?P<host>[\w-.^_]+)

                Values: TEXT

                failregex = GENERAL|FAILED LOGIN (bad password)|<HOST>

                Option: ignoreregex

                Notes.: regex to ignore. If this regex matches, the line is ignored.

                Values: TEXT

                ignoreregex =

                Then add below content to /etc/fail2ban/jail.conf:
                [fop2]
                enabled = true
                filter = fop2
                action = iptables-allports[name=FOP2, protocol=all]
                sendmail[name=FOP2, dest="your destination email", sender=root@"hostname"]
                logpath = /var/log/fop2_audit.log
                bantime = 1800
                findtime = 600
                maxretry = 8
                backend = auto

                Adjust the bantime, etc. settings and change the action if you want to block custom ports and not all.
                A failed login attempt in /var/log/fop2_audit.log looks like this:

                1447099540|8800|GENERAL|FAILED LOGIN (bad password)|192.168.1.254:49379
                1447099545|8800|GENERAL|FAILED LOGIN (bad password)|192.168.1.254:49396

                Good luck!

                1 Reply Last reply
                0
                • N
                  N
                  nicolas
                  wrote on last edited by
                  #8

                  Thanks for sharing your fail2ban config!

                  1 Reply Last reply
                  0
                  • A
                    A
                    avayax
                    wrote on last edited by
                    #9

                    Adding a slight correction here.
                    Put that into /etc/fail2ban/filter.d/fop2.conf:
                    failregex = GENERAL|FAILED LOGIN (bad password)|<HOST>:\d+
                    GENERAL|FAILED LOGIN (non existant user)|<HOST>:\d+

                    Also don't forget to do service fail2ban restart. Do fail2ban-client status to see if your jail got added.

                    1 Reply Last reply
                    0

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    Powered by NodeBB Contributors
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups