Connect-BitwardenSSH/README.md
2021-09-11 16:37:49 -06:00

48 lines
2 KiB
Markdown

# Connect-BitwardenSSH
PowerShell helper script to temporarily download a SSH Key stored in Bitwarden to make a SSH connection.
## Requirements
In the desired Bitwarden account, a item will need to be created to store the SSH key.
![Bitwarden Example Item](Images/bitwarden-example.png?raw=true)
An attachment can then be added of the private SSH key.
![Bitwarden Example Attachment](Images/bitwarden-example-attachments.png?raw=true)
## Variables
| Variable | Required | Default | Description |
| ------------ | -------- | ----------------------- | -------------------------------------------------------------------------------------- |
| SSHUser | No | [Environment]::UserName | Username used for the SSH Connection |
| SSHDevice | Yes | | Device to connect via SSH |
| SSHCommand | No | | Extra parameters to be used in the SSH command - See OpenSSH docs for possible options |
| SearchString | Yes | | The name of the item/attachment in Bitwarden for the SSH key |
## Example
### Example 1
This will download the SSH key named "ssh-bw" from Bitwarden. You will be prompted for the device at runtime.
```powershell
Connect-BitwardenSSH.ps1 -SearchString "ssh-bw"
```
### Example 2
This will download the SSH key named "ssh-bw" from Bitwarden. The SSH connection will setup a port forward from the remote machine's RDP (3389) port to so it can be accessed via 3390 on the machine running the script.
```powershell
Connect-BitwardenSSH.ps1 -SSHUser thale -SSHDevice 10.1.1.1 -SSHCommand "-N -L 3390:127.0.0.1:3389" -SearchString "ssh-bw"
```
## License
See LICENSE file for full license information.
## Screenshots
![Bitwarden Example Item](Images/bitwarden-example-screenshot.png?raw=true)