Added guide for 1Password CLI integration.

This commit is contained in:
2026-01-08 17:02:45 +01:00
parent 1e96682d79
commit dfa2ab5334

View File

@@ -235,3 +235,49 @@ systemctl start vault
# Unseal the Vault
VAULT_ADDR=http://127.0.0.1:8200 vault operator unseal
```
## 1Password Setup
Install 1Password CLI using the commands below:
```shell
VERSION="v2.32.0" # I don't know how to get the latest version dynamically
# Repleace aarch with arm64
ARCH=${ARCH/aarch64/arm64}
echo "Installing 1Password CLI version ${VERSION} manually..."
TMP="/tmp/$(mktemp -d 1password-cli-installtion.XXXXXX)"
mkdir -p $TMP/extracted
curl -vsSL "https://cache.agilebits.com/dist/1P/op2/pkg/${VERSION}/op_linux_${ARCH}_${VERSION}.zip" -o $TMP/op.zip
unzip $TMP/op.zip -d $TMP/extracted
sudo groupadd -f onepassword-cli
sudo install -g onepassword-cli $TMP/extracted/op /usr/local/bin/op
sudo chmod g+s /usr/local/bin/op
if [[ -d $TMP ]]; then rm -rf $TMP; fi
```
> **Note:** Adjust the `VERSION` variable to install a different version of the 1Password CLI.
Create a `.vault.env` file in the home directory with the following content:
```shell
VAULT_ADDR=http://localhost:8200
VAULT_TOKEN=op://Private/root KMS Koszewscy/password
```
add the following line to your shell profile (e.g., `~/.bashrc` or `~/.zshrc`):
```shell
alias op_vault='op run --env-file="$HOME/.vault.env" -- vault'
```
Run Vault CLI as follows:
```shell
op_vault token lookup
```
Eventually, set both `VAULT_ADDR` and `VAULT_TOKEN` environment variables in your shell:
```shell
export $(cat $HOME/.vault.env | op inject)
```