개요
SSH Agent
ssh username@host -i ~/.ssh/private-key.pem
Host host HostName 192.168.0.2 User username IdentityFile ~/.ssh/private-key.pem
ssh host
1Password
brew install 1password


Bitwarden
brew install bitwarden



Bitwarden SSH Agent | Bitwarden
This article provides a guide to setup and use the Bitwarden SSH Agent.

- 조직 내의 SSH 키는 현재 인식이 되지 않는다.
- 키 타입은 ED25519만 지원한다.
1Password: ~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock Bitbucket: ~/.bitwarden-ssh-agent.sock
ln -s ~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock ~/.1p.sock
Host host-with-1p HostName 192.168.0.2 User username IdentityAgent ~/.1p.sock IdentityFile ~/.ssh/1p.pub Host host-with-bitwarden HostName 192.168.0.3 User username IdentityAgent ~/.bitwarden-ssh-agent.sock IdentityFile ~/.ssh/bitwarden.pub
IdentityAgent
에 각각의 SSH Agent 소켓 위치를 입력하고, IdentityFile
에 각각의 비밀키에 대응하는 공개키 위치를 입력한다. 비밀키를 비밀번호 관리자에 등록하거나 생성하면 여기에서 공개키를 내려받을 수 있는데, 이걸 내려받아서 공개키 경로를 지정해주면 된다.Host proxmox-docker HostName 172.30.1.95 User root IdentityAgent ~/.1p.sock IdentityFile ~/.ssh/proxmox-docker.pub IdentitiesOnly yes Host mini-ssh.daeho.ro ProxyCommand /opt/homebrew/bin/cloudflared access ssh --hostname %h IdentityAgent ~/.1p.sock IdentityFile ~/.ssh/mini-ssh.pub IdentitiesOnly yes Host jupiter-ssh HostName 172.30.1.11 User username IdentityAgent ~/.bitwarden-ssh-agent.sock IdentityFile ~/.ssh/jupiter.pub IdentitiesOnly yes Host wordpress HostName i-046ac5141b8dc0f68 User bitnami ProxyCommand zsh -c "aws-vault exec lamanus -- aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'" IdentityAgent ~/.1p.sock IdentityFile ~/.ssh/wordpress.pub IdentitiesOnly yes Host project-backend HostName dev-instance-backend User daeho.ro ProxyCommand zsh -c "gcloud compute ssh --plain --zone asia-northeast3-c --project project %h" IdentityAgent ~/.bitwarden-ssh-agent.sock IdentityFile ~/.ssh/dev-backend.pub IdentitiesOnly yes
ssh wordpress
aws-vault
명령을 통해서 안전하게 AWS 크레덴셜을 사용하면서 키체인 접근을 위한 암호 입력을 요구한다.aws-vault
의 키체인 접근 요청 - 암호
- 크레덴셜이 없으면 AWS의 SSO 로그인 및 권한 인증 요청
- AWS 크레덴셜 확보 후에는 SSH 비밀키 접근을 위한 1Password 인증 요청

ssh jupiter-ssh

ssh project-backend
- gcloud 크레덴셜이 없다고 오류가 발생
gcloud auth login
실행하여 GCP 권한 획득
- GCP 크레덴셜 확보 후에는 SSH 비밀키 접근을 위한 Bitwarden 인증 요청
Git
Host github.com gitlab.com bitbucket.org IdentityAgent ~/.1p.sock
SSH 설정
- GitHub 계정이 2개 이상인 경우
- GitHub 회사 조직에서 별도의 SSH 비밀키를 사용해야 하는 경우
git@github.com
으로 고정되어 있다. 그러면 리포지토리 주소는 다음과 같다.git@github.com:user-or-org/repo.git
Host github.com gitlab.com bitbucket.org IdentityAgent ~/.1p.sock Host github-org HostName github.com User git IdentityAgent ~/.bitwarden-ssh-agent.sock IdentityFile ~/.ssh/organization.pub IdentitiesOnly yes
git@github.com
→ github-org
으로 호스트를 다르게 등록하여 인증 프로세스를 분리할 수 있다! 매번 origin을 편집해야 하는 부분은 귀찮을 수 있지만, 개인과 업무가 완전히 분리가 가능하다는 장점이 있다. 이처럼 호스트를 편집함으로써 원하는 대부분의 구현이 가능하다.Git 설정
~/.gitconfig
설정을 통해서 remote의 주소 형태에 따른 설정 분리가 가능하고, 이를 위해서는 다음과 같이 설정을 진행하면 된다는 것이다.... [includeIf "hasconfig:remote.*.url:git@github.com:org1/**"] path = ~/.config/git/config-work [includeIf "hasconfig:remote.*.url:git@github.com:org2/**"] path = ~/.config/git/config-work-2
맺음말
참고 자료
1Password for SSH & Git | 1Password Developer
1Password for SSH & Git | 1Password Developer
Introducing 1Password for SSH & Git, the single source of truth for all your SSH keys.
BitwardenBitwarden SSH Agent | Bitwarden
Bitwarden SSH Agent | Bitwarden
This article provides a guide to setup and use the Bitwarden SSH Agent.
GitHub DocsUsing SSH agent forwarding - GitHub Docs
Using SSH agent forwarding - GitHub Docs
To simplify deploying to a server, you can set up SSH agent forwarding to securely use local SSH keys.
AWS Systems Manager8단계: (선택 사항) Session Manager를 통한 SSH 연결에 대한 권한 허용 및 제어 - AWS Systems Manager
8단계: (선택 사항) Session Manager를 통한 SSH 연결에 대한 권한 허용 및 제어 - AWS Systems Manager
AWS Systems Manager(구 Amazon EC2 Systems Manager)는 여러 AWS 리소스에 걸쳐 운영 데이터를 중앙 집중화하고 태스크를 자동화할 수 있게 하는 통합 인터페이스입니다. Systems Manager는 인프라의 운영 문제를 감지하고 해결하는 시간을 단축합니다. Systems Manager는 인프라 성능 및 구성의 전체 뷰를 제공하고, 리소스 및 애플리케이션 관리를 간소화하고, 규모에 맞게 인프라를 운영 및 관리할 수 있도록 합니다.
Google Cloudgcloud compute ssh | Google Cloud SDK Documentation
gcloud compute ssh | Google Cloud SDK Documentation
To use SSH to connect to a Windows VM, refer to this guide: https://cloud.google.com/compute/docs/connect/windows-ssh