Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Dev Section 3rd Party Software
  • Search

Sk-DirectAdmin-Importer | Script to Restore DirectAdmin User Account In VestaCP

Section with additional software for Vesta
Post Reply
  • Print view
Advanced search
15 posts
  • 1
  • 2
  • Next
skamasle
Collaborator
Posts: 592
Joined: Mon Feb 29, 2016 6:36 pm

Sk-DirectAdmin-Importer | Script to Restore DirectAdmin User Account In VestaCP
  • Quote

Post by skamasle » Sun Feb 12, 2017 10:44 pm

Hi

Im working in new script to help people move to vestacp, now I do DirectAdmin importer ( similar to Cpanel Importer )

For now I need a lite help, I need to do some test more in this script whit diferent backups if some body can help and send some backupwhit out sensible data, just backups from user account whit some domains, subdominios, databases etc whit no real information will help a lot.

At this time script can do this:

-Restore full User level account.
-Restore domains and web site files.
-Restore databases, mysql user and passwords.
-Restore Mails accounts whit mail passwords.

What script cant do:
- Restore subdomains -> I not know how subdomains work in DA because I only have backups from DA whit domains, there is no subdomain options in my DA backups so, I Think script need some lines of code to fix this and I will add it when I get new backups whit more content.

-Crons, SSL and some orther features will be added later.

First realease ready!


En español -> https://www.skamasle.com/migrar-cuenta- ... a-vestacp/
Last edited by skamasle on Wed Feb 15, 2017 7:25 pm, edited 1 time in total.
Top

skamasle
Collaborator
Posts: 592
Joined: Mon Feb 29, 2016 6:36 pm

Re: Sk-DirectAdmin-Importer | Script to Restore DirectAdmin User Account In VestaCP
  • Quote

Post by skamasle » Wed Feb 15, 2017 7:23 pm

First alpha is here if some body whant test it

Image

Runt at your own risk

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. http://www.gnu.org/licenses/

Code: Select all

cd /root/

wget mirror.skamasle.com/vestacp/skdaimporter/sk_da_importer.sh

bash sk_da_importer.sh da-user-backup.tar.gz
This is alpha, report any problem here.
Top

skamasle
Collaborator
Posts: 592
Joined: Mon Feb 29, 2016 6:36 pm

Re: Sk-DirectAdmin-Importer | Script to Restore DirectAdmin User Account In VestaCP
  • Quote

Post by skamasle » Sun Mar 12, 2017 8:07 pm

This was updated, if importer not working ( not restore domains )

You can set sk_get_dom=2 to try get domain list from domain dir directly

Changes in

https://github.com/Skamasle/sk_da_importer
Top

edatamax
Posts: 1
Joined: Sun Mar 12, 2017 4:52 am

Re: Sk-DirectAdmin-Importer | Script to Restore DirectAdmin User Account In VestaCP
  • Quote

Post by edatamax » Tue Mar 14, 2017 3:00 pm

Great job!
This script works as described.
Everything gets restored.
I changed sk_get_dom to 2.
Keep up the good work!
Thanks
Top

skamasle
Collaborator
Posts: 592
Joined: Mon Feb 29, 2016 6:36 pm

Re: Sk-DirectAdmin-Importer | Script to Restore DirectAdmin User Account In VestaCP
  • Quote

Post by skamasle » Thu Apr 13, 2017 6:05 pm

There is a issue with centos 6 because use old bash, if some body get this:

Code: Select all

Substring expresion -5: substring expression < 0
There is a fix in github, remplacing on line 122:

Code: Select all

userdb=${sk_da_db_u:: -5}
for

Code: Select all

userdb=$(echo $sk_da_db_u |sed "s/.conf//")
Working fine in bash 4.4 and will fail in bash 4.2 and older maybe in bash 4.3.. ( not tested )
Top

2infinity
Posts: 1
Joined: Mon May 01, 2017 7:01 pm

Re: Sk-DirectAdmin-Importer | Script to Restore DirectAdmin User Account In VestaCP
  • Quote

Post by 2infinity » Mon Jun 05, 2017 5:04 pm

Hi,

I've been struggling with this script for some time now as the migration didn't complete.
I've looked in de script and found that the imap function is looking for accounts in the backup folder.
After some searching I found an easy solution.
In your directadmin.conf add
direct_imap_backup=0

# cd /usr/local/directadmin/conf/
# nano directadmin.conf

Save config ( ctrl X -> Y ) and restart directadmin
# service directadmin restart

Create your user backups which will include the imap accounts in the backup folder of the tar.
Now the importer works fine for normal user accounts.
Top

skamasle
Collaborator
Posts: 592
Joined: Mon Feb 29, 2016 6:36 pm

Re: Sk-DirectAdmin-Importer | Script to Restore DirectAdmin User Account In VestaCP
  • Quote

Post by skamasle » Tue Jun 06, 2017 7:32 pm

2infinity wrote:Hi,

I've been struggling with this script for some time now as the migration didn't complete.
I've looked in de script and found that the imap function is looking for accounts in the backup folder.
After some searching I found an easy solution.
In your directadmin.conf add
direct_imap_backup=0

# cd /usr/local/directadmin/conf/
# nano directadmin.conf

Save config ( ctrl X -> Y ) and restart directadmin
# service directadmin restart

Create your user backups which will include the imap accounts in the backup folder of the tar.
Now the importer works fine for normal user accounts.

Hi thanks for advice

Directadmin change some options in in their sistem and have a lot of config options, this script will fail in some cases

If you have full backup type not supported by this script you can sendme it and when I get some time I will add support for it.
Top

bdacus01
Posts: 5
Joined: Mon Aug 28, 2017 6:21 pm

Re: Sk-DirectAdmin-Importer | Script to Restore DirectAdmin User Account In VestaCP
  • Quote

Post by bdacus01 » Mon Aug 28, 2017 7:21 pm

From DA website. direct_imap_backup is feature works as below.

New option, disabled by default:
direct_imap_backup=0

but can be enabled by adding:
direct_imap_backup=1

into your directadmin.conf.

When enabled, this feature will store the "imap" folder directly into the tar.gz backup file, saving the need to first copy all emails to an assembly area.
This should greatly speed up the backup process.

Previously, the /home/user/imap/domain.com/* data was stored in:
backup/domain.com/email/data/imap/*

but when this feature is enabled, a file:
backup/domain.com/email/data/imap/.direct_imap_backup

will be created, telling DA to extract:
imap/*

to /home/user/imap/*

For security reasons, the extraction is done as user:user, and not user:mail.
Then a secure recursive chown is done whereby it temporarily renames each file to a random value, checks for hardlinks, and checks for user:user ownership.
If all passes, it's then lchown, and renamed back.
The reason for the excessive checks is anytime a recrsive chown is done on files that can be controlled by a User, there is a risk of hardlinks being added, where DA might end up doing a chown on /etc/shadow, for example,
but there can also be a race condition where the client creates the hardlink after the check in DA is done, but before the chown happens, hence we need to rename the file to prevent that, as the client won't be able to predict the filename.

Currently, only /home/user/imap is done this way.
The /home/user/Maildir folder is still stored in the home.tar.gz (for now)
Top

bdacus01
Posts: 5
Joined: Mon Aug 28, 2017 6:21 pm

Re: Sk-DirectAdmin-Importer | Script to Restore DirectAdmin User Account In VestaCP
  • Quote

Post by bdacus01 » Mon Aug 28, 2017 7:23 pm

I have a DA backup if you tell me how you want it I will send you one.
Top

DBBJAF
Posts: 17
Joined: Fri Dec 25, 2015 6:10 pm

Re: Sk-DirectAdmin-Importer | Script to Restore DirectAdmin User Account In VestaCP
  • Quote

Post by DBBJAF » Wed Nov 28, 2018 9:33 pm

hi
i got this error :

Start Whit Databases
Get local databases
sk_da_importer.sh: line 120: -5: substring expression < 0

just user created with no file or database
hope this script will be update ASAP.
Top


Post Reply
  • Print view

15 posts
  • 1
  • 2
  • Next

Return to “3rd Party Software”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password