ImapCopy

Aus Hostsharing Wiki
Version vom 2. September 2013, 07:09 Uhr von Chg00-hsdoku (Diskussion | Beiträge) (dir imapcopy bei Befehlen zugefügt)
Zur Navigation springen Zur Suche springen

Installation ImapCopy

ImapCopy ist auf den HS Hive schon installiert

Einrichtung allgemein

Anmelden per ssh als ein Benutzer in einem HS-Paket.

xyz00-imapcopy@h01:~$

Dort wird ein Arbeitsverzeichnis erstellt

xyz00-imapcopy@h01:~$mkdir imapcopy
xyz00-imapcopy@h01:~$cd imapcopy

Die Konfiguration wird in einer Datei ImapCopy.cfg gespeichert

xyz00-imapcopy@h01:~/imapcopy$vi ImapCopy.cfg

Config Web.de -> HS Benutzer

Muster Inhalt der Datei ImapCopy.cfg

#############################################################
# imapcopy config
# all lines beginning with # are comments and will be ignored
#############################################################

##############
# Sourceserver
##############
SourceServer imap.web.de
SourcePort 143

###################
# Destinationserver
###################
DestServer xyz00.hostsharing.net
DestPort 143

#########
# Options
#########
#
# DebugSrc and DebugDest will show all traffic between IMAPCopy and Server
#
#DebugSrc
#DebugDst
 
#################
# Folders to skip
#################
#skipfolder INBOX.Trash
#skipfolder INBOX.Sent
#skipfolder "INBOX.Sent Objects"

#################
# Folders to copy
#################
#copyfolder INBOX
#copyfolder "INBOX.My personal files"
#copyfolder INBOX.Net-Connection.dy
#copyfolder INBOX.test

####################################################### 
# Rootfolder
# Can be specified to copy the Folder-Structure under
# a separate folder instead of inbox
#######################################################
#DstRootFolder "Your old Mails"

###############################################################
# Specify Flags that are supported on the destination server
# (AllowFlags) or flags that should be filtered out (DenyFlags)
# If not specified, all Flags are copyied 1:1
# If AllowFlags is specified, all not specified Flags will be
# removed and  not copied to the destination
# If DenyFlags is specified, those flags will be removed and
# the remaining ones will be copied
# Both (AllowFlags and DenyFlags) could be specified but
# would (in most cases) make no sense
##############################################################
#AllowFlags "\Seen\Answered\Flagged\Deleted\Draft Junk NonJunk $MDNSent $Forwared"
DenyFlags "\Recent"

##############################################################
# Timezone conversion
# The imap rfc is not clear on what kind of time offsets
# can be used. +XXXX -XXXX will be supported on all servers
# You can add as many entries as needed in the form
# converttimezone SRC DST
# to convert zones that your target server rejects
##############################################################
converttimezone "UTC" "+0000"
converttimezone "UT"  "+0000"

#############################
# List of users and passwords
#############################
#       SourceUser           SourcePassword        DestinationUser        DestinationPassword
Copy    "xyz@web.de"         "Euer-Passwort"       "xyz00-imap"           "Benuzter-Passwort"

Config gmail.com -> HS Benutzer

Da ImapCopy nicht direkt SSL unterstützt benötigt z.b. gmail und ggf einige andere die weiter unten beschrieben Lösung mit einem stunnel.

Testen einer Verbindung

Zum testen ob die Daten alle OK sind auf der shell einfach:

xyz00-imapcopy@h01:~/imapcopy$imapcopy -t

eingeben.

Daten austauschen

 xyz00-imapcopy@h01:~/imapcopy$imapcopy


Hilfe

xyz00-imapcopy@h01:~/imapcopy$imapcopy -h
xyz00-imapcopy@h01:~/imapcopy$man imapcopy


ssl via stunnel

certificate erstellt

Wir erstellen ein Zertificat mit der Datei stunnel.pem

Der Inhalt bei den einzelne folgenden Abfragen ist nicht entscheidet. Es muss die Datei und die Felder geben.

xyz00-imapcopy@h01:~/imapcopy$openssl req -new -x509 -days 3650 -nodes -out stunnel.pem -keyout stunnel.pem


Config für stunnel erstellen

Es wird eine Konfuguration Datei , hier stunnel-to-gmail.conf, benötigt.

xyz00-imapcopy@h01:~/imapcopy$vi stunnel-to-gmail.conf

Inhalt der Datei stunnel-to-gmail.conf:

cert = stunnel.pem
foreground=yes

; Some performance tunings
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1

; Some debugging stuff useful for troubleshooting
debug = 7

; Pfad for pid file
pid = /tmp/stunnel4-xyz00.pid

; Use it for client mode
client = yes

; Service-level configuration

[imap]
accept = 1143
connect = imap.gmail.com:993
retry = yes

Änderung in der ImapCopy.cfg

##############
# Sourceserver
##############
SourceServer localhost
SourcePort 1143

#############################
# List of users and passwords
#############################
#     SourceUser       SourcePassword  DestinationUser  DestinationPassword
Copy  "xyz@gmail.com"  "passwort"      "xyz00-imap"     "passwort"

stunnel aufbauen

Wir öffnen eine zweite shell.

xyz00-imapcopy@h01:~/imapcopy$stunnel4 stunnel-to-gmail.conf

Verbindung prüfen und herstellen

Siehe -> Testen einer Verbindung und -> Daten austauschen