Compare commits

...

5 Commits

7 changed files with 158 additions and 0 deletions

View File

@ -5,6 +5,9 @@
# ---- Setup Variables ---- #
# Root filesystem path
ROOT="${CHROOT_PTH}"
# Resolution of Xephyr... ex: 1920x1080 or 1600x900, etc
RESOLUTION="1920x1080"

View File

@ -5,6 +5,8 @@
## WEBSITES
Window Managers :
http://xwinman.org/
# Python Tiling WM
http://docs.qtile.org/en/latest/index.html
Source List Generator :
https://repogen.simplylinux.ch/index.php
Themes :
@ -209,3 +211,7 @@ sudo mkisofs -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-
OPTION 2::
## Hasn't worked for me....
sudo mkisofs -r -no-emul-boot -boot-load-size 4 -o ../ubu-mini.iso -b isolinux/isolinux.bin -c isolinux/boot.cat ./
Alternate?:
sudo genisoimage -l -r -J -V "Sol-OS" -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -c isolinux/boot.cat -o ../Sol-OSv3.iso ./

View File

@ -0,0 +1,59 @@
#!/bin/bash
#more info here http://www.cyberciti.biz/faq/debian-ubuntu-restricting-ssh-user-session-to-a-directory-chrooted-jail/
fs="$PWD/jail"
echo "Creating ${fs}..."
mkdir -p ${fs}/{etc,usr/{bin,lib},bin,lib}/
mkdir -p $fs/dev/
mknod -m 666 $fs/dev/null c 1 3
mknod -m 666 $fs/dev/tty c 5 0
mknod -m 666 $fs/dev/zero c 1 5
mknod -m 666 $fs/dev/random c 1 8
cp -v /lib/ld-linux.so.2 $fs/lib/
chown root:root $fs
chmod 0755 $fs
wget "http://www.busybox.net/downloads/binaries/latest/busybox-i686" -O ${fs}/bin/busybox
chmod +x ${fs}/bin/busybox
cd ${fs}/bin
./busybox --help | \
sed -e '1,/^Currently defined functions:/d' \
-e 's/[ \t]//g' -e 's/,$//' -e 's/,/\n/g' | \
while read app ; do
if [ "$app" != "" ]; then
printf "linking %-12s ...\n" "$app"
ln -sf "./busybox" "$app"
ls -ld "$app"
fi
done
echo "nameserver 8.8.8.8" > $fs/etc/resolv.conf
echo "search 8.8.8.8" >> $fs/etc/resolv.conf
#add nmap
cp -v /usr/bin/nmap $fs/usr/bin/nmap_real
#create unprivileged nmap script
cat << EOF > $fs/usr/bin/nmap
#!/bin/sh
nmap_real --unprivileged \$*
EOF
chmod +x $fs/usr/bin/nmap
mkdir -p $fs/{usr/share/nmap/,etc/services}
#cp -vr /usr/share/nmap $fs/usr/share/nmap/
ldd /usr/bin/nmap|while read line;
do
echo "$line"|\
awk '{print $3}'
done|grep lib|while read line;
do
cp -v "$line" $fs/usr/lib/;
done
clear
echo "welcome to your chroot!"
chroot $fs sh

2
src/NOTES/Notes.txt Normal file
View File

@ -0,0 +1,2 @@
# Note: Very good breakdown of an LFS setup. His directory script is interesting too. Just a good source all around.
https://www.youtube.com/watch?v=IXA0GNTLf_Q&list=PLHh55M_Kq4OAPznDEcgnkQsbjgvG-QFBR

81
src/mkroot.sh Normal file
View File

@ -0,0 +1,81 @@
#!/bin/bash
. CONFIG.sh
# set -o xtrace ## To debug scripts
# set -o errexit ## To exit on error
# set -o errunset ## To exit if a variable is referenced but not set
function create_file_init_and_configs() {
# Toy init system to look over eventually.
#
# cat > "$ROOT"/init << 'EOF' &&
# #!/bin/sh
# export HOME=/home
# export PATH=/bin:/sbin
# mountpoint -q proc || mount -t proc proc proc
# mountpoint -q sys || mount -t sysfs sys sys
# if ! mountpoint -q dev
# then
# mount -t devtmpfs dev dev || mdev -s
# mkdir -p dev/pts
# mountpoint -q dev/pts || mount -t devpts dev/pts dev/pts
# fi
# if [ $$ -eq 1 ]
# then
# # Don't allow deferred initialization to crap messages over the shell prompt
# echo 3 3 > /proc/sys/kernel/printk
# # Setup networking for QEMU (needs /proc)
# ifconfig eth0 10.0.2.15
# route add default gw 10.0.2.2
# [ "$(date +%s)" -lt 1000 ] && rdate 10.0.2.2 # or time-b.nist.gov
# [ "$(date +%s)" -lt 10000000 ] && ntpd -nq -p north-america.pool.ntp.org
# [ -z "$CONSOLE" ] &&
# CONSOLE="$(sed -rn 's@(.* |^)console=(/dev/)*([[:alnum:]]*).*@\3@p' /proc/cmdline)"
# [ -z "$HANDOFF" ] && HANDOFF=/bin/sh && echo Type exit when done.
# [ -z "$CONSOLE" ] && CONSOLE=console
# exec /sbin/oneit -c /dev/"$CONSOLE" $HANDOFF
# else
# /bin/sh
# umount /dev/pts /dev /sys /proc
# fi
# EOF
# chmod +x "$ROOT"/init &&
cat > "$ROOT"/etc/passwd << 'EOF' &&
root::0:0:root:/root:/bin/sh
guest:x:500:500:guest:/home/guest:/bin/sh
nobody:x:65534:65534:nobody:/proc/self:/dev/null
EOF
cat > "$ROOT"/etc/group << 'EOF' &&
root:x:0:
guest:x:500:
EOF
echo "nameserver 8.8.8.8" > "$ROOT"/etc/resolv.conf || exit 1
}
function create_file_structure() {
rm -rf "${ROOT}" &&
mkdir -p "${ROOT}"/{etc,tmp,proc,sys,dev,home,mnt,root,usr/{bin,sbin,lib},var} &&
chmod a+rwxt "${ROOT}"/tmp &&
ln -s "${ROOT}"/usr/bin "${ROOT}/bin" &&
ln -s "${ROOT}"/usr/sbin "${ROOT}/sbin" &&
ln -s "${ROOT}"/usr/lib "${ROOT}/lib"
}
function main() {
SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"
cd "${SCRIPTPATH}"
echo "Working Dir: " $(pwd)
create_file_structure
create_file_init_and_configs
}
main $@;

View File

@ -89,6 +89,10 @@ function sanity_check() {
"\tapt-get install xserver-xephyr syslinux squashfs-tools genisoimage netpbm syslinux-utils -y"
sleep 2
sudo apt-get install xserver-xephyr syslinux squashfs-tools genisoimage netpbm syslinux-utils -y
# Note: Need to add arch/manjaro linux detection to run compatable commands.
# # cdrkit has 'genisoimage' command
# sudo pacman -Syy syslinux squashfs-tools cdrkit netpbm xorg-server-xephyr
fi
if [[ "${ARCH}" == "" ]] || [[ "${RELEASE}" == "" ]]; then

View File

@ -44,6 +44,9 @@ function move_iso_linux_parts() {
# We will need a kernel and an initrd that was built with the Casper scripts.
# Grab them from the chroot. Use the current version.
# Note that before 9.10, the initrd was in gz not lz format...
# Should look inti makeinitcpio:
# https://wiki.archlinux.org/title/Mkinitcpio
# Is that the same stuff? I'm thinking not but...I r dumb.
echo "If this fails then use what's in chroot/boot/...:"
echo "Copying ${CHROOT_PTH}/boot/vmlinuz-5.4.**-**-generic to image/casper/vmlinuz"
sudo cp "${CHROOT_PTH}"/boot/vmlinuz-5.4.**-**-generic image/casper/vmlinuz