|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
configure_zsh() {
|
|
|
|
# Stop if zsh is not present
|
|
|
|
if [ ! -x /usr/bin/zsh ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
# Stop if user has opted out of zsh
|
|
|
|
if echo "${LIVE_CONFIG_CMDLINE}" | grep -qs 'nozsh'; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
chsh --shell /usr/bin/zsh kali
|
|
|
|
chsh --shell /usr/bin/zsh root
|
|
|
|
}
|
|
|
|
|
|
|
|
configure_usergroups() {
|
|
|
|
# Ensure those groups exist
|
|
|
|
addgroup --system kaboxer || true
|
|
|
|
addgroup --system wireshark || true
|
|
|
|
|
|
|
|
# adm - read access to log files
|
|
|
|
# dialout - for serial port access
|
|
|
|
# kaboxer - for kaboxer
|
|
|
|
# vboxsf - shared folders for virtualbox guest
|
|
|
|
# wireshark - capture sessions without being root
|
|
|
|
kali_groups="adm dialout kaboxer vboxsf wireshark"
|
|
|
|
|
|
|
|
for grp in $kali_groups; do
|
|
|
|
getent group $grp >/dev/null || continue
|
|
|
|
usermod -a -G $grp kali
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
Configure default terminal according to the kali desktop package installed
This is necessary in case more than one terminal is installed, and they
both have the same alternative priority.
For example, while installing all packages at once, sometimes apt will
resolve a dependency "x-terminal-emulator" to one of the many packages
that provide it, for example "zutty". And then it will also install the
terminal listed in the "kali-desktop-${desktop}" metapackage that is
selected, eg. "qterminal" for "kali-desktop-xfce".
Both zutty and qterminal have a alternative priority of 40 at the
moment, so if zutty gets unpacked first, it will have precendence and be
the default terminal.
It's a long-standing issue. By the past, We tried to make sure that the
default desktop terminal is installed first, by listing it early in the
dependencies of the "kali-desktop-{desktop}" metapackage, and it kind of
works with the debian-installer, but it was hard to make it work (we had
to do some changes in tasksel), and it's still brittle as it relies on
apt's dependency solving, which is apt's internal sauce and might change
(hint, apt will get a new solver soon, cf [1]).
As it turns out, it doesn't work for the live iso, somehow we still get
zutty taking precedence over qterminal, I didn't check why, it probably
has to do with how live-build constructs the apt command-line in order
to install everything.
In any case: I think our approach so far didn't work, so with this
commit, we take another approach: we set the default terminal from the
finish-install script, for both the installer iso and the live iso. That
should solve the issue for good.
[1]: https://blog.jak-linux.org/2024/05/14/solver3/
8 months ago
|
|
|
pkg_installed() {
|
|
|
|
dpkg -s "$1" 2>/dev/null | grep -q "ok installed"
|
|
|
|
}
|
|
|
|
|
|
|
|
configure_terminal() {
|
|
|
|
while read -r desktop terminal; do
|
|
|
|
pkg_installed kali-desktop-$desktop || continue
|
|
|
|
update-alternatives --verbose --set x-terminal-emulator /usr/bin/$terminal || true
|
|
|
|
break
|
|
|
|
done <<END
|
|
|
|
e17 terminology
|
|
|
|
gnome gnome-terminal.wrapper
|
|
|
|
i3 kitty
|
|
|
|
kde konsole
|
|
|
|
lxde lxterminal
|
|
|
|
mate mate-terminal.wrapper
|
|
|
|
xfce qterminal
|
|
|
|
END
|
|
|
|
}
|
|
|
|
|
|
|
|
# Avoid configuring multiple times in case persistence is enabled
|
|
|
|
if [ -e /var/lib/live/config/kali-user-setup ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set "kali" as password for the user kali
|
|
|
|
usermod -p 'AqLUsDitNnTsw' kali
|
|
|
|
|
Configure default terminal according to the kali desktop package installed
This is necessary in case more than one terminal is installed, and they
both have the same alternative priority.
For example, while installing all packages at once, sometimes apt will
resolve a dependency "x-terminal-emulator" to one of the many packages
that provide it, for example "zutty". And then it will also install the
terminal listed in the "kali-desktop-${desktop}" metapackage that is
selected, eg. "qterminal" for "kali-desktop-xfce".
Both zutty and qterminal have a alternative priority of 40 at the
moment, so if zutty gets unpacked first, it will have precendence and be
the default terminal.
It's a long-standing issue. By the past, We tried to make sure that the
default desktop terminal is installed first, by listing it early in the
dependencies of the "kali-desktop-{desktop}" metapackage, and it kind of
works with the debian-installer, but it was hard to make it work (we had
to do some changes in tasksel), and it's still brittle as it relies on
apt's dependency solving, which is apt's internal sauce and might change
(hint, apt will get a new solver soon, cf [1]).
As it turns out, it doesn't work for the live iso, somehow we still get
zutty taking precedence over qterminal, I didn't check why, it probably
has to do with how live-build constructs the apt command-line in order
to install everything.
In any case: I think our approach so far didn't work, so with this
commit, we take another approach: we set the default terminal from the
finish-install script, for both the installer iso and the live iso. That
should solve the issue for good.
[1]: https://blog.jak-linux.org/2024/05/14/solver3/
8 months ago
|
|
|
# Apply various configuration
|
|
|
|
configure_zsh
|
|
|
|
configure_usergroups
|
Configure default terminal according to the kali desktop package installed
This is necessary in case more than one terminal is installed, and they
both have the same alternative priority.
For example, while installing all packages at once, sometimes apt will
resolve a dependency "x-terminal-emulator" to one of the many packages
that provide it, for example "zutty". And then it will also install the
terminal listed in the "kali-desktop-${desktop}" metapackage that is
selected, eg. "qterminal" for "kali-desktop-xfce".
Both zutty and qterminal have a alternative priority of 40 at the
moment, so if zutty gets unpacked first, it will have precendence and be
the default terminal.
It's a long-standing issue. By the past, We tried to make sure that the
default desktop terminal is installed first, by listing it early in the
dependencies of the "kali-desktop-{desktop}" metapackage, and it kind of
works with the debian-installer, but it was hard to make it work (we had
to do some changes in tasksel), and it's still brittle as it relies on
apt's dependency solving, which is apt's internal sauce and might change
(hint, apt will get a new solver soon, cf [1]).
As it turns out, it doesn't work for the live iso, somehow we still get
zutty taking precedence over qterminal, I didn't check why, it probably
has to do with how live-build constructs the apt command-line in order
to install everything.
In any case: I think our approach so far didn't work, so with this
commit, we take another approach: we set the default terminal from the
finish-install script, for both the installer iso and the live iso. That
should solve the issue for good.
[1]: https://blog.jak-linux.org/2024/05/14/solver3/
8 months ago
|
|
|
configure_terminal
|
|
|
|
|
|
|
|
# Remember that this script has been run
|
|
|
|
touch /var/lib/live/config/kali-user-setup
|