Не удается захватить группу регулярных выражений?

Хорошо, чтобы запретить Mac использовать IPV6, я должен отключить его в командной строке. Несмотря на то, что в графическом интерфейсе он отображается как «ненастроенный», он все еще получает адрес IPV6 с моего DHCP-сервера. Вот шаги, которые я предпринял.

1 )Отключить IPV6 на Mac

networksetup -setv6off Wi-Fi $$ networksetup -setv6off Ethernet (-usesetv6automatic to enable)

2 )Убедился, что мой DHCP-сервер (в данном случае это ящик, на котором я устанавливал fail2ban и dropbear )не является службой IPV6

3 )Если вам нужно отключить IPV6 на машине lixun (либо цель, либо хост)

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1 
=0 will enable

4 )Я вернулся к стандартному фильтру медведя fail2ban. Кажется, он был обновлен с момента моего последнего сообщения, чтобы зафиксировать разницу в случае потенциального сообщения об ошибке.

# Fail2Ban filter for dropbear
#
# NOTE: The regex below is ONLY intended to work with a patched
# version of Dropbear as described here:
# http://www.unchartedbackwaters.co.uk/pyblosxom/static/patches
#            ^%(__prefix_line)sexit before auth from <HOST>.*\s*$
#
# The standard Dropbear output doesn't provide enough information to
# ban all types of attack.  The Dropbear patch adds IP address
# information to the 'exit before auth' message which is always
# produced for any form of non-successful login. It is that message
# which this file matches.
#
# More information: http://bugs.debian.org/546913

[INCLUDES]

# Read common prefixes. If any customizations available -- read them from
# common.local
before = common.conf

[Definition]

_daemon = dropbear

failregex = ^%(__prefix_line)s[Ll]ogin attempt for nonexistent user ('.*' )?from <HOST>:\d+$
            ^%(__prefix_line)s[Bb]ad (PAM )?password attempt for.+ from <HOST>(:\d+)?$
            ^%(__prefix_line)s[Ee]xit before auth \(user '.+', \d+ fails\): Max auth tries reached - user '.+' from <HOST>:\d+\s*$

ignoreregex =

# DEV Notes:
#
# The first two regexs here match the unmodified dropbear messages. It isn't
# possible to match the source of the 'exit before auth' messages from dropbear
# as they don't include the "from <HOST>" bit.
#
# The second last failregex line we need to match with the modified dropbear.
#
# For the second regex the following apply:
#
# http://www.netmite.com/android/mydroid/external/dropbear/svr-authpam.c
# http://svn.dd-wrt.com/changeset/16642#file64

5 )Убедитесь, что IP-таблицы -работают с ожидаемой скоростью, используя таблицы -Команда L должна показать результат, аналогичный моему (, если у вас нет других правил ). Мне пришлось обновить ядро ​​с помощью обновления rpi -.

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
fail2ban-dropbear  tcp  --  anywhere             anywhere            
fail2ban-ssh  tcp  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain fail2ban-dropbear (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere            

Chain fail2ban-ssh (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere 
0
19.07.2018, 23:26
1 ответ

Синтаксис регулярных выражений Bash не распознает \d; используйте [[:digit:]]вместо:

pingnet="pingcount,site=DC,cur=200 total-up=988"
regex='([[:digit:]]+)$'
4
28.01.2020, 02:23

Теги

Похожие вопросы