2021-02-08 19:16:19 +01:00
|
|
|
HARDENED = $(CHROOT)/var/tmp/hardened
|
|
|
|
PAM_SSH_AGENT_AUTH = $(CHROOT)/var/tmp/pam_ssh_agent_auth
|
|
|
|
ADMINUSER = $(CHROOT)/var/tmp/adminuser
|
|
|
|
timesyncd_conf = $(CHROOT)/etc/systemd/timesyncd.conf
|
2021-05-22 19:53:34 +02:00
|
|
|
01firstboot = $(CHROOT)/usr/local/bin/01firstboot.start
|
2021-02-08 19:16:19 +01:00
|
|
|
network_example = $(CHROOT)/00-eth0.network.example
|
|
|
|
tmux_conf = $(CHROOT)//root/.tmux.conf
|
|
|
|
|
|
|
|
$(HARDENED):
|
|
|
|
mkdir -p $(CHROOT)/etc/portage/profile
|
|
|
|
echo "-hardened" >> $(CHROOT)/etc/portage/profile/use.mask
|
|
|
|
RUN $(EMERGE) $(USEPKG) --oneshot gcc
|
|
|
|
RUN $(EMERGE) $(USEPKG) --oneshot binutils virtual/libc
|
2021-05-22 19:53:34 +02:00
|
|
|
RUN $(EMERGE) --depclean --with-bdeps=n
|
2021-02-08 19:16:19 +01:00
|
|
|
-$(gcc_config)
|
|
|
|
RUN $(EMERGE) $(USEPKG) --emptytree @world
|
2021-05-22 19:53:34 +02:00
|
|
|
RUN $(EMERGE) --depclean --with-bdeps=n
|
2021-02-08 19:16:19 +01:00
|
|
|
RUN bash -c 'yes YES | etc-update --automode -9'
|
2022-01-19 12:03:55 +01:00
|
|
|
##ifneq ($(EXTERNAL_KERNEL),YES)
|
|
|
|
## if ! grep -q "$(shell /usr/bin/gcc --version | grep gcc)" "$(shell cat $(KERNEL_PATH))/.config"; then \
|
|
|
|
## RUN $(EMERGE) $(USEPKG) --onlydeps --oneshot --noreplace sys-kernel/$(KERNEL_PKG); \
|
|
|
|
## RUN make -C /usr/src/linux MAKEOPTS=$(MAKEOPTS) clean oldconfig modules_prepare; \
|
|
|
|
## fi
|
|
|
|
##endif
|
2021-02-08 19:16:19 +01:00
|
|
|
touch $(HARDENED)
|
|
|
|
|
|
|
|
$(timesyncd_conf): default/timesyncd.conf
|
|
|
|
cp $< $@
|
|
|
|
|
2021-05-22 19:53:34 +02:00
|
|
|
$(01firstboot): default/01firstboot.start default/bashrc.firstboot
|
|
|
|
mkdir -p $(CHROOT)/usr/local/bin
|
2021-02-08 19:16:19 +01:00
|
|
|
cp $< $@
|
2021-05-22 19:53:34 +02:00
|
|
|
cat default/bashrc.firstboot >> $(CHROOT)/home/admin/.bashrc
|
2021-02-08 19:16:19 +01:00
|
|
|
touch $(CHROOT)/01firstboot
|
|
|
|
|
|
|
|
$(network_example): default/00-eth0.network
|
|
|
|
cp $< $@
|
|
|
|
|
|
|
|
$(tmux_conf): default/tmux.conf
|
|
|
|
RUN systemctl enable tmux@root.service
|
|
|
|
cp $< $@
|
|
|
|
|
|
|
|
$(PAM_SSH_AGENT_AUTH):
|
|
|
|
sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' $(CHROOT)/etc/sudoers
|
|
|
|
sed -i 's#^auth.*$$#auth sufficient pam_ssh_agent_auth.so file=~/.ssh/authorized_keys\nauth required pam_env.so readenv=1 user_readenv=0\nsession required pam_env.so readenv=1 user_readenv=0\nauth substack system-auth#' $(CHROOT)/etc/pam.d/sudo
|
|
|
|
sed -i 's#^auth.*$$#auth sufficient pam_ssh_agent_auth.so file=~/.ssh/authorized_keys\nauth required pam_env.so readenv=1 user_readenv=0\nsession required pam_env.so readenv=1 user_readenv=0\nauth substack system-auth#' $(CHROOT)/etc/pam.d/sudo-i
|
|
|
|
echo "Defaults env_keep += SSH_AUTH_SOCK" > $(CHROOT)/etc/sudoers.d/ssh_auth_sock
|
|
|
|
touch $(PAM_SSH_AGENT_AUTH)
|
|
|
|
|
|
|
|
$(ADMINUSER):
|
2021-03-16 19:20:27 +01:00
|
|
|
-RUN useradd -m -G users,wheel -s /bin/bash --comment="virtual appliance admin" --uid 2000 admin
|
2021-02-08 19:16:19 +01:00
|
|
|
RUN passwd -d admin; $(inroot) passwd -e admin
|
|
|
|
touch $(ADMINUSER)
|
|
|
|
|
|
|
|
preinstall: $(HARDENED)
|
|
|
|
|
2021-05-22 19:53:34 +02:00
|
|
|
postinstall: $(PAM_SSH_AGENT_AUTH) $(ADMINUSER) $(timesyncd_conf) $(01firstboot) $(network_example) $(tmux_conf)
|