1
0
mirror of https://github.com/Xe/furry-happiness synced 2024-12-22 10:47:05 +00:00

first commit

This commit is contained in:
Christine Dodrill 2019-07-06 18:52:09 +00:00
commit c259db2aa5
7 changed files with 1182 additions and 0 deletions

36
Dockerfile Normal file
View File

@ -0,0 +1,36 @@
FROM ubuntu:bionic AS build
COPY uml.config /uml.config
ENV LINUX_VERSION linux-4.19.57
ENV LINUX_DOWNLOAD_URL https://cdn.kernel.org/pub/linux/kernel/v4.x/${LINUX_VERSION}.tar.xz
RUN apt-get update \
&& apt-get -y install build-essential flex bison xz-utils wget ca-certificates bc linux-headers-4.15.0-47-generic \
&& wget ${LINUX_DOWNLOAD_URL} \
&& tar xJf ${LINUX_VERSION}.tar.xz \
&& rm ${LINUX_VERSION}.tar.xz \
&& cd ${LINUX_VERSION} \
&& cp /uml.config .config \
&& make ARCH=um -j10 \
&& mv ./linux / \
&& cd .. \
&& rm -rf ${LINUX_VERSION}
FROM xena/alpine
COPY --from=build /linux /linux
ADD https://xena.greedo.xeserv.us/files/slirp /slirp
# Add Tini
ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /chroot/tini
RUN chmod +x /chroot/tini
# Set up chroot
RUN cd /chroot \
&& wget -O - http://dl-cdn.alpinelinux.org/alpine/v3.10/releases/x86_64/alpine-minirootfs-3.10.0-x86_64.tar.gz | tar xz \
&& chmod +x /linux \
&& chmod +x /slirp
COPY init.sh /chroot/init.sh
COPY resolv.conf /chroot/etc/resolv.conf
COPY runlinux.sh /runlinux.sh
CMD /runlinux.sh

19
LICENSE Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2019 Christine Dodrill <me@christine.website>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

22
README.md Normal file
View File

@ -0,0 +1,22 @@
# furry-happiness
A proof of concept [user mode linux](https://en.wikipedia.org/wiki/User-mode_Linux)
Docker image. This builds a simply configured kernel and sets up an [Alpine Linux](https://alpinelinux.org)
userland for it. It has fully working networking via slirp.
This runs an entire Linux kernel as a userspace process inside a docker container.
Anything you can do as root in a linux kernel, you can do inside this user mode
Linux process. The root inside this user mode Linux kernel has significanly more
power than root outside of the kernel, but it cannot affect the host kernel.
To build:
```
docker build -t xena/docker-uml .
```
To run:
```
docker run --rm -it xena/docker-uml
```

12
init.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
mount -t proc proc proc/
mount -t sysfs sys sys/
ifconfig eth0 10.0.2.14 netmask 255.255.255.240 broadcast 10.0.2.15
route add default gw 10.0.2.2
reset
uname -av
echo "networking set up"
exec /tini /bin/sh

2
resolv.conf Normal file
View File

@ -0,0 +1,2 @@
nameserver 1.1.1.1
nameserver 8.8.8.8

4
runlinux.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
export TMP=/chroot
exec /chroot/tini /linux root=/dev/root rootflags=/chroot rootfstype=hostfs rw mem=128M udb0=alpine-root verbose eth0=slirp,,/slirp init=/init.sh

1087
uml.config Normal file

File diff suppressed because it is too large Load Diff