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

Teleport Install scripts: use /etc/apt/trusted.gpg.d/ when adding Teleport's public key for DEB packages #50273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions api/types/installers/agentless-installer.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ install_teleport() {
echo "deb https://apt.releases.teleport.dev/ubuntu ${VERSION_CODENAME?} {{ .RepoChannel }}" | sudo tee /etc/apt/sources.list.d/teleport.list
rm /tmp/teleport-pubkey.asc
else
curl https://apt.releases.teleport.dev/gpg | sudo tee /usr/share/keyrings/teleport-archive-keyring.asc
echo "deb [signed-by=/usr/share/keyrings/teleport-archive-keyring.asc] https://apt.releases.teleport.dev/${ID?} ${VERSION_CODENAME?} {{ .RepoChannel }}" | sudo tee /etc/apt/sources.list.d/teleport.list >/dev/null
curl https://apt.releases.teleport.dev/gpg | sudo tee /etc/apt/trusted.gpg.d/teleport-archive-keyring.asc
echo "deb [signed-by=/etc/apt/trusted.gpg.d/teleport-archive-keyring.asc] https://apt.releases.teleport.dev/${ID?} ${VERSION_CODENAME?} {{ .RepoChannel }}" | sudo tee /etc/apt/sources.list.d/teleport.list >/dev/null
fi
sudo apt-get update

Expand Down
4 changes: 2 additions & 2 deletions assets/install-scripts/install-connect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ add_apt_key() {
TMP_KEY="$TEMP_DIR/teleport-pubkey.gpg"
download "https://apt.releases.teleport.dev/gpg" "$TMP_KEY"
set -x
cat $TMP_KEY | $SUDO tee /usr/share/keyrings/teleport-archive-keyring.asc >/dev/null
cat $TMP_KEY | $SUDO tee /etc/apt/trusted.gpg.d/teleport-archive-keyring.asc >/dev/null
set +x
TELEPORT_REPO="deb [signed-by=/usr/share/keyrings/teleport-archive-keyring.asc] https://apt.releases.teleport.dev/${APT_REPO_ID?} ${APT_REPO_VERSION_CODENAME?} stable/v${MAJOR}"
TELEPORT_REPO="deb [signed-by=/etc/apt/trusted.gpg.d/teleport-archive-keyring.asc] https://apt.releases.teleport.dev/${APT_REPO_ID?} ${APT_REPO_VERSION_CODENAME?} stable/v${MAJOR}"
fi

set -x
Expand Down
4 changes: 2 additions & 2 deletions assets/install-scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ add_apt_key() {
TMP_KEY="$TEMP_DIR/teleport-pubkey.gpg"
download "https://apt.releases.teleport.dev/gpg" "$TMP_KEY"
set -x
$SUDO cp "$TMP_KEY" /usr/share/keyrings/teleport-archive-keyring.asc
$SUDO cp "$TMP_KEY" /etc/apt/trusted.gpg.d/teleport-archive-keyring.asc
set +x
TELEPORT_REPO="deb [signed-by=/usr/share/keyrings/teleport-archive-keyring.asc] https://apt.releases.teleport.dev/${APT_REPO_ID?} ${APT_REPO_VERSION_CODENAME?} ${CHANNEL}"
TELEPORT_REPO="deb [signed-by=/etc/apt/trusted.gpg.d/teleport-archive-keyring.asc] https://apt.releases.teleport.dev/${APT_REPO_ID?} ${APT_REPO_VERSION_CODENAME?} ${CHANNEL}"
fi

set -x
Expand Down
16 changes: 8 additions & 8 deletions lib/srv/server/installer/autodiscover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,16 +745,16 @@ func TestAutoDiscoverNode(t *testing.T) {
// SLES 12, 15
var wellKnownOS = map[string]map[string]map[string]string{
"debian": {
"9": {etcOSReleaseFile: debian9OSRelease, "/usr/share/keyrings/": "", "/etc/apt/sources.list.d/": ""},
"10": {etcOSReleaseFile: debian10OSRelease, "/usr/share/keyrings/": "", "/etc/apt/sources.list.d/": ""},
"11": {etcOSReleaseFile: debian11OSRelease, "/usr/share/keyrings/": "", "/etc/apt/sources.list.d/": ""},
"12": {etcOSReleaseFile: debian12OSRelease, "/usr/share/keyrings/": "", "/etc/apt/sources.list.d/": ""},
"9": {etcOSReleaseFile: debian9OSRelease, "/etc/apt/trusted.gpg.d/": "", "/etc/apt/sources.list.d/": ""},
"10": {etcOSReleaseFile: debian10OSRelease, "/etc/apt/trusted.gpg.d/": "", "/etc/apt/sources.list.d/": ""},
"11": {etcOSReleaseFile: debian11OSRelease, "/etc/apt/trusted.gpg.d/": "", "/etc/apt/sources.list.d/": ""},
"12": {etcOSReleaseFile: debian12OSRelease, "/etc/apt/trusted.gpg.d/": "", "/etc/apt/sources.list.d/": ""},
},
"ubuntu": {
"18.04": {etcOSReleaseFile: ubuntu1804OSRelease, "/usr/share/keyrings/": "", "/etc/apt/sources.list.d/": ""},
"20.04": {etcOSReleaseFile: ubuntu2004OSRelease, "/usr/share/keyrings/": "", "/etc/apt/sources.list.d/": ""},
"22.04": {etcOSReleaseFile: ubuntu2204OSRelease, "/usr/share/keyrings/": "", "/etc/apt/sources.list.d/": ""},
"24.04": {etcOSReleaseFile: ubuntu2404OSRelease, "/usr/share/keyrings/": "", "/etc/apt/sources.list.d/": ""},
"18.04": {etcOSReleaseFile: ubuntu1804OSRelease, "/etc/apt/trusted.gpg.d/": "", "/etc/apt/sources.list.d/": ""},
"20.04": {etcOSReleaseFile: ubuntu2004OSRelease, "/etc/apt/trusted.gpg.d/": "", "/etc/apt/sources.list.d/": ""},
"22.04": {etcOSReleaseFile: ubuntu2204OSRelease, "/etc/apt/trusted.gpg.d/": "", "/etc/apt/sources.list.d/": ""},
"24.04": {etcOSReleaseFile: ubuntu2404OSRelease, "/etc/apt/trusted.gpg.d/": "", "/etc/apt/sources.list.d/": ""},
},
"amzn": {
"2": {etcOSReleaseFile: amzn2OSRelease},
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/packagemanager/apt.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (
aptRepoEndpoint = "https://apt.releases.teleport.dev/"

aptTeleportSourceListFileRelative = "/etc/apt/sources.list.d/teleport.list"
aptTeleportPublicKeyFileRelative = "/usr/share/keyrings/teleport-archive-keyring.asc"
aptTeleportPublicKeyFileRelative = "/etc/apt/trusted.gpg.d/teleport-archive-keyring.asc"

aptFilePermsRepository = 0o644
)
Expand Down Expand Up @@ -128,7 +128,7 @@ func (pm *APT) AddTeleportRepository(ctx context.Context, linuxInfo *linux.OSRel
aptTeleportSourceListFile := filepath.Join(pm.fsRootPrefix, aptTeleportSourceListFileRelative)
aptTeleportPublicKeyFile := filepath.Join(pm.fsRootPrefix, aptTeleportPublicKeyFileRelative)
// Format for teleport repo entry should look like this:
// deb [signed-by=/usr/share/keyrings/teleport-archive-keyring.asc] https://apt.releases.teleport.dev/${ID?} ${VERSION_CODENAME?} $RepoChannel"
// deb [signed-by=/etc/apt/trusted.gpg.d/teleport-archive-keyring.asc] https://apt.releases.teleport.dev/${ID?} ${VERSION_CODENAME?} $RepoChannel"
teleportRepoMetadata := fmt.Sprintf("deb [signed-by=%s] %s%s %s %s", aptTeleportPublicKeyFile, aptRepoEndpoint, linuxInfo.ID, linuxInfo.VersionCodename, repoChannel)

switch {
Expand Down
4 changes: 2 additions & 2 deletions lib/web/scripts/node-join/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,8 @@ install_from_repo() {
echo "deb https://apt.releases.teleport.dev/${ID} ${VERSION_CODENAME} ${REPO_CHANNEL}" > /etc/apt/sources.list.d/teleport.list
else
curl -fsSL https://apt.releases.teleport.dev/gpg \
-o /usr/share/keyrings/teleport-archive-keyring.asc
echo "deb [signed-by=/usr/share/keyrings/teleport-archive-keyring.asc] \
-o /etc/apt/trusted.gpg.d/teleport-archive-keyring.asc
echo "deb [signed-by=/etc/apt/trusted.gpg.d/teleport-archive-keyring.asc] \
https://apt.releases.teleport.dev/${ID} ${VERSION_CODENAME} ${REPO_CHANNEL}" > /etc/apt/sources.list.d/teleport.list
fi
apt-get update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ export const BashMultiWithComment = () => {
<Component
lines={[
{
text: `sudo curl https://apt.releases.teleport.dev/gpg \\\n-o /usr/share/keyrings/teleport-archive-keyring.asc`,
text: `sudo curl https://apt.releases.teleport.dev/gpg \\\n-o /etc/apt/trusted.gpg.d/teleport-archive-keyring.asc`,
comment: `Download Teleport's PGP public key`,
},
{
text: 'sudo DEBUG=1 teleport start -c cfg-all -d',
},
{
text:
`echo "deb [signed-by=/usr/share/keyrings/teleport-archive-keyring.asc] \\\n` +
`echo "deb [signed-by=/etc/apt/trusted.gpg.d/teleport-archive-keyring.asc] \\\n` +
`https://apt.releases.teleport.dev/stable/v10" \\\n` +
`| sudo tee /etc/apt/sources.list.d/teleport.list > /dev/null`,
comment:
Expand Down
Loading