ssh-agent
사용하기가 매우 쉽습니다. 시작하고 ssh-add keyfile
. 프로세스를 종료 ssh-agent
하면 모든 파일이 사라집니다.
어떻게 동일한 동작을 얻을 수 gpg-agent
있습니까? 내가 찾은 가장 가까운 프로그램은 gpg-preset-passphrase
. 그러나의 매뉴얼 페이지를gpg-agent
보면 개인 키를 저장하기위한 디렉토리가 생성 된 것 같습니다.
내가 틀릴 수 있으므로 gpg-agent
파일 / 디렉토리가 생성되지 않도록 어떻게 설정할 수 있는지 궁금합니다 . 가능하지 않다면 + gpg-agent
와 같은 다른 제안 도 환영합니다. Seahorse와 같은 GUI 솔루션을 찾고 있지 않습니다.ssh-agent
ssh-add
나는 이것을 다시보기로 결심했고 그것이 어떻게 작동하는지 알아 냈다. GPG는 암호 저장에 "캐시"라는 용어를 사용합니다. 최대 저장 시간에는 두 가지 제약이 적용될 수 있습니다.
또한 두 제약 조건에 대해 GPG 키용과 SSH 키용 (지원이 활성화 된 경우)의 두 가지 변형이 있습니다.
의 관련 매뉴얼 페이지 항목 gpg-agent(1)
:
--default-cache-ttl n
Set the time a cache entry is valid to n seconds. The default
is 600 seconds.
--default-cache-ttl-ssh n
Set the time a cache entry used for SSH keys is valid to n sec‐
onds. The default is 1800 seconds.
--max-cache-ttl n
Set the maximum time a cache entry is valid to n seconds. After
this time a cache entry will be expired even if it has been
accessed recently. The default is 2 hours (7200 seconds).
--max-cache-ttl-ssh n
Set the maximum time a cache entry used for SSH keys is valid to
n seconds. After this time a cache entry will be expired even
if it has been accessed recently. The default is 2 hours (7200
seconds).
암호는 항상 캐시됩니다 (디스크가 아닌 메모리에!의 git 저장소로 확인 됨 $HOME
). 따라서 ssh-add
. 예를 들어 더미 데이터에 서명하면 이미 캐시가 트리거됩니다.
$ echo | gpg -s >/dev/null
(passphrase requested
$ echo | gpg -s >/dev/null
(signing proceeds without asking for passphrase)
gpg-agent의 캐시 설정을 영구적으로 변경하려면 ~ / .gnupg / gpg-agent.conf`를 편집하고 다음과 같이 추가하십시오.
default-cache-ttl 60 # Expire GPG keys when unused for 1 minute
max-cache-ttl 600 # Expire GPG keys after 10 minutes since addition
를 지정하여 SSH 에이전트 지원을 활성화하려고 시도했지만 enable-ssh-support
gpg-agent가 키를 암호화 할 다른 키를 요청한 다음 개인 키를 ~/.gnupg/private-keys.d/
. 나를 위해 가지 마십시오. 그러면 이중 ssh-agent / gpg-agent 접근 방식을 고수 할 것입니다.
몇 가지 보너스 팁 :
max-cache-ttl-ssh
키를 추가 할 때 SSH 에이전트에 해당하는 항목을 지정할 수 있습니다. 예를 들면 다음과 같습니다.ssh-add -t 600 ~/.ssh/id_rsa
에이전트에 GPG 암호가 저장되지 않도록하려면 에이전트를 비활성화하십시오. 최신 GPG 버전에서는 옵션 --no-use-agent
이 무시되지만 관련 환경 변수를 지워 에이전트가 사용되지 않도록 할 수 있습니다. 이를 수행하는 몇 가지 방법 :
echo | GPG_AGENT_INFO= gpg -s # temporary
export GPG_AGENT_INFO=; echo | gpg -s # until the current shell is closed
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다