LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Containers
User Name
Password
Linux - Containers This forum is for the discussion of all topics relating to Linux containers. Docker, LXC, LXD, runC, containerd, CoreOS, Kubernetes, Mesos, rkt, and all other Linux container platforms are welcome.

Notices


Reply
  Search this Thread
Old 02-14-2018, 07:29 AM   #16
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939

To my way of thinking, containers are – as I said – an illusion that's especially intended to isolate processes on the inside of the container from correctly perceiving the world outside of it. (And, to prevent them from consuming more than their allotted share of resources.) But, I think, you trust these processes not to be malicious. They're in a container, and they're not trying to get out.

Since the whole thing is basically a bunch of kernel configuration parameters, with a certain group of processes running with that same set of parameters (that "container") in effect, there is really no overhead. And that's the point. Although virtual machines also rely upon hardware assistance, there's a lot more overhead associated with them. If you don't actually need what only a VM can do, containers are a compelling alternative that can serve ordinary isolation requirements very efficiently.

The fact that they are "ordinary processes running directly on a Linux kernel," even though they're wearing funny glasses and a straitjacket, can also work to your advantage because they can be more easily interacted with from the outside.

Last edited by sundialsvcs; 02-14-2018 at 07:32 AM.
 
1 members found this post helpful.
Old 02-14-2018, 09:32 AM   #17
Rosika
Member
 
Registered: Apr 2017
Distribution: Lubuntu 64 bit
Posts: 280

Original Poster
Rep: Reputation: Disabled
Hi sundialsvcs,

Quote:
But, I think, you trust these processes not to be malicious. They're in a container, and they're not trying to get out
So "trusted" processes (= "normal" ones which I also had no problem in running outside a container or sandbox) are O.K.
Thus better not try running any funny things in containers. I understand.
But (only theoretically): would running them in VMs or firejail provide a higher degree of protection for the host?

Rosika
 
Old 02-14-2018, 11:24 AM   #18
simosx
Member
 
Registered: Jul 2005
Posts: 66

Rep: Reputation: 11
Quote:
Originally Posted by Rosika View Post
So "trusted" processes (= "normal" ones which I also had no problem in running outside a container or sandbox) are O.K.
Thus better not try running any funny things in containers. I understand.
But (only theoretically): would running them in VMs or firejail provide a higher degree of protection for the host?
You may want to run even "trusted" processes in an LXD container, so that they do not mess up with your host (adding repositories, packages and dependencies).
For example, if there is a Nodejs app that you need to run, better put it in a container. Then, you can remove the container and any trace of it is gone.
See, for example, https://blog.simos.info/how-to-insta...lxd-container/

Between LXD and firejail, the latter needs from you to make the correct configuration (profile).
If you make the configuration very restrictive, the process may crash. If you relax the security, it may be too open and miss required restrictions.
There are no known vulnerabilities in the default configuration of LXD. If something appears down the line, it will get fixed quickly.
 
1 members found this post helpful.
Old 02-14-2018, 12:05 PM   #19
Rosika
Member
 
Registered: Apr 2017
Distribution: Lubuntu 64 bit
Posts: 280

Original Poster
Rep: Reputation: Disabled
Hi simosx,

tnx again.
Your link makes for interesting reading. Thereīs still much for me to learn....
Quote:
Between LXD and firejail, the latter needs from you to make the correct configuration (profile).
Yes, thatīs often a bit of a hassle.
Iīve been using firejail for quite a while now and have learned the hard way that itīs not always working the desired way.

I do not want to be misunderstood: For most applications it works just fine. And there are a lot of profiles (https://github.com/netblue30/firejail/tree/master/etc).
Yet thereīs still a vmplayer.profile missing (though thereīs one for VirtualBox). And I havenīt succeeded in creating the correct configuration for it yet.
So your point is very valid.

Greetings.
Rosika
 
Old 02-14-2018, 01:28 PM   #20
simosx
Member
 
Registered: Jul 2005
Posts: 66

Rep: Reputation: 11
Hi Rosika,

Let's add a bit more. I hope the discussion remains interesting.
Apart from LXD and firejail, there are also the snap packages that are based on Linux security features.
I would say that firejail is closer to snap packages than to LXD.

With snap packages, an application is described in a configuration file called snapcraft.yaml, and then it is built (from source) into a snap package.
Then, you may upload this snap package to the Ubuntu Store so anyone can make use of it. Snap packages are supported in many major distributions.

Here is the firejail configuration for darktable, https://github.com/netblue30/firejai...ktable.profile
Here is the snapcraft.yaml configuration for darktable, https://github.com/kyrofa/darktable-...snapcraft.yaml
My quick viewing shows me that these are almost equivalent. To make a proper comparison, compare to the plugs section in snapcraft.yaml (which interfaces are allowed).

To install darktable as a snap, you would run

Code:
snap install darktable
 
Old 02-15-2018, 08:06 AM   #21
Rosika
Member
 
Registered: Apr 2017
Distribution: Lubuntu 64 bit
Posts: 280

Original Poster
Rep: Reputation: Disabled
Hi simosx,

Quote:
I hope the discussion remains interesting.
It sure does. Tnx a lot for that.
Iīve heard about snap. Yet itīs not installed by default on my Lubuntu. So it was never really on my mind.
The only thing I knew was that itīs some kind of packet format in order to be used alongside the normal packet management.
What I didnīt know is that it has security mechanisms implemented. So Iīll look into that. Yor links are helpful.

My interest in container-technology stems from the fact that I wanted to get teamviewer running in a sandbox (firejail).
Up and until now it is the only programm that I use that doesnīt work within firejail.
So Iī m looking for alternatives to get teamviewer going in a secure environment. And thus containers came to my mind.

Greetings.
Rosika

P.S.:
If you are interested why teamviewer doesnīt work within firejail:

Terminal-output:
Code:
rosika@rosika-Lenovo-H520e ~> firejail teamviewer
Reading profile /etc/firejail/default.profile
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-passwdmgr.inc
Reading profile /etc/firejail/disable-programs.inc

** Note: you can use --noprofile to disable default.profile **

Parent pid 10157, child pid 10158
Child process initialized in 6984.77 ms

Init...
XRandRWait: No value set. Using default.
XRandRWait: Started by user.
Checking setup...
Launching TeamViewer ...
Starting network process (no daemon)
terminate called without an active exception
/opt/teamviewer/tv_bin/script/tvw_exec: Zeile 95:   116 Abgebrochen             "$TV_BIN_DIR/teamviewerd" -n -f
Network process already started (or error)
Launching TeamViewer GUI ...

Parent is shutting down, bye...
Team-viewer itself presents a GUI-based text message:
Quote:
"teamviewer daemon not running.
Please start daemon before using TeamViewer (needs root):
----------teamviewer --daemon start ----------
[...]"
This known problem is discussed on https://github.com/netblue30/firejail/issues/825.
But no solution so far.
 
Old 02-15-2018, 12:25 PM   #22
simosx
Member
 
Registered: Jul 2005
Posts: 66

Rep: Reputation: 11
Hi Rosika,

I tried as well to get Teamviewer in a LXD container according to the guide at
https://blog.simos.info/how-to-run-g...buntu-desktop/
It did not work in the beginning but now it almost works.
It works locally only and cannot get a connection to the Teamviewer servers. I am mystified as to why it
cannot connect with the Teamviewer servers even if the LXD container has Internet connectivity.
I assume Teamviewer carries lots of baggage that makes it behave weirdly on non-standard systems.

Here is how it works in a LXD container.

1. Set up a LXD container according to
https://blog.simos.info/how-to-run-g...buntu-desktop/

2. Connect to the LXD container with

Code:
$ lxc console guiapps
It has to be through a LXD console for some reason. Otherwise it gives weird errors.

3. Run teamviewer

Code:
ubuntu@guiapps:~$ teamviewer 

Init...
CheckCPU: SSE2 support: yes
Checking setup...
Launching TeamViewer ...
Launching TeamViewer GUI ...
ubuntu@guiapps:~$ teamviewer 

Init...
CheckCPU: SSE2 support: yes
Checking setup...
Launching TeamViewer ...
Launching TeamViewer GUI ...


I did not try all other network connectivity options (use proxy, etc).

On another note, I put online an index of my LXD tutorials,
https://discuss.linuxcontainers.org/...-of-simos/1228
 
Old 02-17-2018, 08:21 AM   #23
Rosika
Member
 
Registered: Apr 2017
Distribution: Lubuntu 64 bit
Posts: 280

Original Poster
Rep: Reputation: Disabled
Hi Simos,

thanks for your reply.
I couldnīt answer yesterday because the linuxquestions-server was down for a while.

O.K., Iīll do the following:
Accordning to your guide for runnng GUI-apps in LCD-containers Iīm going to try to get team-viewer running.
But I doubt that Iīll be more successful than you. Because... why should I? Youīre the professional here.
But as I said Iīll give it try.
As soon as I have (or havenīt any) results Iīll post them here.

Thanks also for the index of your LXD-tutorials. Very impressive.

Greetings.
Rosika
 
Old 02-19-2018, 02:31 PM   #24
simosx
Member
 
Registered: Jul 2005
Posts: 66

Rep: Reputation: 11
Quote:
Originally Posted by Rosika View Post
O.K., Iīll do the following:
Accordning to your guide for runnng GUI-apps in LCD-containers Iīm going to try to get team-viewer running.
But I doubt that Iīll be more successful than you. Because... why should I? Youīre the professional here.
But as I said Iīll give it try.
As soon as I have (or havenīt any) results Iīll post them here.
Hi Rosika,

I gave it a try again and I have come up to the following:
TeamViewer works in Linux over LXD, as long as you do not use the latest Teamviewer 13.
TeamViewer 13 is based on Qt, and is a departure from the older versions that use Wine.
Using Qt by itself should not be an issue.

I did the easy task and tried out TeamViewer versions 10, 11 and 12. All from https://www.teamviewer.com/en/downlo...ious-versions/
And they just worked. I simply got the TAR files, extracted them and ran TeamViewer.

I hope I can figure out why TeamViewer 13 does not work on LXD.

edit: here is a guide, https://blog.simos.info/how-to-run-teamviewer-in-lxd/

Last edited by simosx; 02-19-2018 at 06:29 PM. Reason: Added link to guide on how to run TeamViewer in LXD
 
Old 02-19-2018, 06:22 PM   #25
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
At the moment, the only thing I associate with "trusted container" is the question of whether-or-not the container occupant, when it attempts to "become 'root,'" actually does so on the host machine.

And, as far as I'm concerned, no container should ever be so "trusted." A containerized process should live in its own happy, isolated, world, and should be in every way confined to it. If something needs to be done "to" the actual host environment, IMHO it should only be done "in" that environment.
 
Old 02-22-2018, 08:16 AM   #26
Rosika
Member
 
Registered: Apr 2017
Distribution: Lubuntu 64 bit
Posts: 280

Original Poster
Rep: Reputation: Disabled
Hi simosx,

tnx a lot for your reply. Sorry for the belated answer.

Alas I couldnīt get teamviewer running.
I proceeded as follows:

According to your very well-written guide I got my lxd-container running. I also named it "guiapps". That went well.
Then I installed teamviewer. Yet it was version 13. After reading your latest post I uninstalled it and got the "v11.0.67687"-version from https://www.teamviewer.com/en/downlo...ious-versions/.
That as o.k. as well. But as with version 13 I get an error-message when trying to start it:
ubuntu@guiapps:~/alte_version_teamviewer/teamviewer$ ./teamviewer
Quote:
Init...
*** TeamViewer can not be executed with sudo! ***
Either use your normal user account without sudo
or use a the real root account to log in to your desktop (not recommended!).

chown: changing ownership of '/home/ubuntu/alte_version_teamviewer/teamviewer/logfiles/startup.log': Op
eration not permitted
I logged in my container by using the command lxc exec guiapps -- sudo --login --user ubuntu, as you recommended in your tutorial.
Yet Iīm not quite sure as to what the "sudo"-command does. Am I logged in with sudo? Might that be the cause of denial?

Quote:
lxc console guiapps
doesnīt work with me. I get the error:
Quote:
error: unknown command: console
Itīs a bit of a shame that I cannot get teamviewer running. Could you suggest some way to get this done?

Greetings.
Rosika
 
Old 02-22-2018, 08:22 AM   #27
Rosika
Member
 
Registered: Apr 2017
Distribution: Lubuntu 64 bit
Posts: 280

Original Poster
Rep: Reputation: Disabled
Hi sundialsvcs,

tnx for your comment.
Quote:
A containerized process should live in its own happy, isolated, world, and should be in every way confined to it.
Thatīs a valid point.
So the thing is: How could one prevent processes within the container to become "root"?
If I understand you correctly containerization wouldnīt be the way to go for running untrusted proccesses in an isolated environment.

Greetings.
Rosika
 
Old 02-22-2018, 08:29 AM   #28
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,837

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
sudo --login --user ubuntu
means: set user as ubuntu, simulate a login. So finally when you start the container it will look like the user ubuntu logged in.
The container initially started as root.
 
Old 02-22-2018, 08:55 AM   #29
Rosika
Member
 
Registered: Apr 2017
Distribution: Lubuntu 64 bit
Posts: 280

Original Poster
Rep: Reputation: Disabled
Hi pan64,

tnx for the explanation.
Quote:
[...] it will look like the user ubuntu logged in.
O.K., I understand.
But if the user ubuntu is logged in that means "normal user", right?
So I fail to understand why I get
Quote:
*** TeamViewer can not be executed with sudo! ***
Either use your normal user account without sudo
or use a the real root account to log in to your desktop (not recommended!).
when trying to start teamviewer.

Greetings.
Rosika
 
Old 02-22-2018, 09:24 AM   #30
simosx
Member
 
Registered: Jul 2005
Posts: 66

Rep: Reputation: 11
Quote:
Originally Posted by Rosika View Post
I logged in my container by using the command lxc exec guiapps -- sudo --login --user ubuntu, as you recommended in your tutorial.
Yet Iīm not quite sure as to what the "sudo"-command does. Am I logged in with sudo? Might that be the cause of denial?


doesnīt work with me. I get the error:

Itīs a bit of a shame that I cannot get teamviewer running. Could you suggest some way to get this done?
Hi Rosika,

Thanks for going through the tutorial!

I tried to get TeamViewer to work with LXD several times before (those times were unsuccessful).
During the tests, I have come up with the opinion that the source of TeamViewer contains a lot of legacy code that makes it behave weirdly.
One of those weird behaviors is exactly the example you are giving. Other weird behaviors were complaining that world-readable files were not readable.

As I write in https://blog.simos.info/how-to-run-teamviewer-in-lxd/ there are three common ways to connect to your LXD container,
  1. lxc console guiapps
  2. ssh ubuntu@10.xx.xx.xx
  3. lxc exec guiapps -- sudo --user ubuntu --login

TeamViewer is so weird that lxc exec is not good enough to run it. You must use lxc console instead.

lxc console is a new command to LXD, therefore if you have Ubuntu 16.04 you would get a somewhat older (but fully supported until 2021) version of LXD.
There are two ways to upgrade to the latest LXD,

One way is to install the snap version of LXD according to the instructions at https://blog.simos.info/how-to-migra...-snap-package/

The other way is to install LXD from the backports repository. To do so, enable the backports repository in Software & Updates (software-properties-gtk). Click to tick the highlighted line that says xenial-backports.

and then run
Code:
sudo apt install lxd=2.21-0ubuntu3~17.10.1 lxd-client=2.21-0ubuntu3~17.10.1
This should get you LXD 2.21 which is recent enough for lxc console.

Last edited by simosx; 02-22-2018 at 09:24 AM. Reason: typo
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: A history of low-level Linux container runtimes LXer Syndicated Linux News 0 01-31-2018 10:27 PM
linux container host os and container os question jzoudavy Linux - Newbie 1 09-01-2015 05:21 AM
LXer: Linux Namespaces: Powerful Isolation & OS Level Virtualization LXer Syndicated Linux News 0 11-23-2014 09:12 PM
Question about Linux level 1/Level 2 jobs inara72 Linux - Newbie 2 04-09-2008 08:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Containers

All times are GMT -5. The time now is 08:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration