<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>56369</bug_id>
          
          <creation_ts>2025-10-13 20:09:28 +0300</creation_ts>
          <short_desc>Правила fail2ban для postfix-sasl не работают из коробки (p11)</short_desc>
          <delta_ts>2025-10-21 16:14:37 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>fail2ban</component>
          <version>unstable</version>
          <rep_platform>x86_64</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P4</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>ksenobayt</reporter>
          <assigned_to name="Anton Vyatkin">toni</assigned_to>
          <cc>amakeenk</cc>
    
    <cc>glebfm</cc>
    
    <cc>glinkinvd</cc>
    
    <cc>kotopesutility</cc>
    
    <cc>root</cc>
    
    <cc>toni</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>274364</commentid>
    <comment_count>0</comment_count>
    <who name="">ksenobayt</who>
    <bug_when>2025-10-13 20:09:28 +0300</bug_when>
    <thetext>Вводные:

- Система с postfix
- p10 обновлена до p11 &quot;на живую&quot;
- был настроен fail2ban в дефолтной конфигурации (т.е. использовался фильтр postfix.conf, содержащий в себе правила для plain text и sasl, которые применялись jail&apos;ом postfix-sasl в jail.local)
- никаких изменений в конфиг не вносилось

После полного апгрейда системы до p11, правила f2b больше не компилируются корректно:

--

sudo fail2ban-regex /var/log/mail/all /etc/fail2ban/filter.d/postfix.conf

Running tests
=============

Use   failregex filter file : postfix, basedir: /etc/fail2ban
Use      datepattern : {^LN-BEG} : Default Detectors
Use         log file : /var/log/mail/all
Use         encoding : UTF-8

Traceback (most recent call last):
  File &quot;/bin/fail2ban-regex&quot;, line 34, in &lt;module&gt;
    exec_command_line()
  File &quot;/usr/lib/python3/site-packages/fail2ban/client/fail2banregex.py&quot;, line 836, in exec_command_line
    if not fail2banRegex.start(args):
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib/python3/site-packages/fail2ban/client/fail2banregex.py&quot;, line 776, in start
    self.process(test_lines)
  File &quot;/usr/lib/python3/site-packages/fail2ban/client/fail2banregex.py&quot;, line 584, in process
    line_datetimestripped, ret, is_ignored = self.testRegex(line)
                                             ^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib/python3/site-packages/fail2ban/client/fail2banregex.py&quot;, line 456, in testRegex
    found = self._filter.processLine(line, date)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib/python3/site-packages/fail2ban/server/filter.py&quot;, line 613, in processLine
    timeMatch = self.dateDetector.matchTime(line)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib/python3/site-packages/fail2ban/server/datedetector.py&quot;, line 406, in matchTime
    match = template.matchDate(line)
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib/python3/site-packages/fail2ban/server/datetemplate.py&quot;, line 161, in matchDate
    self._compileRegex()
  File &quot;/usr/lib/python3/site-packages/fail2ban/server/datetemplate.py&quot;, line 155, in _compileRegex
    raise e
  File &quot;/usr/lib/python3/site-packages/fail2ban/server/datetemplate.py&quot;, line 152, in _compileRegex
    self._cRegex = re.compile(self.regex)
                   ^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib64/python3.12/re/__init__.py&quot;, line 228, in compile
    return _compile(pattern, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib64/python3.12/re/__init__.py&quot;, line 307, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib64/python3.12/re/_compiler.py&quot;, line 745, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib64/python3.12/re/_parser.py&quot;, line 979, in parse
    p = _parse_sub(source, state, flags &amp; SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib64/python3.12/re/_parser.py&quot;, line 460, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib64/python3.12/re/_parser.py&quot;, line 840, in _parse
    raise source.error(&apos;global flags not at the start &apos;
re.error: global flags not at the start of the expression at position 13

--

То же самое происходит в конфигурации по умолчанию, при установке p11 начисто с нуля.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>274418</commentid>
    <comment_count>1</comment_count>
    <who name="">ksenobayt</who>
    <bug_when>2025-10-14 12:18:33 +0300</bug_when>
    <thetext>Есть подозрение, что проблема появилась после обновления Python в p11: версия самого fail2ban не поменялась, однако версии парсеров, в том числе re - уже более свежие.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>275062</commentid>
    <comment_count>2</comment_count>
    <who name="Vladislav Glinkin">glinkinvd</who>
    <bug_when>2025-10-20 17:31:44 +0300</bug_when>
    <thetext>Версия пакета: fail2ban-0.11.2-alt4

Проблема воспроизводится в Sisyphus.

Была устранена в upstream&apos;е. Нужно обновить пакет.
https://github.com/fail2ban/fail2ban/issues/3314
https://github.com/fail2ban/fail2ban/issues/3260
https://github.com/fail2ban/fail2ban/pull/3267</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>275088</commentid>
    <comment_count>3</comment_count>
    <who name="Anton Vyatkin">toni</who>
    <bug_when>2025-10-20 22:21:15 +0300</bug_when>
    <thetext>task #397828 for sisyphus DONE</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>275133</commentid>
    <comment_count>4</comment_count>
    <who name="">ksenobayt</who>
    <bug_when>2025-10-21 13:34:16 +0300</bug_when>
    <thetext>(In reply to Anton Vyatkin from comment #3)
&gt; task #397828 for sisyphus DONE

А когда можно ожидать обновления пакета в p11? Меня интересует эта проблема в первую очередь в стабильной версии.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>275159</commentid>
    <comment_count>5</comment_count>
    <who name="Alexander Makeenkov">amakeenk</who>
    <bug_when>2025-10-21 16:14:37 +0300</bug_when>
    <thetext>(Ответ для ksenobayt на комментарий #4)
&gt; А когда можно ожидать обновления пакета в p11? 

https://packages.altlinux.org/ru/tasks/397831

После успешного прохождения тестирования.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>