Skip to content

Commit

Permalink
Securely handle /etc/snap.assertions
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Deziel <[email protected]>
  • Loading branch information
simondeziel committed Sep 8, 2021
1 parent 37b938f commit 39dfa4e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cloudconfig/cloudinit/cloudinit_ubuntu.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,8 @@ func (cfg *ubuntuCloudConfig) updateProxySettings(proxyCfg PackageManagerProxyCo
}

func (cfg *ubuntuCloudConfig) genSnapStoreProxyCmds(assertions, storeID string) {
cfg.AddRunCmd(fmt.Sprintf(
`printf '%%s\n' %s > %s`,
utils.ShQuote(assertions),
"/etc/snap.assertions"))
cfg.AddRunTextFile("/etc/snap.assertions", assertions, 0600)
cfg.AddRunCmd("snap ack /etc/snap.assertions")
cfg.AddRunCmd("rm /etc/snap.assertions")
cfg.AddRunCmd("snap set core proxy.store=" + storeID)
}

0 comments on commit 39dfa4e

Please sign in to comment.