Sagecipher
Uses SSH agent to encrypt/decrypt arbitrary data
About
Sagecipher_-_architecture.png
This can be used in turn by the keyring library, and by ansible-vault to encrypt/decrypt files or secrets via the users' local or forwarded ssh-agent session.
Simple usage
ssh-agent, ssh-add, Python Keyring Lib 참조.
Using sagecipher directly in Python
>>> from sagecipher import Cipher
>>>
>>> # Encrypts using the first SSH key available from SSH agent...
>>> enc_text = Cipher.encrypt_string("hello, world")
>>> text = Cipher.decrypt_string(enc_text)
>>> text
"hello, world"
SSH Agent 실행여부 확인
SSH_AGENT_PID 같은 환경변수로 확인할 수 없을 경우, 내부적으로 paramiko를 사용하므로 이걸로 확인하자.