Trying to using jailkit with NVM/Node

Discussion in 'Installation/Configuration' started by AlexisC, Oct 26, 2020.

  1. AlexisC

    AlexisC New Member

    Hello
    I would like to know if someone know how to use jailkit with an environment using NVM ?

    First I tried to jailkit nvm but didn't work. Finnaly I tried to jailkit node installed with NVM but nothing work too

    I tried that in jk_init
    Code:
    [nvm]
    comment = NVM
    executables= /root/.nvm/versions/node/v15.0.1/bin, /root/.nvm/versions/node/v15.0.1/bin
    jk_init -c /etc/jailkit/jk_init.ini -f -k -j /var/www/clients/client1/web1/ nvm
    Return
    And that
    Code:
    [node]
    comment = NodeJS
    executables = /root/.nvm/versions/node/v15.0.1/bin/node, /root/.nvm/versions/node/v15.0.1/bin/npm
    directories = /usr/lib/nodejs
    
    jk_init -c /etc/jailkit/jk_init.ini -f -k -j /var/www/clients/client1/web1/ node
    How can I do please ?
    Thanks for help
     
  2. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    not sure how much help it'll be for you, looks like you manually (using git? ) downloaded nvm to your home folder.

    i just installed node globally as root, using apt install, and added the following to jk_init.ini

    Code:
    [node]
    comment = NodeJS
    executables = /usr/bin/npm, /usr/bin/node, /usr/bin/nodejs, /usr/local/bin/elmi-to-json
    directories = /usr/share/npm, /usr/lib/nodejs, /usr/local/lib/node_modules
    
    which appears to work without any problems.
     
  3. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    3.2 has a [node] jail defined with all paths but /usr/share/npm from that list, I presume that is required? I'll create a MR to add that.
     
  4. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    i can't confirm it is actually required. when i was looking at getting it working in the first place, i just put in stuff i found in google.
    once i got it working i left it alone.... don't really know anything about nodejs/npm myself, so i'm not the best choice for testing removing it from the jailkit and seeing it anything stops working.

    the elmi-to-json isn't normally required though, that was added for a specific site where they were developing a web app with the frontend written in elm, which also happens to be the only thing in /usr/local/lib/node_modules, but i guess that directory is needed as it's the same place it'll load any other additional node-modules to.
     

Share This Page