Skip to content

Commit 7e88122

Browse files
authored
Merge pull request #84 from britive/develop
v1.4.0rc4
2 parents b2f2f38 + 9a928ec commit 7e88122

12 files changed

Lines changed: 395 additions & 50 deletions

File tree

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@
33
* All changes to the package starting with v0.3.1 will be logged here.
44
* As of v1.4.0 release candidates will be published in an effort to get new features out faster while still allowing time for full QA testing before moving the release candidate to a full release.
55

6+
7+
## v1.4.0rc4 [2023-06-22]
8+
#### What's New
9+
* `pybritive ssh gcp identity-aware-proxy` command - supports OS Login and SSH Instance Metadata
10+
11+
#### Enhancements
12+
* Support for `sso_idp` in the tenant configuration block of the config file. Set with `configure update tenant-<name> sso_idp <value>`. This will enable automatic re-direction to your identity provider, thus eliminating a manual step when authenticating to your tenant.
13+
14+
#### Bug Fixes
15+
* Properly catch and error when Cognito tokens have been invalidated.
16+
17+
#### Dependencies
18+
* Fix dependabot alert for `requests` - https://github.com/britive/python-cli/security/dependabot/4
19+
* Fix dependabot alert for `cryptography` - https://github.com/britive/python-cli/security/dependabot/5
20+
* `britive>=2.20.0`
21+
22+
#### Other
23+
* None
24+
25+
626
## v1.4.0rc3 [2023-05-16]
727
#### What's New
828
* None

docs/index.md

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,11 @@ The `ssh` command facilitates using the native SSH protocol to connect to privat
264264

265265
The goal is to allow all functionality offered by the SSH protocol like local port forwarding to access private resources and `scp` to copy files to the remote host.
266266

267-
At launch only AWS EC2 is supported. The requirements for using SSH with EC2 instances are provided below.
267+
AWS and GCP are supported.
268+
269+
### AWS
270+
271+
The requirements for using SSH with EC2 instances are provided below.
268272

269273
* EC2 instance must have the Systems Manager agent installed and operational.
270274
* EC2 instance must have the EC2 Instance Connect agent installed and operational (if using `--push-public-key`).
@@ -320,6 +324,84 @@ If `aws-region` is omitted then credentials for Session Manager and EC2 Instance
320324

321325
The command `ssh aws config` can be invoked to generate the above `Match` directives.
322326

327+
### GCP
328+
329+
The requirements for using SSH with GCP compute engine instances are provided below.
330+
331+
* `gcloud` CLI must be installed in the environment and `gcloud auth login` already performed.
332+
* Instance must accept SSH key from either [OS Login](https://cloud.google.com/compute/docs/oslogin/set-up-oslogin) or [SSH Instance Metadata](https://cloud.google.com/compute/docs/connect/add-ssh-keys#metadata) (if using `--push-public-key`).
333+
* If using OS Login two-factor authentication cannot be enabled.
334+
* The caller must have appropriate permissions to use identity aware proxy (for all `--key-source`s) and push a public key via OS Login or SSH Instance Metadata (if using `--push-public-key`).
335+
* The caller's environment must have the `gcloud` cli installed and `gcloud auth login` already performed.
336+
* The caller must use OpenSSH (and the SSH config file). Other SSH implementations are not currently supported.
337+
338+
There are 3 ways that `pybritive` can help proxy an SSH session to a private compute instance.
339+
340+
* Using just Identity Aware Proxy (IAP) SSH forwarding to establish the network path over which the SSH protocol will operate. It is left to the caller then to handle SSH authentication using whichever mechanism has already been established.
341+
342+
~~~bash
343+
Host bastion.dev
344+
HostName gcp.instance-name.project-id
345+
346+
Match host gcp.*
347+
User username
348+
ProxyCommand eval $(pybritive ssh gcp identity-aware-proxy --hostname %h --username %r --port-number %p)
349+
~~~
350+
351+
* Using IAP SSH forwarding along with pushing a randomly generated SSH key pair public key via OS Login or Instance Metadata and identifying the private key via static path in the `IdentityFile` parameter.
352+
353+
Using OS Login...
354+
~~~bash
355+
Host bastion.dev
356+
HostName gcp.instance-name.project-id
357+
358+
Match host gcp.*
359+
User username
360+
IdentityFile ~/.britive/ssh/%h.%r.pem
361+
ProxyCommand eval $(pybritive ssh gcp identity-aware-proxy --hostname %h --username %r --port-number %p --push-pulbic-key os-login --key-source static)
362+
~~~
363+
364+
Using Instance Metadata...
365+
~~~bash
366+
Host bastion.dev
367+
HostName gcp.instance-name.project-id
368+
369+
Match host gcp.*
370+
User username
371+
IdentityFile ~/.britive/ssh/%h.%r.pem
372+
ProxyCommand eval $(pybritive ssh gcp identity-aware-proxy --hostname %h --username %r --port-number %p --push-pulbic-key instance-metadata --key-source static)
373+
~~~
374+
375+
* Using IAP SSH forwarding along with pushing a randomly generated SSH key pair public key via OS Login or Instance Metadata and adding the private key to the `ssh-agent` via `ssh-add` so it is available without having to specify the `IdentityFile` parameter.
376+
377+
Using OS Login...
378+
~~~bash
379+
Host bastion.dev
380+
HostName gcp.instance-name.project-id
381+
382+
Match host gcp.*
383+
User username
384+
ProxyCommand eval $(pybritive ssh gcp identity-aware-proxy --hostname %h --username %r --port-number %p --push-pulbic-key os-login --key-source ssh-agent)
385+
~~~
386+
387+
Using Instance Metadata...
388+
~~~bash
389+
Host bastion.dev
390+
HostName gcp.instance-name.project-id
391+
392+
Match host gcp.*
393+
User username
394+
ProxyCommand eval $(pybritive ssh gcp identity-aware-proxy --hostname %h --username %r --port-number %p --push-pulbic-key instance-metadata --key-source ssh-agent)
395+
~~~
396+
397+
The `HostName` parameter must be in the appropriate format. That format is
398+
399+
~~~
400+
gcp.<instance name>.<project id>
401+
~~~
402+
403+
The command `ssh gcp config` can be invoked to generate the above `Match` directives.
404+
323405
## `aws` Command
324406

325407
The `aws` command group will hold actions related specifically to AWS.

requirements.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
britive>=2.19.0
1+
britive>=2.20.0
22
certifi>=2022.12.7
33
charset-normalizer==2.1.0
44
click==8.1.3
55
idna==3.3
66
merge-args==0.1.5
77
PyYAML==6.0
8-
requests==2.28.1
8+
requests>=2.31.0
99
six==1.16.0
1010
tabulate==0.8.10
1111
toml==0.10.2
1212
urllib3==1.26.9
13-
cryptography~=39.0.1
14-
pytest
13+
cryptography>=41.0.0
14+
pytest~=7.1.2
1515
mkdocs==1.3.1
1616
mkdocs-click==0.8.0
1717
twine~=4.0.1
1818
python-dateutil~=2.8.2
1919
boto3
20-
jmespath
21-
pyjwt
20+
jmespath~=1.0.1
21+
pyjwt~=2.6.0
22+
google-cloud-compute

setup.cfg

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = pybritive
3-
version = 1.4.0rc3
3+
version = 1.4.0rc4
44
author = Britive Inc.
55
author_email = support@britive.com
66
description = A pure Python CLI for Britive
@@ -19,14 +19,14 @@ packages = find:
1919
python_requires = >=3.7
2020
install_requires =
2121
click
22-
requests
22+
requests>=2.31.0
2323
PyYAML
2424
merge_args
2525
tabulate
2626
toml
27-
cryptography~=39.0.1
27+
cryptography>=41.0.0
2828
python-dateutil
29-
britive>=2.19.0
29+
britive>=2.20.0
3030
jmespath
3131
pyjwt
3232

0 commit comments

Comments
 (0)