Hook evolution for Ispconfig LE renewal

Discussion in 'Developers' Forum' started by francoisPE, Jun 25, 2021.

  1. francoisPE

    francoisPE Member HowtoForge Supporter

    Hello,
    I am using LE Certificates created and renewed by ISP config for 2 services : coturn and slapd

    Those 2 are running with users different from root, so that I would like to use hook to copy and chown files after renewal (same process than describe here https://docs.bigbluebutton.org/admin/setup-turn-server.html#generating-tls-certificates)

    This means, I would like to add few lines to : ispconfig3/server/scripts/letsencrypt_renew_hook.sh
    I have the possibility to create file : /usr/local/ispconfig/server/conf-custom/scripts/letsencrypt_renew_hook.sh
    But custom is always dangerous when code evolves.
    As these hooks, are probably needed by few people, I would propose to change a little bit the logic.

    Instead of having a custom file "replacing" the normal code, why not having a custom file in "addition to"

    Thus, I propose following modification:
    change
    Code:
    if [ -e "/usr/local/ispconfig/server/conf-custom/scripts/letsencrypt_renew_hook.sh" ] ; then
    . /usr/local/ispconfig/server/conf-custom/scripts/letsencrypt_renew_hook.sh && exit 0 || exit 1;
    fi
    
    into
    Code:
    if [ -e "/usr/local/ispconfig/server/conf-custom/scripts/letsencrypt_renew_hook.sh" ] ; then
    . /usr/local/ispconfig/server/conf-custom/scripts/letsencrypt_renew_hook.sh || exit 1;
    fi
    
    e.g. remove 'exit 0'

    I would also propose to move that line from the beginning of the script to the end.

    What do you think ?
     
  2. francoisPE

    francoisPE Member HowtoForge Supporter

    Another possibility would be to keep code as is, and add at the very end of script : ispconfig3/server/scripts/letsencrypt_renew_hook.sh
    Code:
    if [ -e "/usr/local/ispconfig/server/conf-custom/scripts/letsencrypt_renew_hook_add.sh" ] ; then
    . /usr/local/ispconfig/server/conf-custom/scripts/letsencrypt_renew_hook_add.sh;
    fi
    
     
  3. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    The pre and post hooks already handle this, it would be simple to have the renew hook use the same logic.
     
  4. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

  5. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Not really. It is just a script. The ones that you should worry are templates.

    Good improvement.
     
  6. francoisPE

    francoisPE Member HowtoForge Supporter

    @Jesse Norell Many thanks !
    You know Lucky Luke ? Are you same family ;):)
     

Share This Page