关于 GPG 被提及gpg-agent
并且我读到以下答案:
哪里提到了--default-cache-ttl
和--max-cache-ttl
选项?所以我找到了这个官方来源:
--default-cache-ttl n
Set the time a cache entry is valid to n seconds. The default is 600 seconds.
Each time a cache entry is accessed, the entry's timer is reset.
To set an entry's maximum lifetime, use max-cache-ttl
Note that a cached passphrase may not be evicted immediately from memory if
no client requests a cache operation. This is due to an internal housekeeping
function which is only run every few 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 or has been set using gpg-preset-passphrase.
The default is 2 hours (7200 seconds).
因此,请考虑以下主要问题:
--default-cache-ttl
和选项之间有什么区别和联系--max-cache-ttl
?
次要问题如下:
- 到底是什么
cache entry
? gpg-agent
当考虑/应用--default-cache-ttl
和选项时要知道的标准是什么--max-cache-ttl
?
因此,我想清楚地了解何时以及为何根据每个选项考虑 600 秒(10 分钟)和 7200 秒(2 小时)的要点/场景/标准
代理运行时,它会处理密码请求。当用户输入密码时,它会被添加到缓存中。
default-cache-ttl
并max-cache-ttl
设置该缓存的超时时间:max-cache-ttl
在第一次使用后测量到期时间default-cache-ttl
,在最后一次使用后测量如果我现在输入密码,并在默认缓存超时(默认为 10 分钟)内重复使用它,那么在达到最大缓存超时(2 小时)之前,我都不需要重新输入密码。这在短时间内执行许多需要密钥的操作时非常有用;例如,重新提交或签署大量电子邮件。
这两种设置是在便利性和安全性之间做出的妥协。从便利性的角度来说,只要我在十分钟内重新使用密钥,两小时内就无需重新输入密码。从安全性的角度来说,如果我一直在使用密钥,而其他人访问了我已解锁的设备,他们最多可以冒充我两小时。