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

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

    <bug>
          <bug_id>53285</bug_id>
          
          <creation_ts>2025-03-03 18:28:55 +0300</creation_ts>
          <short_desc>cepces: В getcert list пусто: не запрашивает и не получает сертификаты: Failed to fetch the list of supported templates</short_desc>
          <delta_ts>2025-10-10 15:20:16 +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>cepces</component>
          <version>unstable</version>
          <rep_platform>x86_64</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P5</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Evgeny Shesteperov">alimektor</reporter>
          <assigned_to name="Evgeny Sinelnikov">sin</assigned_to>
          <cc>belayaav</cc>
    
    <cc>sin</cc>
    
    <cc>slev</cc>
    
    <cc>varaksaaa</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>260251</commentid>
    <comment_count>0</comment_count>
    <who name="Evgeny Shesteperov">alimektor</who>
    <bug_when>2025-03-03 18:28:55 +0300</bug_when>
    <thetext>Версия

-   cepces-0.3.8-alt2
-   samba-4.20.7-alt1

Шаги воспроизведения

К багу прикреплён документ с более подробными шагами.

1.  Развернуть Windows AD в качестве домена.

2.  Настроить Службы сертификации

3.  Настроить автоматической регистрации сертификата сервера -
    https://learn.microsoft.com/ru-ru/windows-server/networking/core-network-guide/cncg/server-certs/configure-server-certificate-autoenrollment#configure-server-certificate-auto-enrollment

4.  Настроить общий каталога на сервере для передачи сертификатов.

5.  Выполнить настройку сервера IIS.

6.  Выполнить настройку клиентов:

        mkdir -p /mnt/adshare &amp;&amp; mount -v -t cifs -o user=Admin //addc.windows.testdomain/share /mnt/adshare &amp;&amp; l /mnt/adshare
        cp /mnt/adshare/windowsad.cer /etc/pki/ca-trust/source/anchors/ &amp;&amp; \ update-ca-trust &amp;&amp; \ trust list | grep windows
        cp /mnt/adshare/windowsad-root.cer /etc/pki/ca-trust/source/anchors/ &amp;&amp; \ update-ca-trust &amp;&amp; \ trust list | grep windows-addc-ca -i
        apt-get install -y cepces cepces-certmonger python3-module-cepces samba-gpupdate
        mkdir -p /etc/pki/trust/anchors

7.  Настроить cepces по умолчанию:

        sed -i &quot;s/^server=.*/server=addc.windows.testdomain/&quot; /etc/cepces/cepces.conf &amp;&amp; grep &apos;server=&apos; /etc/cepces/cepces.conf

8.  Убедиться, что cepces зарегистрирован в certmonger на клиенте:

        # getcert list-cas -c cepces

9.  Выполнить команду:

        # samba-gpupdate --rsop

10. Запустить запрос:

        # samba-gpupdate --force &amp;&amp; echo $?

11. Убедиться, что CA отображаемся в списке (OK):

        # getcert list-cas -c windows-ADDC-CA

12. Показать список отслеживаемых сертификатов:

        # getcert list

Ожидаемый результат: Отображает отслеживаемые сертификаты

    Number of certificates and requests being tracked: 1.
    Request ID &apos;windows-ADDC-CA.Machine&apos;:
        status: MONITORING
        stuck: no
        key pair storage: type=FILE,location=&apos;/var/lib/samba/private/certs/windows-ADDC-CA.Machine.key&apos;
        certificate: type=FILE,location=&apos;/var/cache/samba/certs/windows-ADDC-CA.Machine.crt&apos;
        CA: windows-ADDC-CA
        issuer: CN=windows-ADDC-CA,DC=windows,DC=testdomain
        subject: CN=ieb6ahwa.windows.testdomain
        issued: 2025-03-03 18:06:44 MSK
        expires: 2026-03-03 18:06:44 MSK
        dns: ieb6ahwa.windows.testdomain
        key usage: digitalSignature,keyEncipherment
        eku: id-kp-clientAuth,id-kp-serverAuth
        certificate template/profile: Machine
        profile: Machine
        pre-save command: 
        post-save command: 
        track: yes
        auto-renew: yes

Фактический результат: Ошибка:

    Number of certificates and requests being tracked: 0.

Воспроизводится в P11.

Не воспроизводится в P10:

-   cepces-0.3.7-alt1
-   samba-4.19.9-alt4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>271913</commentid>
    <comment_count>1</comment_count>
    <who name="Artem Varaksa">varaksaaa</who>
    <bug_when>2025-09-03 12:42:01 +0300</bug_when>
    <thetext>Воспроизводится и с samba-4.21.7-alt4.x86_64.

Дополнительно:

Если запустить `# samba-gpupdate --debuglevel=1 --force`, видны ошибки, хотя код выхода остаётся 0:

&gt; ldb: Unable to open tdb &apos;/var/lib/samba/private/secrets.ldb&apos;: No such file or directory
&gt; ldb: Failed to connect to &apos;/var/lib/samba/private/secrets.ldb&apos; with backend &apos;tdb&apos;: Unable to open tdb &apos;/var/lib/samba/private/secrets.ldb&apos;: No such file or directory
&gt; ldb: Unable to open tdb &apos;/var/lib/samba/private/secrets.ldb&apos;: No such file or directory
&gt; ldb: Failed to connect to &apos;/var/lib/samba/private/secrets.ldb&apos; with backend &apos;tdb&apos;: Unable to open tdb &apos;/var/lib/samba/private/secrets.ldb&apos;: No such file or directory
&gt; 2025-09-03 12:32:55.472|[E66544]| Failed to fetch the list of supported templates. | {&apos;Error&apos;: &apos;...&apos;}

Ошибка:

&gt; 2025-09-03 12:32:55,419 __main__:ERROR:Traceback (most recent call last):
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connectionpool.py&quot;, line 787, in urlopen
&gt;     response = self._make_request(
&gt;                ^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connectionpool.py&quot;, line 488, in _make_request
&gt;     raise new_e
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connectionpool.py&quot;, line 464, in _make_request
&gt;     self._validate_conn(conn)
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connectionpool.py&quot;, line 1093, in _validate_conn
&gt;     conn.connect()
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connection.py&quot;, line 741, in connect
&gt;     sock_and_verified = _ssl_wrap_socket_and_match_hostname(
&gt;                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connection.py&quot;, line 920, in _ssl_wrap_socket_and_match_hostname
&gt;     ssl_sock = ssl_wrap_socket(
&gt;                ^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/util/ssl_.py&quot;, line 480, in ssl_wrap_socket
&gt;     ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
&gt;                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/util/ssl_.py&quot;, line 524, in _ssl_wrap_socket_impl
&gt;     return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
&gt;            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib64/python3.12/ssl.py&quot;, line 455, in wrap_socket
&gt;     return self.sslsocket_class._create(
&gt;            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib64/python3.12/ssl.py&quot;, line 1041, in _create
&gt;     self.do_handshake()
&gt;   File &quot;/usr/lib64/python3.12/ssl.py&quot;, line 1319, in do_handshake
&gt;     self._sslobj.do_handshake()
&gt; ConnectionResetError: [Errno 104] Connection reset by peer
&gt;
&gt; During handling of the above exception, another exception occurred:
&gt;
&gt; Traceback (most recent call last):
&gt;   File &quot;/usr/lib/python3/site-packages/requests/adapters.py&quot;, line 667, in send
&gt;     resp = conn.urlopen(
&gt;            ^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connectionpool.py&quot;, line 841, in urlopen
&gt;     retries = retries.increment(
&gt;               ^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/util/retry.py&quot;, line 474, in increment
&gt;     raise reraise(type(error), error, _stacktrace)
&gt;           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/util/util.py&quot;, line 38, in reraise
&gt;     raise value.with_traceback(tb)
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connectionpool.py&quot;, line 787, in urlopen
&gt;     response = self._make_request(
&gt;                ^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connectionpool.py&quot;, line 488, in _make_request
&gt;     raise new_e
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connectionpool.py&quot;, line 464, in _make_request
&gt;     self._validate_conn(conn)
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connectionpool.py&quot;, line 1093, in _validate_conn
&gt;     conn.connect()
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connection.py&quot;, line 741, in connect
&gt;     sock_and_verified = _ssl_wrap_socket_and_match_hostname(
&gt;                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/connection.py&quot;, line 920, in _ssl_wrap_socket_and_match_hostname
&gt;     ssl_sock = ssl_wrap_socket(
&gt;                ^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/util/ssl_.py&quot;, line 480, in ssl_wrap_socket
&gt;     ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
&gt;                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/urllib3/util/ssl_.py&quot;, line 524, in _ssl_wrap_socket_impl
&gt;     return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
&gt;            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib64/python3.12/ssl.py&quot;, line 455, in wrap_socket
&gt;     return self.sslsocket_class._create(
&gt;            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib64/python3.12/ssl.py&quot;, line 1041, in _create
&gt;     self.do_handshake()
&gt;   File &quot;/usr/lib64/python3.12/ssl.py&quot;, line 1319, in do_handshake
&gt;     self._sslobj.do_handshake()
&gt; urllib3.exceptions.ProtocolError: (&apos;Connection aborted.&apos;, ConnectionResetError(104, &apos;Connection reset by peer&apos;))
&gt;
&gt; During handling of the above exception, another exception occurred:
&gt;
&gt; Traceback (most recent call last):
&gt;   File &quot;/usr/libexec/certmonger/cepces-submit&quot;, line 68, in main
&gt;     service = Service(config)
&gt;               ^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/cepces/core.py&quot;, line 90, in __init__
&gt;     self._policies = self._xcep.get_policies()
&gt;                      ^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/cepces/xcep/service.py&quot;, line 52, in get_policies
&gt;     response = self.send(envelope)
&gt;                ^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/cepces/soap/service.py&quot;, line 82, in send
&gt;     req = requests.post(url=self._endpoint,
&gt;           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/requests/api.py&quot;, line 115, in post
&gt;     return request(&quot;post&quot;, url, data=data, json=json, **kwargs)
&gt;            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/requests/api.py&quot;, line 59, in request
&gt;     return session.request(method=method, url=url, **kwargs)
&gt;            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/requests/sessions.py&quot;, line 589, in request
&gt;     resp = self.send(prep, **send_kwargs)
&gt;            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/requests/sessions.py&quot;, line 703, in send
&gt;     r = adapter.send(request, **kwargs)
&gt;         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&gt;   File &quot;/usr/lib/python3/site-packages/requests/adapters.py&quot;, line 682, in send
&gt;     raise ConnectionError(err, request=request)
&gt; requests.exceptions.ConnectionError: (&apos;Connection aborted.&apos;, ConnectionResetError(104, &apos;Connection reset by peer&apos;))

---

По https://dmulder.github.io/group-policy-book/certautoenroll.html#examining-logs

# cat /var/log/cepces/cepces.log | rg &apos;Caused by&apos;

ошибки

&gt; requests.exceptions.ConnectionError: HTTPSConnectionPool(host=&apos;ca&apos;, port=443): Max retries exceeded with url: /ADPolicyProvider_CEP_Kerberos/service.svc/CEP (Caused by NameResolutionError(&quot;&lt;urllib3.connection.HTTPSConnection object at 0x7f1ce1ad7440&gt;: Failed to resolve &apos;ca&apos; ([Errno -5] No address associated with hostname)&quot;))

но количество не увеличивается при повторном запуске `samba-gpupdate`, возможно это ошибки до корректной конфигурации `/etc/cepces/cepces.conf`.

---

При ручном создании запроса по https://github.com/openSUSE/cepces/wiki/Usage запрос отображается, но &quot;CA_UNCONFIGURED&quot;:

&gt; Request ID &apos;MachineCertificate&apos;:
&gt; 	status: CA_UNCONFIGURED
&gt; 	stuck: yes
&gt; 	key pair storage: type=FILE,location=&apos;/root/machine.key&apos;
&gt; 	certificate: type=FILE,location=&apos;/root/machine.crt&apos;
&gt; 	CA: windows-ADDC-CA
&gt; 	issuer:
&gt; 	subject:
&gt; 	issued: unknown
&gt; 	expires: unknown
&gt; 	profile: Machine
&gt; 	pre-save command:
&gt; 	post-save command:
&gt; 	track: yes
&gt; 	auto-renew: yes

В Windows никаких запросов сертификатов не отображается в средстве &quot;Центр сертификации&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>271914</commentid>
    <comment_count>2</comment_count>
    <who name="Artem Varaksa">varaksaaa</who>
    <bug_when>2025-09-03 12:43:17 +0300</bug_when>
    <thetext>&gt; При ручном создании запроса по https://github.com/openSUSE/cepces/wiki/Usage 

# getcert request -c windows-ADDC-CA -T Machine -I MachineCertificate -k machine.key -f machine.crt</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>274199</commentid>
    <comment_count>3</comment_count>
    <who name="Белая Алёна">belayaav</who>
    <bug_when>2025-10-10 15:20:16 +0300</bug_when>
    <thetext>Ошибка актуальна
samba-4.21.8-alt3
cepces-0.3.8-alt2</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>