Bulk convert selected alias domains to main domains

Discussion in 'Installation/Configuration' started by vistree, May 27, 2018.

  1. vistree

    vistree Member HowtoForge Supporter

    Hi,
    I have a ispconfig server with one domain where I created hundreds of alias domains. Now, the new data security policy requires that I enable SSL for all alias domains, as I use input forms there. Unfortunately, it seems not to be possible to create a let's encrypt certificate for a domain with more than 300 alias domains. Therefor I need to change all those alias domains to main domains to enable SSL for them. Is there a way to BULK convert all alias domains for the ONE main domain and automatically activate let's encrypt? Maybe by changing the database records and use a "resync" process?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Might be possible, but I've never tried that. You might setup ISPConfig in a vm so that you can undo things easily on failure and try it. If it does not work, then you might do it with the remote api.
     
  3. vistree

    vistree Member HowtoForge Supporter

    Thanx Till, will try this out. One question: does every web needs its own Linux user (webXX:clientX) or is it possible to use the same user for multiple main domains?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    That's not so easy to answer. Every website has it's own user by default, but it's possible that using the same user might work, but, if you would delete a single site, then this user will get removed and all sites will fails as the code does not expect that a user might be user by another site, so the code that removes the user will not check if this user might still be required.
     
  5. vistree

    vistree Member HowtoForge Supporter

    That sound good! I will try to set the same user + same directory + same openbase dir for all the domains which needs to be converted from alias to main domain.
     
  6. vistree

    vistree Member HowtoForge Supporter

    For those interesete: the conversion from alias domains to real domains is done. I did this through an mysql update query + using the ispconfig resync (domains) afterwards. The query I used (maybe useful as reference!):
    UPDATE `dbispconfig`.`web_domain` SET `sys_userid` = '1', `sys_perm_group` = 'ru', `ip_address` = '148.251.87.82', `type` = 'vhost', `parent_domain_id` = '0', `vhost_type` = 'name', `document_root` = CONCAT('/var/www/clients/client1/web',domain_id), `system_user` = CONCAT('web',domain_id), `system_group` = 'client1', `hd_quota` = '-1', `cgi` = 'n', `ssi` = 'n', `php` = 'fast-cgi', `redirect_type` = 'no', `seo_redirect` = 'non_www_to_www', `php_open_basedir` = CONCAT('/var/www/clients/client1/web',domain_id,'/web:/var/www/clients/client1/web1/web:/var/www/clients/client1/web',domain_id,'/tmp:/var/www/clients/client1/web1/tmp:/var/www/',domain,'/web:/srv/www/',domain,'/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/usr/share/php') WHERE `web_domain`.`parent_domain_id` = 1;
    Keep in mind that I needed to convert alias domains of one main domain (domain_id = 1) to real domains. As I also added a softlink to the web root (/cms/) of domain 1 I also added this web to the php_open_basedir of each converted alias domain.
     
    till likes this.

Share This Page