firejail : only let a program access localhost

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have this local network service and this client program needing to access it. I am running them both as an unprivileged user.



I am looking for a way to sandbox the client using firejail, in a way that it cannot access network, except for localhost (or even better, except for that service).
first thing I tried was of course



firejail --net=lo program


But it didn’t work.



Error: cannot attach to lo device


I think I could work around it by creating a virtual network interface, for example veth0 and veth1,
moving veth1 to a new network namespace in which I’d run the service
and using firejail to restrain the client to veth0



Is there a way to actually automate this setting in a firejail profile, so that all of these interfaces are created and veth1 is moved when I type



firejail server


(without having to run anything as root)?



Or is there a simpler way solve this problem? (I cannot run both the client and the service in the same namespace, because the service needs to access the network)










share|improve this question

























    up vote
    0
    down vote

    favorite












    I have this local network service and this client program needing to access it. I am running them both as an unprivileged user.



    I am looking for a way to sandbox the client using firejail, in a way that it cannot access network, except for localhost (or even better, except for that service).
    first thing I tried was of course



    firejail --net=lo program


    But it didn’t work.



    Error: cannot attach to lo device


    I think I could work around it by creating a virtual network interface, for example veth0 and veth1,
    moving veth1 to a new network namespace in which I’d run the service
    and using firejail to restrain the client to veth0



    Is there a way to actually automate this setting in a firejail profile, so that all of these interfaces are created and veth1 is moved when I type



    firejail server


    (without having to run anything as root)?



    Or is there a simpler way solve this problem? (I cannot run both the client and the service in the same namespace, because the service needs to access the network)










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have this local network service and this client program needing to access it. I am running them both as an unprivileged user.



      I am looking for a way to sandbox the client using firejail, in a way that it cannot access network, except for localhost (or even better, except for that service).
      first thing I tried was of course



      firejail --net=lo program


      But it didn’t work.



      Error: cannot attach to lo device


      I think I could work around it by creating a virtual network interface, for example veth0 and veth1,
      moving veth1 to a new network namespace in which I’d run the service
      and using firejail to restrain the client to veth0



      Is there a way to actually automate this setting in a firejail profile, so that all of these interfaces are created and veth1 is moved when I type



      firejail server


      (without having to run anything as root)?



      Or is there a simpler way solve this problem? (I cannot run both the client and the service in the same namespace, because the service needs to access the network)










      share|improve this question













      I have this local network service and this client program needing to access it. I am running them both as an unprivileged user.



      I am looking for a way to sandbox the client using firejail, in a way that it cannot access network, except for localhost (or even better, except for that service).
      first thing I tried was of course



      firejail --net=lo program


      But it didn’t work.



      Error: cannot attach to lo device


      I think I could work around it by creating a virtual network interface, for example veth0 and veth1,
      moving veth1 to a new network namespace in which I’d run the service
      and using firejail to restrain the client to veth0



      Is there a way to actually automate this setting in a firejail profile, so that all of these interfaces are created and veth1 is moved when I type



      firejail server


      (without having to run anything as root)?



      Or is there a simpler way solve this problem? (I cannot run both the client and the service in the same namespace, because the service needs to access the network)







      networking namespace network-namespaces sandbox firejail






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 17 mins ago









      Nephanth

      52638




      52638

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478131%2ffirejail-only-let-a-program-access-localhost%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478131%2ffirejail-only-let-a-program-access-localhost%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)