I use IMAP over SSH, in pre-auth. I wanted to use dsync to offline mail to my laptop.
dsync v2.1.10 would always ask for my SSH key/passphrase, ignoring ssh-agent. The culprit is the env_clean() in the stack below.
Reading the source, I saw DOVECOT_PRESERVE_ENVS. When used as follows in my script it enables dsync to find my ssh-agent:
export DOVECOT_PRESERVE_ENVS="SSH_AGENT_PID SSH_AUTH_SOCK" dsync mirror ssh imap.example.com /home/mark/opt/dovecot/bin/dsync
and it now works without asking for password every time.
I'm posting here so that anyone else googling for the same problem will hopefully find this, as I couldn't find anything about this in the docs.
Also I'm interested in why dsync so aggressively cleans the environment; I tried a naive removal of env_clean() but this breaks basic functions.
With this dsync is working very well for offline mail -- combined with alpine and a local exim for the outbound queue :) Thanks
-- Mark
Breakpoint 2, env_clean () at env-util.c:59 59 if (clearenv() < 0) (gdb) bt #0 env_clean () at env-util.c:59 #1 0xb7df10fc in master_service_env_clean () at master-service.c:454 #2 0xb7df26d4 in master_service_exec_config (service=0x809e7d0, input=0xbffff7e4) at master-service-settings.c:103 #3 0xb7df29be in config_exec_fallback (service=0x809e7d0, input=0xbffff7e4) at master-service-settings.c:153 #4 0xb7df2b65 in master_service_open_config (service=0x809e7d0, input=0xbffff7e4, path_r=0xbffff780, error_r=0xbffff7d8) at master-service-settings.c:206 #5 0xb7df3130 in master_service_settings_read (service=0x809e7d0, input=0xbffff7e4, output_r=0xbffff7dc, error_r=0xbffff7d8) at master-service-settings.c:345 #6 0x0805c672 in doveadm_read_settings () at doveadm.c:275 #7 0x0805c7d6 in main (argc=5, argv=0x809e1c0) at doveadm.c:342