coreos-base/oem-gce: Remove unused files

We now rely on GCP agents taking care of instance configuration.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
This commit is contained in:
Jeremi Piotrowski 2024-04-02 11:23:17 +00:00
parent 1c8b3a5497
commit ebb10a10c8
8 changed files with 0 additions and 126 deletions

View File

@ -1,35 +0,0 @@
#!/usr/bin/bash
# Verify all the config files were not touched by the user. Do not try to
# enable oslogin if the user has messed with them
if [ -e '/etc/pam.d/sshd' ]; then
echo '/etc/pam.d/sshd already exists. Not enabling OS Login'
exit 0
fi
if [ "$(readlink -f /etc/nsswitch.conf)" != '/usr/share/baselayout/nsswitch.conf' ]; then
echo '/etc/nsswitch.conf is not a symlink to /usr/share/baselayout/nsswitch.conf. Not enabling OS Login'
exit 0
fi
if [[ ! -d '/etc/ssh/sshd_config.d' ]]; then
echo 'No /etc/ssh/sshd_config.d directory. Not enabling OS Login'
exit 0
fi
if ! grep --fixed-strings --no-messages --silent 'Include "/etc/ssh/sshd_config.d/*.conf"' '/etc/ssh/sshd_config'; then
echo '/etc/ssh/sshd_config does not include configuration snippets in /etc/ssh/sshd_config.d. Not enabling OS Login'
exit 0
fi
# Actually start enabling things. Die if we fail.
set -e
mkdir -m 0750 -p '/var/lib/google-sudoers.d'
mkdir -m 0750 -p '/var/lib/google-users.d'
ln -f -s '/usr/share/google-oslogin/pam_sshd' '/etc/pam.d/sshd'
ln -f -s '/usr/share/google-oslogin/nsswitch.conf' '/etc/nsswitch.conf'
ln -f -s '/usr/share/google-oslogin/60-flatcar-google-oslogin.conf' '/etc/ssh/sshd_config.d/60-flatcar-google-oslogin.conf'
ln -f -s '/usr/share/google-oslogin/oslogin-sudoers' '/etc/sudoers.d/oslogin-sudoers'
ln -f -s '/usr/share/google-oslogin/group.conf' '/etc/security/group.conf'

View File

@ -1,36 +0,0 @@
#!/bin/bash -ex
# GCE can work with our normal file system, but it needs an "init system".
# Here is a better place to install this script so it doesn't get put in real
# images built from the GCE Python package.
# Write a configuration template if it does not exist.
[ -e /etc/default/instance_configs.cfg.template ] ||
echo -e > /etc/default/instance_configs.cfg.template \
'[InstanceSetup]\nset_host_keys = false'
# Run the initialization scripts.
/usr/bin/google_instance_setup
/usr/bin/google_metadata_script_runner --script-type startup
# Handle the signal to shut down this service.
trap 'stopping=1 ; kill "${daemon_pids[@]}" || :' SIGTERM
# Fork the daemon processes.
daemon_pids=()
for d in accounts clock_skew network
do
/usr/bin/google_${d}_daemon & daemon_pids+=($!)
done
# Notify the host that everything is running.
NOTIFY_SOCKET=/run/systemd/notify /usr/bin/systemd-notify --ready
# Pause while the daemons are running, and stop them all when one dies.
wait -n "${daemon_pids[@]}" || :
kill "${daemon_pids[@]}" || :
# If a daemon died while we're not shutting down, fail.
test -n "$stopping" || exit 1
# Otherwise, run the shutdown script before quitting.
exec /usr/bin/google_metadata_script_runner --script-type shutdown

View File

@ -1,5 +0,0 @@
#!/bin/sh
alias gcloud="(docker images google/cloud-sdk || docker pull google/cloud-sdk) > /dev/null;docker run -ti --rm --net=host -v $HOME/.config:/root/.config -v /var/run/docker.sock:/var/run/docker.sock google/cloud-sdk gcloud"
alias gsutil="(docker images google/cloud-sdk || docker pull google/cloud-sdk) > /dev/null;docker run -ti --rm --net=host -v $HOME/.config:/root/.config google/cloud-sdk gsutil"
alias python="(docker images python:2-slim || docker pull python:2-slim) > /dev/null;docker run -ti --rm --net=host -v $HOME/.config:/root/.config -v "$PWD":/usr/src/pyapp -w /usr/src/pyapp python:2-slim python"
alias python3="(docker images python:3-slim || docker pull python:3-slim) > /dev/null;docker run -ti --rm --net=host -v $HOME/.config:/root/.config -v "$PWD":/usr/src/pyapp -w /usr/src/pyapp python:3-slim python"

View File

@ -1,2 +0,0 @@
169.254.169.254 metadata metadata.google.internal
127.0.0.1 localhost

View File

@ -1,2 +0,0 @@
[Unit]
Upholds=oem-gce-enable-oslogin.service setup-oem.service oem-gce.service

View File

@ -1,16 +0,0 @@
[Unit]
Description=Enable GCE OS Login
ConditionFirstBoot=true
DefaultDependencies=false
After=systemd-tmpfiles-setup.service
Before=sshd.service
Before=sshd.socket
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/bin/enable-oslogin
[Install]
WantedBy=sysinit.target

View File

@ -1,18 +0,0 @@
[Unit]
Description=GCE Linux Agent
After=local-fs.target network-online.target
[Service]
Type=notify
NotifyAccess=all
Restart=always
RestartSec=5
# There is a custom main process that kills all of the contained services.
KillMode=process
KillSignal=SIGTERM
ExecStart=/usr/bin/init.sh
[Install]
WantedBy=multi-user.target

View File

@ -1,12 +0,0 @@
[Unit]
Description=Setup OEM
Before=oem-gce-enable-oslogin.service
DefaultDependencies=false
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/bin/ln --symbolic --force /usr/share/gce/hosts /etc/hosts
ExecStart=-/usr/bin/ln --symbolic /usr/share/gce/google-cloud-sdk.sh /etc/profile.d/google-cloud-sdk.sh
[Install]
WantedBy=sysinit.target