Skip to content

"user_data" needs to be encoded in base64 without newlines #255

Description

@ogrand

Hello,

Bosh Openstack cpi send a POST request for instance creation, with body content user_data base64 encoded row containing newlines \n every 60 characters:

body: {
  "server": {
    "flavorRef": "s3.small.1",
    "name": "vm-d35f15af-9840-44be-8d95-a2b1e1ad5358",
    "imageRef": "97727138-8334-4188-9b1e-4x558599d99b",
    "user_data": "eyJzZXJ2ZXIiOnsibmFtZSI6InZtLWQzNWYxNWFmLTk4NDAtNDRiZS04ZDk1\nLWEyYjFlMWFkNTM1OCJ9LCJuZXR3b3JrcyI6eyJ0Zi1uZXQtY29hYi1kZXBs\ncy1pb

Recent upgrade (openstack 22.3) is less permissive for base64 decoding and refuses newlines \n inside base64 encoded value.

To be compliant, it will be nice to replace encoding format in /var/vcap/packages/bosh_openstack_cpi/vendor/bundle/ruby/*/gems/fog-openstack-*/lib/fog/openstack/compute/models/server.rb ruby script:

Replace [ascii_userdata].pack('m') with [ascii_userdata].pack('m0') which disable newlines assertion.

Thanks.
Olivier

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions