doc:appunti:linux:sa:imap
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:linux:sa:imap [2021/03/08 18:22] – [offlineimap] niccolo | doc:appunti:linux:sa:imap [2024/03/21 12:56] (current) – [offlineimap] niccolo | ||
|---|---|---|---|
| Line 41: | Line 41: | ||
| a6 OK FETCH completed. | a6 OK FETCH completed. | ||
| a7 LOGOUT | a7 LOGOUT | ||
| + | </ | ||
| + | |||
| + | Some IMAP servers present all the folders as subfolders of the INBOX: | ||
| + | |||
| + | < | ||
| + | a3 LIST "" | ||
| + | * LIST (\HasNoChildren) | ||
| + | * LIST (\HasNoChildren) | ||
| + | * LIST (\HasNoChildren) | ||
| + | * LIST (\Marked \HasChildren) " | ||
| + | a4 CREATE INBOX.Archive | ||
| + | </ | ||
| + | |||
| + | For other IMAP servers, the folders are outside the INBOX: | ||
| + | |||
| + | < | ||
| + | a3 LIST "" | ||
| + | * LIST (\HasNoChildren) | ||
| + | * LIST (\HasNoChildren \Drafts) | ||
| + | * LIST (\HasNoChildren \UnMarked \Sent) " | ||
| + | * LIST (\HasNoChildren \Trash) | ||
| + | * LIST (\HasNoChildren) | ||
| + | a4 CREATE Archive | ||
| </ | </ | ||
| Line 49: | Line 72: | ||
| Sincronizza una cartella su server **IMAP remoto** con una **Maildir locale** oppure un altro **server IMAP**. Sembra il programma più flessibile e semplice da utilizzare rispetto a **isync**, **mailsync**, | Sincronizza una cartella su server **IMAP remoto** con una **Maildir locale** oppure un altro **server IMAP**. Sembra il programma più flessibile e semplice da utilizzare rispetto a **isync**, **mailsync**, | ||
| - | La versione | + | **ATTENZIONE** :!: Le versioni |
| + | |||
| + | **ATTENZIONE** :!: La versione | ||
| + | |||
| + | **ATTENZIONE** :!: Il programma effettua una sincronizzazione **bidirezionale**, | ||
| - | **ATTENZIONE** :!: Il programma offre una funzione di sincronizzazione | + | **ATTENZIONE** :!: La versione |
| Pertanto, prima di iniziare la sincronizzazione, | Pertanto, prima di iniziare la sincronizzazione, | ||
| - | === Da IMAP a Maildir === | + | === Esempio #1: da IMAP a Maildir === |
| Il primo esempio riguarda una migrazione da repository **IMAP remoto** a **Maildir locale**. Prepariamo il file di configurazione **offlineimap-imap-maildir.conf**: | Il primo esempio riguarda una migrazione da repository **IMAP remoto** a **Maildir locale**. Prepariamo il file di configurazione **offlineimap-imap-maildir.conf**: | ||
| Line 75: | Line 102: | ||
| nametrans = lambda foldername: re.sub(' | nametrans = lambda foldername: re.sub(' | ||
| remotehost = mail.example.org | remotehost = mail.example.org | ||
| - | remoteuser = username1 | + | remoteuser = username |
| remotepass = MySecret | remotepass = MySecret | ||
| createfolders = False | createfolders = False | ||
| - | sslcacertfile = / | + | sslcacertfile = / |
| + | ssl_version = tls1_2 | ||
| + | # If you don't want IMAPS on port 993, you can use STARTTLS on port 143. | ||
| + | #ssl = no | ||
| + | #starttls = yes | ||
| [Repository Localhost] | [Repository Localhost] | ||
| Line 84: | Line 115: | ||
| localfolders = / | localfolders = / | ||
| </ | </ | ||
| + | |||
| + | Per impostazione predefinita offlineimap tenta una connessione **SSL** su porta **993/ | ||
| + | |||
| + | < | ||
| + | offlineimap.error.OfflineImapError: | ||
| + | You must configure at least something, otherwise having SSL helps nothing. | ||
| + | </ | ||
| + | |||
| + | Per vedere quale Certification Authority deve essere usata è necessario recuperare il certificato SSL dal server remoto, ad esempio con il comando: | ||
| + | |||
| + | < | ||
| + | openssl s_client -showcerts -connect mail.example.org: | ||
| + | </ | ||
| + | |||
| + | Quindi si ispeziona la **certificate chain** alla ricerca di **O**rganization e **C**ommon **N**ame con valori del tipo: | ||
| + | |||
| + | * O = Actalis S.p.A., CN = Actalis Organization Validated Server CA G3 | ||
| + | * O = Let's Encrypt, CN = R3 | ||
| + | |||
| + | Avendo installato il pacchetto **ca-certificates**, | ||
| + | |||
| + | < | ||
| + | [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c: | ||
| + | </ | ||
| + | |||
| + | Questo significa che il server utilizza una versione debole di SSL, vulnerabile ad attacchi del tipo //Factoring RSA Export Keys// poiché usa una chiave Diffie-Hellman più corta di 768 byte. In questo caso, se non possiamo correggere il server, è necessario aggiungere l' | ||
| + | |||
| + | Se si desidera utilizzare una connessione con STARTTLS su porta 143, è necessario aggiungere le opzioni '' | ||
| Si esegue il programma in modalità **%%--info%%**, | Si esegue il programma in modalità **%%--info%%**, | ||
| Line 119: | Line 178: | ||
| - | === Da IMAP a IMAP === | + | === Esempio #2: da IMAP a IMAP === |
| - | + | In questo esempio di effettua la sincronizzazione fra due server IMAP, quindi senza fare accesso diretto al filesystem. Questo il file di configurazione **offlineimap-imap-imap.conf**: | |
| - | Creare un file di configurazione **'' | + | |
| < | < | ||
| Line 129: | Line 187: | ||
| [Account Test] | [Account Test] | ||
| - | localrepository | + | remoterepository |
| - | remoterepository | + | localrepository |
| - | [Repository | + | [Repository |
| - | type = Maildir | + | type = IMAP |
| - | localfolders = / | + | # Strip the " |
| - | # If the remote IMAP is a Lotus Domino, remove the **'' | + | # 'INBOX' |
| - | #nametrans = lambda foldername: re.sub(' | + | # 'INBOX.Trash' => ' |
| + | # ' | ||
| + | nametrans = lambda foldername: re.sub(r'^INBOX\.', '', | ||
| + | remotehost = mail1.example.org | ||
| + | remoteuser = username1 | ||
| + | remotepass = MySecret1 | ||
| + | createfolders = False | ||
| + | sslcacertfile = / | ||
| - | [Repository | + | [Repository |
| type = IMAP | type = IMAP | ||
| - | # Remote server is Courier-IMAP, | + | remotehost = mail2.example.org |
| - | nametrans = lambda foldername: re.sub(' | + | remoteuser = username2 |
| - | # Remote server is Lotus Domino, add an " | + | remotepass = MySecret2 |
| - | #nametrans = lambda foldername: ' | + | sslcacertfile = / |
| - | remotehost = mail.host1.it | + | |
| - | remoteuser = user1 | + | |
| - | remotepass = password1 | + | |
| </ | </ | ||
| - | quindi eseguire | + | Si esegue il programma in modalità **%%--info%%**: |
| < | < | ||
| - | offlineimap -1 -c offlineimap.conf -d imap, | + | offlineimap --dry-run --info -c ./ |
| + | </ | ||
| + | |||
| + | Verifichiamo l' | ||
| + | |||
| + | < | ||
| + | Remote repository ' | ||
| + | ... | ||
| + | Folderlist: | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | Local repository ' | ||
| + | ... | ||
| + | Folderlist: | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | Si capisce che i due server IMAP utilizzano una struttura diversa: il primo ha il prefisso '' | ||
| + | |||
| + | === Sincronizzazione === | ||
| + | |||
| + | La sincronizzazione avviene semplicemente eseguendo il comando con l' | ||
| + | |||
| + | < | ||
| + | offlineimap -1 -c offlineimap-imap-imap.conf -d imap, | ||
| </ | </ | ||
| * Lo stato della sincronizzazione viene scritto in **'' | * Lo stato della sincronizzazione viene scritto in **'' | ||
| * La '' | * La '' | ||
| - | * L' | + | * Potrebbe essere necessario specificare l' |
| - | * L' | + | |
| - | * La versione | + | === Soluzione problemi === |
| - | * Con la versione **6.5.4** i messaggi importati hanno **mode 0755**, usare la versione **6.5.5**. | + | |
| + | Vedere | ||
| ==== isync ==== | ==== isync ==== | ||
doc/appunti/linux/sa/imap.1615224146.txt.gz · Last modified: by niccolo
