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

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

    <bug>
          <bug_id>52780</bug_id>
          
          <creation_ts>2025-01-21 14:28:07 +0300</creation_ts>
          <short_desc>salt-api: Internal Server Error</short_desc>
          <delta_ts>2025-02-03 10:18:10 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Branch p10</product>
          <component>salt-api</component>
          <version>не указана</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>P5</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Михаил Ногин">noginmo</reporter>
          <assigned_to name="Anton Vyatkin">toni</assigned_to>
          
          
          <qa_contact name="qa-p10@altlinux.org">qa-p10</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>257817</commentid>
    <comment_count>0</comment_count>
    <who name="Михаил Ногин">noginmo</who>
    <bug_when>2025-01-21 14:28:07 +0300</bug_when>
    <thetext>Стенды:
Workstation 10.2 x86-64
Workstation K 10.4 x86-64
Education 10.4 x86-64 / KDE
Server 10.2 x86-64

Версия пакета: salt-api-3007.1-alt0.p10.1

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

1. Установить пакеты:
  # apt-get install salt-master salt-api
2. Настроить api:
  # cat &gt; /etc/salt/master.d/salt-api.conf &lt;&lt;EOF
rest_cherrypy:
  port: 8999
  disable_ssl: True
EOF

# cat &gt; /etc/salt/master.d/eauth.conf &lt;&lt;EOF
external_auth:
  pam:
    &lt;USER&gt;:
      - &apos;@wheel&apos;
      - &apos;@runner&apos;
      - &apos;@jobs&apos;
EOF
Вместо &lt;USER&gt;, указать пользователя от которого будет исполняться команда в шаге № 4

3.Запустить сервисы: 
   # systemctl start salt-master salt-api &amp;&amp; sleep 5; systemctl status salt-master salt-api
4. Проверить подключение к api от пользователя 
   $ curl -si localhost:8999/login -H &quot;Accept: application/json&quot; -d username=&apos;&lt;USER&gt;&apos; -d password=&apos;&lt;PASSWORD&gt;&apos; -d eauth=&apos;pam&apos;
   Вместо &lt;USER&gt; и &lt;PASSWORD&gt;, указать пользователя от которого исполняется команда и пароль от него


Ожидаемый результат:

HTTP/1.1 200 OK
Content-Type: application/json
Server: CherryPy/18.9.0
Date: Mon, 09 Dec 2024 13:25:29 GMT
Allow: GET, HEAD, POST
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: GET, POST
Access-Control-Allow-Credentials: true
X-Auth-Token: d6c62b1b5a73b264a4878363dd0c0976bb5e1417
Vary: Accept-Encoding
Content-Length: 199
Set-Cookie: session_id=d6c62b1b5a73b264a4878363dd0c0976bb5e1417; expires=Mon, 09 Dec 2024 23:25:29 GMT; Max-Age=36000; Path=/

{&quot;return&quot;: [{&quot;token&quot;: &quot;d6c62b1b5a73b264a4878363dd0c0976bb5e1417&quot;, &quot;expire&quot;: 1733793929.6105273, &quot;start&quot;: 1733750729.6105266, &quot;user&quot;: &quot;&lt;USER&gt;&quot;, &quot;eauth&quot;: &quot;pam&quot;, &quot;perms&quot;: [&quot;@jobs&quot;, &quot;@runner&quot;, &quot;@wheel&quot;]}]}

Реальный результат:

HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Server: CherryPy/18.9.0
Date: Tue, 21 Jan 2025 11:04:12 GMT
Allow: GET, HEAD, POST
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: GET, POST
Access-Control-Allow-Credentials: true
Vary: Accept-Encoding
Content-Length: 57
Set-Cookie: session_id=9062dd6ccc4371727339ac2fb89f2f6c6c1c3c18; expires=Tue, 21 Jan 2025 21:04:12 GMT; Max-Age=36000; Path=/

{&quot;status&quot;: 500, &quot;return&quot;: &quot;An unexpected error occurred&quot;}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>258477</commentid>
    <comment_count>1</comment_count>
    <who name="Repository Robot">repository-robot</who>
    <bug_when>2025-02-03 10:18:10 +0300</bug_when>
    <thetext>salt-3007.1-alt0.p10.2 -&gt; p10:

 Thu Jan 23 2025 Anton Vyatkin &lt;toni@altlinux&gt; 3007.1-alt0.p10.2
 - Fix salt-api (Closes: #52780).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>