Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Write sensitive cloud-init user-data into /etc/cloud/cloud.cfg.d #4746

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions docs/book/src/topics/userdata-privacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ cloudInit:
cloud-init does not print boothook script errors to the systemd journal. Logs for the script, if it errored can be found in
`/var/log/cloud-init-output.log`

### Warning messages

Because cloud-init will attempt to read the final file at start, cloud-init will always print a `/etc/secret-userdata.txt cannot be found`
message. This can be safely ignored.

### Secrets manager console

The AWS secrets manager console should show secrets being created and deleted, with a lifetime of around a minute. No plaintext secret
Expand Down
2 changes: 1 addition & 1 deletion pkg/cloud/services/secretsmanager/secret_fetch_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if [ "{{.Endpoint}}" != "" ]; then
fi
SECRET_PREFIX="{{.SecretPrefix}}"
CHUNKS="{{.Chunks}}"
FILE="/etc/secret-userdata.txt"
FILE="/etc/cloud/cloud.cfg.d/99_kubeadm_bootstrap.cfg"
FINAL_INDEX=$((CHUNKS - 1))

# Log an error and exit.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cloud/services/ssm/secret_fetch_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if [ "{{.Endpoint}}" != "" ]; then
fi
SECRET_PREFIX="{{.SecretPrefix}}"
CHUNKS="{{.Chunks}}"
FILE="/etc/secret-userdata.txt"
FILE="/etc/cloud/cloud.cfg.d/99_kubeadm_bootstrap.cfg"
FINAL_INDEX=$((CHUNKS - 1))

# Log an error and exit.
Expand Down
18 changes: 0 additions & 18 deletions pkg/internal/mime/mime.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,7 @@ import (
"strings"
)

const (
includePart = "file:///etc/secret-userdata.txt\n"
)

var (
includeType = textproto.MIMEHeader{
"content-type": {"text/x-include-url"},
}

boothookType = textproto.MIMEHeader{
"content-type": {"text/cloud-boothook"},
}
Expand Down Expand Up @@ -83,16 +75,6 @@ func GenerateInitDocument(secretPrefix string, chunks int32, region string, endp
return []byte{}, err
}

includeWriter, err := mpWriter.CreatePart(includeType)
if err != nil {
return []byte{}, err
}

_, err = includeWriter.Write([]byte(includePart))
if err != nil {
return []byte{}, err
}

if err := mpWriter.Close(); err != nil {
return []byte{}, err
}
Expand Down