Skip to content

Fixes #39117 - Support generating registration command via REST API in isolated networks managed by external capsules#10887

Closed
lfu wants to merge 1 commit intotheforeman:developfrom
lfu:37836_reg_cmd_proxy
Closed

Fixes #39117 - Support generating registration command via REST API in isolated networks managed by external capsules#10887
lfu wants to merge 1 commit intotheforeman:developfrom
lfu:37836_reg_cmd_proxy

Conversation

@lfu
Copy link
Copy Markdown
Contributor

@lfu lfu commented Feb 27, 2026

To be able to generate the registration command for hosts in an isolated network.

Required smart proxy patch: theforeman/smart-proxy#934
Required installer fix: theforeman/puppet-foreman_proxy_content#534

Before

$ curl -k -X POST "https://capsule.redhat.com/api/registration_commands" \
  --user "userid:password" \
  -H "Content-Type: application/json" \
  -d '{
    "registration_command": {
      "activation_keys": ["AK1"],
      "insecure": false
    }
  }'
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>

Steps to apply patches

Satellite

  • Apply this foreman patch in /usr/share/foreman
  • foreman-maintain service restart

Capsule

  • Apply related smart proxy patch in /usr/share/foreman-proxy
  • Apply related installer fix from foreman_proxy_content in /usr/share/foreman-installer/modules/foreman_proxy_content
  • systemctl restart foreman-proxy
  • puppet resource package yard provider=puppet_gem
  • puppet resource package puppet-strings provider=puppet_gem
  • foreman-installer -l info

After

$ curl -k -X POST "https://capsule.redhat.com/api/registration_commands" \
  --user "userid:password" \
  -H "Content-Type: application/json" \
  -d '{
    "registration_command": {
      "activation_keys": ["AK1"],
      "insecure": false
    }
  }'
{"registration_command":"set -o pipefail \u0026\u0026 curl --silent --show-error   'https://capsule.redhat.com/register?activation_keys=AK1' --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjozLCJpYXQiOjE3NzIxMzM5NjksImp0aSI6IjYxOTRkMmJjNjY2Mjk0YjQ5YjY4ODFkNTU2YjE3MTRkOWYxOWYyM2VjZjdkNDkwZTc3ZmUyNzg5OWI4MjAyNjEiLCJleHAiOjE3NzIxNDgzNjksInNjb3BlIjoicmVnaXN0cmF0aW9uI2dsb2JhbCByZWdpc3RyYXRpb24jaG9zdCJ9.7iRQLub-VrLOfGDPxJaHURWVGXp5hd6ksE3WMzLamIw' | bash"}

…n isolated networks managed by external capsules
@lfu lfu force-pushed the 37836_reg_cmd_proxy branch from 7e00ea9 to 32149aa Compare February 27, 2026 19:54
@ehelms
Copy link
Copy Markdown
Member

ehelms commented Feb 27, 2026

@lfu I don't think this change or theforeman/smart-proxy#934 is necessary. The change theforeman/puppet-foreman_proxy_content#534 will reverse proxy the route /api/registration_command back to Foreman. The pathing will not hit the smart-proxy at all which is running on port 9090.

theforeman/puppet-foreman_proxy_content#534 should be sufficient

@lfu
Copy link
Copy Markdown
Contributor Author

lfu commented Feb 27, 2026

@ehelms 👍 You are correct.
Test worked without this PR and the change in smart proxy.
Close this PR.

@lfu lfu closed this Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants