Go to file
mandi 60386c9be7 Tag version v0.0.3 2022-04-21 11:58:22 +02:00
test Tag version v0.0.3 2022-04-21 11:58:22 +02:00
types Renamed xmlPacket.go struct file 2022-01-25 00:09:11 +01:00
.gitignore Implemnted logIn() function calling Api-Key from server if needed and serializing the data for re-use closes #1 2022-01-28 12:13:08 +01:00
README.md Added documentation for usage of FullPacket 2022-01-29 02:39:12 +01:00
go.mod Added test and renamed module 2022-01-20 11:39:52 +01:00
go.sum Initial implementation of the backup functionalities 2022-01-14 15:33:11 +01:00
godovecot.go Tag version v0.0.3 2022-04-21 11:58:22 +02:00

README.md

godovecot

Functions

CreatePacket

See for Details

https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-mail/mail-account-settings.34481/

Usage

RestoreMail(a ...IPacket)

ResroreMail(a ...IPacket) is implemented as variadic to be able to pass parameters as different types implementing the IPacket interface:

  • PacketValues
    • For passing strings of the account to create
  • FullPacket
    • For passing directing a created xml Packet
    • Packet needs to be passed by appending the slice directly
    fullPacket.Packets = append(fullPacket.Packets, &newPacket) 
    
  • FilePacket
    • For passing the path to a .json backup file

logIn()

The logIn is done in several steps

  • Checks if serialized server struct is avalaible
    • If serialization is available
      • Checks if ApiKey is set
        • If it is set the is passed to used server struct
      • If not set
        • callApiKey() is called to get a valid API-Key
  • If serialization is not available
    • callApiKey() is called to get a valid API-Key
    • Called API-Key is passed to the used server instance
    • User server instance is serialized to file

Information

Keys

Needs ssh keys.

To genarate keys

  • On local machine
    ssh-keygen -t rsa -b 4096
    
    ssh-copy-id root@89.22.111.212
    
    • Enter ssh-password to "register" ssh-key on server

The module needs also to run in a Docker container. To do so the container -as a unique client- needs to have it's "own" ssh-key.
There are two ways to to that.

  1. Create an ssh key on first start of the program For this the steps described in the section Keys must be implemented in Go to store an ssh key to the container and to "register" this key to ther server
  2. Use the ssh key of the host For using .ssh keys of the host in Docker see here:
    https://medium.com/trabe/use-your-local-ssh-keys-inside-a-docker-container-ea1d117515dc

Restore

  • Upload synced folder to server
  • Change ownership of uploaded folder to dovecot user chown -R popuser:popuser ververis.eu

Backup accounts

  • Dialing to server with ssh
  • Creating output of dovecot mail accounts including passwords /usr/local/psa/admin/sbin/mail_auth_view
  • Read in the output as .csv and parse to an array of accounts
  • Save file as .json

Uses libraries / modules