I don't see that being a secure method unfortunately.Hello,
this is just an idea not sure if its a secure method or not (it can be extended as long as you know bash) :
on Node :
useradd -d console-user
passwd console-user
create file /home/console-user/enter.sh with below content :
#!/bin/bash
exec sudo /usr/sbin/vzctl enter Container-ID
now add root powers to that user to execute vzctl via sudo
visudo
and add
console-user ALL=(ALL) NOPASSWD: /usr/sbin/vzctl
last thing
chmod 755 /home/console-user/enter.sh
usermod -s /home/console-user/enter.sh console-user
now when you login with console-user you will enter to VPS with Container-Id (specified in our enter.sh) as root .
Highest Regards
Mohammed H
Hi there,I don't see that being a secure method unfortunately.
chroot jail may be worth investigating, though there's also lots of issues with it too... :/
The main issue I see is that the user logging in - has permissions to run vzctl as superuser. If there's even the slightest flaw -- they've now got full access to all clients on the node's VPS.Hi there,
I already stated that . but still I didn't find anyway to exploit it till now. the only issue I can think of is if vzctl itself have privilege escalation problem . and that is vendor problem not the mentioned idea problem.
@lbft very true . thanks
Highest Regards
Mohammed H
#!/bin/bash
USERNAME=`whoami`
CTID=`whoami | sed -r 's/^.{4}//'`
CTCONF="/etc/vz/conf/$CTID.conf"
if [ $CTID -gt 100 ] && [ -f "$CTCONF" ]; then
/usr/bin/sudo /usr/bin/openvzenter $CTID
else
echo -e "Invalid VPS."
exit 0
fi
/usr/sbin/vzctl enter $1
adduser -G openvzusers -s /usr/bin/openvz user101
user101:x:511:512::/home/user101:/usr/bin/openvz
%openvzusers ALL = NOPASSWD: /usr/bin/openvzenter