• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    1.6.0.158 unable to approve agent

    Scheduled Pinned Locked Moved Solved FOG Problems
    12 Posts 2 Posters 62 Views
    Loading More Posts
    • 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.
    • Tom ElliottT
      Tom Elliott @chscduo
      last edited by

      @chscduo The approval fails at the step where the server signs the agent’s certificate. In 1.6.0.158 the server hides OpenSSL’s reason, so you see only “signing failed”. The next dev-branch build shows the reason.

      Please run these two commands as root on the FOG server and post both outputs:

      openssl x509 -noout -pubkey -in /etc/fog/pki/agent/ca/.fogAgentCA.pem | sha256sum
      openssl pkey -pubout -in /etc/fog/pki/agent/ca/.fogAgentCA.key | sha256sum
      

      The two hashes must be the same. If they are different, the agent CA key does not match its certificate.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

      C 1 Reply Last reply Reply Quote 0
      • C
        chscduo @Tom Elliott
        last edited by

        @Tom-Elliott thanks for your reply, results seem correct :

        openssl x509 -noout -pubkey -in /etc/fog/pki/agent/ca/.fogAgentCA.pem | sha256sum
        274bce381532f276b5eba9497c43ac132f49938cf07bd49c2615fd5097051cc7 -

        openssl pkey -pubout -in /etc/fog/pki/agent/ca/.fogAgentCA.key | sha256sum
        274bce381532f276b5eba9497c43ac132f49938cf07bd49c2615fd5097051cc7 -

        Tom ElliottT 1 Reply Last reply Reply Quote 0
        • Tom ElliottT
          Tom Elliott @chscduo
          last edited by

          @chscduo Thanks. The key matches the certificate, so that cause is ruled out.

          The next check runs the same signing step as the server, with a test request. Please run this as root on the FOG server and post the whole output:

          bash -c '. /opt/fog/.fog-pki; echo "cert=$PKI_AGENT_CA_CERT key=$PKI_AGENT_CA_KEY"; openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes -keyout /dev/null -subj / -out /tmp/t.csr 2>/dev/null; openssl x509 -req -in /tmp/t.csr -CA "$PKI_AGENT_CA_CERT" -CAkey "$PKI_AGENT_CA_KEY" -CAcreateserial -sha256 -days 1 -out /dev/null; echo rc=$?; rm -f /tmp/t.csr'
          
          • rc=0 means the CA signs correctly. The problem is then the request the agent sent.
          • Any other result prints OpenSSL’s reason.

          The first line also shows which CA files the server uses. They must be the two files you checked.

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

          C 1 Reply Last reply Reply Quote 0
          • C
            chscduo @Tom Elliott
            last edited by

            @Tom-Elliott here the output :
            cert=/etc/fog/pki/agent/ca/.fogAgentCA.pem key=/etc/fog/pki/agent/ca/.fogAgentCA.key
            Certificate request self-signature ok
            subject=
            rc=0

            Tom ElliottT 1 Reply Last reply Reply Quote 0
            • Tom ElliottT
              Tom Elliott @chscduo
              last edited by

              @chscduo Thanks. The CA signs correctly, so the problem is the request the agent sent. This check runs the same signing step on that stored request. Please run these lines as root on the FOG server and post the whole output:

              mysql -N -B -r fog -e "SELECT aeCSR FROM agentEnrollment WHERE aeState='pending' ORDER BY aeID DESC LIMIT 1" > /tmp/r.csr
              openssl req -in /tmp/r.csr -noout -verify -subject
              openssl x509 -req -in /tmp/r.csr -CA /etc/fog/pki/agent/ca/.fogAgentCA.pem -CAkey /etc/fog/pki/agent/ca/.fogAgentCA.key -CAcreateserial -sha256 -days 1 -out /dev/null; echo rc=$?
              rm -f /tmp/r.csr
              

              If your database is not named fog, or mysql asks for a password, add -u and -p to the first line.

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

              Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

              Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

              C 1 Reply Last reply Reply Quote 0
              • C
                chscduo @Tom Elliott
                last edited by

                @Tom-Elliott Thanks for your help.
                This is the output :

                Certificate request self-signature verify OK
                subject=
                Certificate request self-signature ok
                subject=
                rc=0

                Tom ElliottT 1 Reply Last reply Reply Quote 0
                • Tom ElliottT
                  Tom Elliott @chscduo
                  last edited by

                  @chscduo Thanks. Your CA and the stored request both sign correctly by hand, so the failure happens only in the way the server runs the signing helper. The helper in 1.6.0.158 hides OpenSSL’s reason. The current helper shows it, and it is the only change to that file since 1.6.0.158.

                  Please replace the helper as root on the FOG server:

                  curl -fsSL https://raw.githubusercontent.com/FOGProject/fogproject/dev-branch/packages/pki/fog-sign-node-cert -o /tmp/fsnc
                  sed -i 's|^CONF=.*|CONF="/opt/fog/.fog-pki"|' /tmp/fsnc
                  install -o root -g root -m 0755 /tmp/fsnc /opt/fog/bin/fog-sign-node-cert
                  rm -f /tmp/fsnc
                  

                  Then approve the agent again and post the full error message. It now ends with OpenSSL’s reason.

                  Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                  Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                  Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                  C 1 Reply Last reply Reply Quote 0
                  • C
                    chscduo @Tom Elliott
                    last edited by

                    @Tom-Elliott Very interesting !
                    Error is more readable :
                    83999a39-85c2-4297-8392-8969e4c7fac0-image.png

                    Here are permissions on .fogAgentCA.srl :
                    2b8ff38f-862c-41f7-97fa-2bff013ffeb3-image.png

                    Why the write process failed ?

                    Tom ElliottT 1 Reply Last reply Reply Quote 0
                    • Tom ElliottT
                      Tom Elliott @chscduo
                      last edited by

                      @chscduo That error is the answer. Your web server’s service runs with /etc read-only, which is a systemd hardening setting. The signing helper runs through sudo from the web server, so it inherits that restriction. The old helper wrote a serial counter, .fogAgentCA.srl, next to the CA on every signing. That write failed. When you ran the same step by hand, you were outside that service, so it worked.

                      The helper no longer writes there. It now gives each certificate a random serial number, which is how a CA normally assigns them. Please replace the helper again with the same commands:

                      curl -fsSL https://raw.githubusercontent.com/FOGProject/fogproject/dev-branch/packages/pki/fog-sign-node-cert -o /tmp/fsnc
                      sed -i 's|^CONF=.*|CONF="/opt/fog/.fog-pki"|' /tmp/fsnc
                      install -o root -g root -m 0755 /tmp/fsnc /opt/fog/bin/fog-sign-node-cert
                      rm -f /tmp/fsnc
                      

                      Then approve the agent again. You can delete /etc/fog/pki/agent/ca/.fogAgentCA.srl. Nothing reads it.

                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                      C 1 Reply Last reply Reply Quote 0
                      • C
                        chscduo @Tom Elliott
                        last edited by chscduo

                        @Tom-Elliott Wahou you solved it !
                        The agent is approved without any error.

                        bc7fe01e-dc79-4114-ba44-43fdcd11c2de-image.png

                        Thanks a lot for your time and step by step answers.

                        Tom ElliottT 1 Reply Last reply Reply Quote 0
                        • Tom ElliottT Tom Elliott has marked this topic as solved
                        • Tom ElliottT
                          Tom Elliott @chscduo
                          last edited by Tom Elliott

                          @chscduo Glad it works, and thanks for running each check so quickly.

                          The fix is in dev-branch, so the next FOG update includes it. The update replaces the helper you installed by hand with the same code, so you have nothing to undo.

                          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                          1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          • First post
                            Last post

                          26

                          Online

                          12.8k

                          Users

                          17.7k

                          Topics

                          157.5k

                          Posts
                          Copyright © 2012-2026 FOG Project