LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-27-2017, 06:05 PM   #1
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Rep: Reputation: Disabled
libvirt + lxc = root shell


Hi,

I have to really start looking into hardening my libvirt install.

Out of curiosity (which is bad thing on its own ;-)) I created LXC connection using virt-manager.
Then I chose to run in application sandbox mode, using /bin/bash.
Then I started the container.
Then I could happily browse my filesystem as root.
All of this from my regular user account.

Everyday something new ;-)

--
Best regards,
Andrzej Telszewski
 
Old 01-28-2017, 01:11 AM   #2
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,097

Rep: Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174
Hi Andrzej,

you are connecting via virt-manager to libvirtd, a service that has already root privileges, and to which connection is allowed to users belonging to the "users" group just for simplicity of use: maybe you missed it but this is noted also in libvirt's README.

if you prefer you can create another dedicated non-privileged group and rebuild (can be easier that editing config files) libvirt (and maybe qemu too) passing that parameter noted in the README, but that still won't stop the user that you will put in that group to have the possibility to obtain root shells on the host in a cgroup and a namespace managed by lxc as it's the intended behaviour: that or you administer your libvirt only as root.

Last edited by ponce; 01-28-2017 at 01:55 AM.
 
Old 01-28-2017, 05:40 AM   #3
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Original Poster
Rep: Reputation: Disabled
Hi,

I'm aware of the problem, I just need more motivation to work it out ;-)
Sometime ago I was reading about permissions in the libvirt world and it offers some more interesting possibilities.

I'm already using separate group for libvirt and QEMU for some time.
I'm also running QEMU in qemu://session mode rather than in qemu://system one.

Actually, I need the system libvirtd daemon to provide networking only.
Thanks to session mode, QEMU is run more like VirtualBox, i.e. everything is located in regular user home directory and all the processes (including libvirtd) are run as regular user. I believe that is everything many of us need.

Quote:
Originally Posted by ponce
for simplicity of use
If I work out some solution, I will be pushing for changing the defaults.
Recently I read about MongoDB defaults.
They allowed for ease of use and for thousand of databases to be stolen.

I'm not writing to blame anybody, but once I find a solution, I will ;-)

--
Best regards,
Andrzej Telszewski
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot login as root using Libvirt sunveer Linux - Virtualization and Cloud 0 10-01-2015 06:45 PM
libvirt / kvm without root-permissions tux111 Linux - Virtualization and Cloud 3 10-12-2013 10:12 PM
How to run a shell script as root (when user is not root) taylorkh Linux - Newbie 10 09-12-2008 06:05 PM
How to run root privileged Linux command as normal user via shell shell tcegrid Linux - Newbie 1 06-23-2008 03:38 PM
root has no shell how do i get out of this evzen Linux - Software 2 05-10-2006 09:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:21 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