[DOCS-8541] Make sure docs for keyfile generation use length with does not pad with "=" Created: 10/Aug/16  Updated: 30/Oct/23  Resolved: 08/Nov/16

Status: Closed
Project: Documentation
Component/s: Automation Agent, manual, Ops Manager
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Task Priority: Critical - P2
Reporter: Jason Mimick (Inactive) Assignee: Andrew Aldridge
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 7 years, 14 weeks, 1 day ago
Story Points: 0.25

 Description   

See https://jira.mongodb.org/browse/CS-32755 for reference.

It seems that when importing an existing cluster for automation if the replica set keyfile ends with an = sign, an error will occur.

This is because the base64 encoding spec needs to add padding characters if the length of the string to be encoded is not a multiple of 4. https://en.wikipedia.org/wiki/Base64
We should update our docs on how to generate a keyfile, like https://docs.mongodb.com/manual/tutorial/enforce-keyfile-access-control-in-existing-replica-set/#create-a-keyfile to say something like:

openssl rand -base64 756 > <path-to-keyfile>

instead of

openssl rand -base64 755 > <path-to-keyfile>

When an automation-agent is importing a replica it seems the currently coded logic will throw an error should the padding character = be detected. But, if you used the documented process for generating a keyfile for a manually deployed replica set the padding character will be appended and sadly the replSet's mongod's will happily accept these padding characters.



 Comments   
Comment by Andrew Aldridge [ 08/Nov/16 ]

Does not apply to versions of the manual prior to 3.2.

Comment by Githook User [ 08/Nov/16 ]

Author:

{u'username': u'i80and', u'name': u'Andrew Aldridge', u'email': u'i80and@foxquill.com'}

Message: DOCS-8541: Make key sizes divisible by 4
Branch: v3.2
https://github.com/mongodb/docs/commit/67c20f3dca1e87071be5c01cd8fb4de8bb75d68e

Comment by Githook User [ 08/Nov/16 ]

Author:

{u'username': u'i80and', u'name': u'Andrew Aldridge', u'email': u'i80and@foxquill.com'}

Message: DOCS-8541: Make key sizes divisible by 4
Branch: master
https://github.com/mongodb/docs/commit/a7a727d635e5fc0ca2a9d9b6fe5810b4c977cdef

Generated at Thu Feb 08 07:56:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.