diff --git a/scripts/lib/initramfs.sh b/scripts/lib/initramfs.sh index b5ee1b7..1a2d1d7 100644 --- a/scripts/lib/initramfs.sh +++ b/scripts/lib/initramfs.sh @@ -604,11 +604,40 @@ EOF Zero-OS \r \m Built on \l +EOF + + # Create ntpd.conf pointing to Google NTP servers + log_info "Creating ntpd.conf with Google NTP servers" + cat > "${initramfs_dir}/etc/ntpd.conf" << 'EOF' +# Zero-OS NTP Configuration +# Using Google public NTP servers for reliable time sync + +server time.google.com iburst +server time1.google.com iburst +server time2.google.com iburst +server time3.google.com iburst + +# Fallback to Google IP addresses +server 216.239.35.0 iburst +server 216.239.35.4 iburst + +# Restrict access (security) +restrict default kod nomodify notrap nopeer noquery +restrict -6 default kod nomodify notrap nopeer noquery +restrict 127.0.0.1 +restrict -6 ::1 + +# Drift file for time stability +driftfile /var/lib/ntp/ntp.drift EOF # Set proper permissions safe_execute chmod 644 "${initramfs_dir}/etc/motd" safe_execute chmod 644 "${initramfs_dir}/etc/issue" + safe_execute chmod 644 "${initramfs_dir}/etc/ntpd.conf" + + # Create ntp drift directory + safe_mkdir "${initramfs_dir}/var/lib/ntp" log_info "Zero-OS customization complete" }