+jlogin, group, defaults, more pkgs

This commit is contained in:
2024-11-28 19:34:30 +01:00
parent 8e934e6230
commit f92f2f2fad
5 changed files with 71 additions and 19 deletions

View File

@@ -2,8 +2,8 @@
jail=$1
user=$2
me=`id -u`
jexec="jexec"
me=$(id -u)
jid=""
if test "$jail" = "-h"; then
echo "jlogin [jail] [user]"
@@ -11,11 +11,11 @@ if test "$jail" = "-h"; then
fi
if test -z "$jail"; then
vars=$(jls -n | head -1)
eval $vars
jid=$(jls | head -2 | tail -1 | awk '{print $1}')
jail=$(jls | head -2 | tail -1 | awk '{print $2}')
else
jid=$(jls | grep "$jail" | awk '{print $1}')
fi
jid=""
jid=`jls | grep "$jail" | awk '{print $1}'`
if test -z "$jid"; then
echo "jail $jail doesn't run!"
@@ -26,20 +26,16 @@ shell=/bin/csh
home=/home/$user
term=vt100
path=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
chroot="$j/run/$jail"
jexec=jexec
if test -z "$user"; then
user=root
home=/root
fi
if test -e $chroot/$home/.bashrc; then
shell=/usr/local/bin/bash
fi
if test "$me" != "0"; then
jexec="sudo $jexec"
jexec="sudo jexec"
fi
echo "# Logging into jail $jail with jid $jid #"
env - JAIL=$jail HOME=$home TERM=$term SHELL=$shell PATH=$path $jexec -U $user $jid $shell
env - JAIL="$jail" TERM=$term HOME="$home" SHELL=$shell PATH=$path "$jexec" -U "$user" "$jid" sh

View File

@@ -90,6 +90,14 @@
group: wheel
mode: '0644'
- name: Install jlogin
copy:
src: jlogin
dest: /usr/local/sbin/jlogin
owner: root
group: wheel
mode: '0755'
- name: Symlink knot dig
shell: "ln -sf /usr/local/bin/kdig /usr/local/bin/dig"
args: