Skip to content

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

Merged
ehelms merged 1 commit into
theforeman:masterfrom
lfu:37836_reg_cmd_proxy
Mar 5, 2026
Merged

Fixes #39119 - Support generating registration command via REST API in isolated networks managed by external capsules#534
ehelms merged 1 commit into
theforeman:masterfrom
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.

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>

Capsule

Apply this fix in /usr/share/foreman-installer/modules/foreman_proxy_content

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
Copy link
Copy Markdown
Contributor Author

lfu commented Mar 5, 2026

Could someone review this?

@chris1984
Copy link
Copy Markdown
Member

Tested and works great on my capsule with curl, code looks fine to me.

@ehelms can this get a review when you get time?

@ehelms ehelms merged commit e942c09 into theforeman:master Mar 5, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants