Skip to content

Commit d2c97ed

Browse files
committed
app-admin/google-guest-configs: New package for udev rules and scripts
We already have GCE disk rules in coreos-init, but a user has pointed out that the newer NVMe rules are missing. Let's take the rules directly from upstream instead. This is loosely based on the ChromiumOS package of the same name. Signed-off-by: James Le Cuirot <[email protected]>
1 parent c1902b8 commit d2c97ed

File tree

9 files changed

+161
-43
lines changed

9 files changed

+161
-43
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Updated the GCE udev disk rules to include NVMe disks.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DIST google-guest-configs-20251014.00.tar.gz 49030 BLAKE2B 20330b57868814e2e4278a15355d8b8a2d6f065049bbe876f8fa48c70f54f65ed98537c5a6a5603e38967c12fd4953c6d06232d6dae691ae81e0f5111108e9c6 SHA512 0040ca6cc6b18c0cb0afaa2febd1bef61a1a62e6f277ef8c9ed01254194a7802ff19baa99bcb8ba64c96e1113f6686a63a23116aa1c7cd5b6caa787ae4e107fa
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
diff --git a/src/etc/sysctl.d/60-gce-network-security.conf b/src/etc/sysctl.d/60-gce-network-security.conf
2+
index b40085b..d89d87d 100644
3+
--- a/src/etc/sysctl.d/60-gce-network-security.conf
4+
+++ b/src/etc/sysctl.d/60-gce-network-security.conf
5+
@@ -14,45 +14,6 @@
6+
#
7+
# Google-recommended kernel parameters
8+
9+
-# Turn on SYN-flood protections. Starting with 2.6.26, there is no loss
10+
-# of TCP functionality/features under normal conditions. When flood
11+
-# protections kick in under high unanswered-SYN load, the system
12+
-# should remain more stable, with a trade off of some loss of TCP
13+
-# functionality/features (e.g. TCP Window scaling).
14+
-net.ipv4.tcp_syncookies=1
15+
-
16+
-# Ignore source-routed packets
17+
-net.ipv4.conf.all.accept_source_route=0
18+
-net.ipv4.conf.default.accept_source_route=0
19+
-
20+
-# Ignore ICMP redirects from non-GW hosts
21+
-net.ipv4.conf.all.accept_redirects=0
22+
-net.ipv4.conf.default.accept_redirects=0
23+
-net.ipv4.conf.all.secure_redirects=1
24+
-net.ipv4.conf.default.secure_redirects=1
25+
-
26+
-# Don't pass traffic between networks or act as a router
27+
-net.ipv4.ip_forward=0
28+
-net.ipv4.conf.all.send_redirects=0
29+
-net.ipv4.conf.default.send_redirects=0
30+
-
31+
-# Turn on Source Address Verification in all interfaces to
32+
-# prevent some spoofing attacks.
33+
-net.ipv4.conf.all.rp_filter=1
34+
-net.ipv4.conf.default.rp_filter=1
35+
-
36+
-# Ignore ICMP broadcasts to avoid participating in Smurf attacks
37+
-net.ipv4.icmp_echo_ignore_broadcasts=1
38+
-
39+
-# Ignore bad ICMP errors
40+
-net.ipv4.icmp_ignore_bogus_error_responses=1
41+
-
42+
# Log spoofed, source-routed, and redirect packets
43+
net.ipv4.conf.all.log_martians=1
44+
net.ipv4.conf.default.log_martians=1
45+
-
46+
-# Addresses of mmap base, heap, stack and VDSO page are randomized
47+
-kernel.randomize_va_space=2
48+
-
49+
-# Reboot the machine soon after a kernel panic.
50+
-kernel.panic=10
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright 2025 The Flatcar Container Linux Maintainers
2+
# Distributed under the terms of the Apache License 2.0
3+
4+
# IMPORTANT! When bumping, ensure that the Dracut modules do not install files
5+
# that would make runtime changes to systems to other than GCE VMs because the
6+
# initrd is shared between image types. The udev disk rules are currently safe.
7+
8+
EAPI=8
9+
10+
inherit udev
11+
12+
DESCRIPTION="Configuration and scripts to support the Google Compute Engine guest environment"
13+
HOMEPAGE="http://github.com/GoogleCloudPlatform/guest-configs"
14+
SRC_URI="https://github.com/GoogleCloudPlatform/guest-configs/archive/${PV}.tar.gz -> ${P}.tar.gz"
15+
S="${WORKDIR}/guest-configs-${PV}"
16+
17+
LICENSE="Apache-2.0 BSD ZLIB"
18+
SLOT="0"
19+
KEYWORDS="amd64"
20+
21+
RDEPEND="
22+
sys-apps/ethtool
23+
sys-apps/iproute2
24+
sys-apps/nvme-cli
25+
!<app-emulation/google-compute-engine-20190124-r3
26+
"
27+
28+
PATCHES=(
29+
"${FILESDIR}"/${PN}-20211116.00-sysctl.patch
30+
)
31+
32+
src_install() {
33+
exeinto "$(get_udevdir)"
34+
doexe src/lib/udev/google_nvme_id
35+
36+
udev_dorules src/lib/udev/rules.d/65-gce-disk-naming.rules
37+
udev_dorules src/lib/udev/rules.d/75-gce-network.rules
38+
39+
insinto /etc/sysctl.d
40+
doins src/etc/sysctl.d/60-gce-network-security.conf
41+
42+
dobin src/usr/bin/google_set_multiqueue
43+
dobin src/usr/bin/google_optimize_local_ssd
44+
dobin src/usr/bin/gce-nic-naming
45+
46+
insinto /usr/lib/dracut/modules.d
47+
doins -r src/lib/dracut/modules.d/*
48+
}
49+
50+
pkg_postinst() {
51+
udev_reload
52+
}
53+
54+
pkg_postrm() {
55+
udev_reload
56+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
3+
<pkgmetadata>
4+
<upstream>
5+
<remote-id type="github">GoogleCloudPlatform/guest-configs</remote-id>
6+
</upstream>
7+
</pkgmetadata>

sdk_container/src/third_party/coreos-overlay/app-emulation/google-compute-engine/google-compute-engine-20190124-r2.ebuild renamed to sdk_container/src/third_party/coreos-overlay/app-emulation/google-compute-engine/google-compute-engine-20190124-r3.ebuild

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,10 @@ RDEPEND="
2828
sys-apps/iproute2
2929
sys-apps/shadow
3030
"
31+
32+
src_install() {
33+
distutils-r1_src_install
34+
35+
# Newer versions are installed by app-admin/google-guest-configs.
36+
rm -v "${ED}"/usr/bin/google_{optimize_local_ssd,set_multiqueue} || die
37+
}

sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/oem-gce-20180823-r7.ebuild

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (c) 2013 CoreOS, Inc.. All rights reserved.
2+
# Distributed under the terms of the GNU General Public License v2
3+
# Copyright (c) 2020 Kinvolk GmbH. All rights reserved.
4+
# Distributed under the terms of the GNU General Public License v2
5+
6+
EAPI=8
7+
8+
inherit systemd
9+
10+
DESCRIPTION="OEM suite for Google Compute Engine images"
11+
HOMEPAGE="https://cloud.google.com/products/compute-engine/"
12+
S="${WORKDIR}"
13+
14+
LICENSE="Apache-2.0"
15+
SLOT="0"
16+
KEYWORDS="amd64"
17+
18+
RDEPEND="
19+
app-admin/google-guest-configs
20+
app-emulation/google-compute-engine
21+
"
22+
23+
OEM_NAME="Google Compute Engine"
24+
25+
src_install() {
26+
systemd_dounit "${FILESDIR}"/units/{oem-gce,oem-gce-enable-oslogin,setup-oem}.service
27+
systemd_install_dropin multi-user.target "${FILESDIR}"/units/10-oem-gce.conf
28+
systemd_enable_service multi-user.target ntpd.service
29+
30+
dobin "${FILESDIR}"/bin/{enable-oslogin,init.sh}
31+
32+
# These files will be symlinked to /etc via 'setup-oem.service'
33+
insinto /usr/share/gce
34+
doins "${FILESDIR}"/files/{google-cloud-sdk.sh,hosts}
35+
}

sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/coreos-kernel-6.12.62.ebuild

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ DEPEND="
5252
>=sys-kernel/bootengine-0.0.38-r37:=
5353
>=sys-kernel/coreos-firmware-20180103-r1:=
5454
virtual/udev
55-
amd64? ( sys-firmware/intel-microcode:= )
55+
amd64? (
56+
app-admin/google-guest-configs
57+
sys-firmware/intel-microcode:=
58+
)
5659
"
5760

5861
src_prepare() {

0 commit comments

Comments
 (0)