Get management token using the 'tail token' command. Returns a token scoped for 'logs' resource.
(self, config, config_path)
| 43 | return json.loads(result.stdout.decode("utf-8").strip())["token"] |
| 44 | |
| 45 | def get_tail_token(self, config, config_path): |
| 46 | """ |
| 47 | Get management token using the 'tail token' command. |
| 48 | Returns a token scoped for 'logs' resource. |
| 49 | """ |
| 50 | basecmd = [config.cloudflared_binary] |
| 51 | if config_path is not None: |
| 52 | basecmd += ["--config", str(config_path)] |
| 53 | origincert = get_config_from_file()["origincert"] |
| 54 | if origincert: |
| 55 | basecmd += ["--origincert", origincert] |
| 56 | |
| 57 | cmd_args = ["tail", "token", config.get_tunnel_id()] |
| 58 | cmd = basecmd + cmd_args |
| 59 | result = run_subprocess(cmd, "tail-token", self.logger, check=True, capture_output=True, timeout=15) |
| 60 | return json.loads(result.stdout.decode("utf-8").strip())["token"] |
| 61 | |
| 62 | def get_management_url(self, path, config, config_path, resource): |
| 63 | access_jwt = self.get_management_token(config, config_path, resource) |