Merge pull request #217852 from justinas/teleport-12

teleport: 11.3.4 -> 12.0.2, reintroduce teleport_11
This commit is contained in:
Arian van Putten 2023-03-02 11:18:24 +01:00 committed by GitHub
commit 17ca3dd2a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 92 additions and 42 deletions

View file

@ -105,7 +105,7 @@ In addition to numerous new and upgraded packages, this release has the followin
- The EC2 image module previously detected and automatically mounted ext3-formatted instance store devices and partitions in stage-1 (initramfs), storing `/tmp` on the first discovered device. This behaviour, which only catered to very specific use cases and could not be disabled, has been removed. Users relying on this should provide their own implementation, and probably use ext4 and perform the mount in stage-2.
- `teleport` has been upgraded to major version 11. Please see upstream [upgrade instructions](https://goteleport.com/docs/setup/operations/upgrading/) and [release notes](https://goteleport.com/docs/changelog/#1100).
- `teleport` has been upgraded from major version 10 to major version 12. Please see upstream [upgrade instructions](https://goteleport.com/docs/setup/operations/upgrading/) and release notes for versions [11](https://goteleport.com/docs/changelog/#1100) and [12](https://goteleport.com/docs/changelog/#1201). Note that Teleport does not officially support upgrades across more than one major version at a time. If you're running Teleport server components, it is recommended to first upgrade to an intermediate 11.x version by setting `services.teleport.package = pkgs.teleport_11`. Afterwards, this option can be removed to upgrade to the default version (12).
- The EC2 image module previously detected and activated swap-formatted instance store devices and partitions in stage-1 (initramfs). This behaviour has been removed. Users relying on this should provide their own implementation.

View file

@ -11,6 +11,14 @@ in
services.teleport = with lib.types; {
enable = mkEnableOption (lib.mdDoc "the Teleport service");
package = mkOption {
type = types.package;
default = pkgs.teleport;
defaultText = lib.literalMD "pkgs.teleport";
example = lib.literalMD "pkgs.teleport_11";
description = lib.mdDoc "The teleport package to use";
};
settings = mkOption {
type = settingsYaml.type;
default = { };
@ -74,14 +82,14 @@ in
};
config = mkIf config.services.teleport.enable {
environment.systemPackages = [ pkgs.teleport ];
environment.systemPackages = [ cfg.package ];
systemd.services.teleport = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = ''
${pkgs.teleport}/bin/teleport start \
${cfg.package}/bin/teleport start \
${optionalString cfg.insecure.enable "--insecure"} \
${optionalString cfg.diag.enable "--diag-addr=${cfg.diag.addr}:${toString cfg.diag.port}"} \
${optionalString (cfg.settings != { }) "--config=${settingsYaml.generate "teleport.yaml" cfg.settings}"}

View file

@ -1,18 +1,28 @@
{ system ? builtins.currentSystem
, config ? { }
, pkgs ? import ../.. { inherit system config; }
, lib ? pkgs.lib
}:
with import ../lib/testing-python.nix { inherit system pkgs; };
let
minimal = { config, ... }: {
services.teleport.enable = true;
packages = with pkgs; {
"default" = teleport;
"11" = teleport_11;
};
client = { config, ... }: {
minimal = package: {
services.teleport = {
enable = true;
inherit package;
};
};
client = package: {
services.teleport = {
enable = true;
inherit package;
settings = {
teleport = {
nodename = "client";
@ -37,9 +47,10 @@ let
}];
};
server = { config, ... }: {
server = package: {
services.teleport = {
enable = true;
inherit package;
settings = {
teleport = {
nodename = "server";
@ -64,36 +75,41 @@ let
};
};
in
{
minimal = makeTest {
# minimal setup should always work
name = "teleport-minimal-setup";
meta.maintainers = with pkgs.lib.maintainers; [ ymatsiuk ];
nodes = { inherit minimal; };
lib.concatMapAttrs
(name: package: {
"minimal_${name}" = makeTest {
# minimal setup should always work
name = "teleport-minimal-setup";
meta.maintainers = with pkgs.lib.maintainers; [ justinas ];
nodes.minimal = minimal package;
testScript = ''
minimal.wait_for_open_port(3025)
minimal.wait_for_open_port(3080)
minimal.wait_for_open_port(3022)
'';
};
testScript = ''
minimal.wait_for_open_port(3025)
minimal.wait_for_open_port(3080)
minimal.wait_for_open_port(3022)
'';
};
basic = makeTest {
# basic server and client test
name = "teleport-server-client";
meta.maintainers = with pkgs.lib.maintainers; [ ymatsiuk ];
nodes = { inherit server client; };
"basic_${name}" = makeTest {
# basic server and client test
name = "teleport-server-client";
meta.maintainers = with pkgs.lib.maintainers; [ justinas ];
nodes = {
server = server package;
client = client package;
};
testScript = ''
with subtest("teleport ready"):
server.wait_for_open_port(3025)
client.wait_for_open_port(3022)
testScript = ''
with subtest("teleport ready"):
server.wait_for_open_port(3025)
client.wait_for_open_port(3022)
with subtest("check applied configuration"):
server.wait_until_succeeds("tctl get nodes --format=json | ${pkgs.jq}/bin/jq -e '.[] | select(.spec.hostname==\"client\") | .metadata.labels.role==\"client\"'")
server.wait_for_open_port(3000)
client.succeed("journalctl -u teleport.service --grep='DEBU'")
server.succeed("journalctl -u teleport.service --grep='Starting teleport in insecure mode.'")
'';
};
}
with subtest("check applied configuration"):
server.wait_until_succeeds("tctl get nodes --format=json | ${pkgs.jq}/bin/jq -e '.[] | select(.spec.hostname==\"client\") | .metadata.labels.role==\"client\"'")
server.wait_for_open_port(3000)
client.succeed("journalctl -u teleport.service --grep='DEBU'")
server.succeed("journalctl -u teleport.service --grep='Starting teleport in insecure mode.'")
'';
};
})
packages

View file

@ -0,0 +1,8 @@
{ callPackage, ... }@args:
callPackage ./generic.nix ({
version = "11.3.5";
hash = "sha256-/InWly0jCiPBlgM/qgS6ErMv7Hhg5PW9sldda1oaUIg=";
vendorHash = "sha256-NkiFLEHBNjxUOSuAlVugAV14yCCo3z6yhX7LZQFKhvA=";
cargoHash = "sha256-02qo6i6GuRAYKDKA7k2hDq2O6ayEQbeGhFS2g3b9Wuo=";
yarnHash = "sha256-kvnVmDZ/jISaaS97KM0WbPJU7Y8XWOeHrDLT0iXRyfc=";
} // builtins.removeAttrs args [ "callPackage" ])

View file

@ -0,0 +1,8 @@
{ callPackage, ... }@args:
callPackage ./generic.nix ({
version = "12.0.2";
hash = "sha256-9RD4ETQEXnj3d5YID3f3BghwitdqfcDgNhsk8ixWTW4=";
vendorHash = "sha256-2sOELuMyg7w/rhnWvnwDiUOsjUfb56JdAbrTGKvGnjs=";
cargoHash = "sha256-1ScU5ywq8vz1sWHW2idBsWcB1Xs+aylukBm96dKrwL4=";
yarnHash = "sha256-ItRi5EkYrwNB1MIf9l3yyK1BX6vNpL2+H1BlN3Evibg=";
} // builtins.removeAttrs args [ "callPackage" ])

View file

@ -20,6 +20,12 @@
, nixosTests
, withRdpClient ? true
, version
, hash
, vendorHash
, cargoHash
, yarnHash
}:
let
# This repo has a private submodule "e" which fetchgit cannot handle without failing.
@ -27,13 +33,13 @@ let
owner = "gravitational";
repo = "teleport";
rev = "v${version}";
hash = "sha256-jJfOgcwKkNFO/5XHxMoapZxM8Tb0kEgKVA7SrMU7uW4=";
inherit hash;
};
version = "11.3.4";
inherit version;
rdpClient = rustPlatform.buildRustPackage rec {
pname = "teleport-rdpclient";
cargoHash = "sha256-TSIwLCY01ygCWT73LR/Ch7NwPQA3a3r0PyL3hUzBNr4=";
inherit cargoHash;
inherit version src;
buildAndTestSubdir = "lib/srv/desktop/rdp/rdpclient";
@ -56,7 +62,7 @@ let
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
hash = "sha256-MAGeWzA366yzpjdCY0+X6RV5MKcsHa/xD5CJu6ce1FU=";
hash = yarnHash;
};
webassets = stdenv.mkDerivation {
@ -95,7 +101,7 @@ buildGoModule rec {
pname = "teleport";
inherit src version;
vendorHash = "sha256-NkiFLEHBNjxUOSuAlVugAV14yCCo3z6yhX7LZQFKhvA=";
inherit vendorHash;
proxyVendor = true;
subPackages = [ "tool/tbot" "tool/tctl" "tool/teleport" "tool/tsh" ];

View file

@ -12570,9 +12570,13 @@ with pkgs;
telegraf = callPackage ../servers/monitoring/telegraf { };
teleport = callPackage ../servers/teleport {
teleport_11 = callPackage ../servers/teleport/11.nix {
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security AppKit;
};
teleport_12 = callPackage ../servers/teleport/12.nix {
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security AppKit;
};
teleport = teleport_12;
telepresence = callPackage ../tools/networking/telepresence {
pythonPackages = python3Packages;