Fix password logic error in preseed handling

- Fix set_root_password.sh to update both build-time and live system preseed files
- Update auto-installer.sh to handle crypted passwords from preseed
- Fix cleanup.sh to reset both preseed files to default state
- Add changelog entry documenting the critical bug fix
- Resolve login issue where installed systems always used default password

This fixes the core issue where set_root_password.sh only modified the build-time
preseed file, but the auto-installer used the live system preseed file which
remained unchanged, causing installed systems to always have 'changeme' password.
parent ee483957
# MBetter Live CD - Changelog # MBetter Live CD - Changelog
## Version 2.0.1 - Password Logic Fix (2025-09-06)
### 🐛 Critical Bug Fix
#### **Password Logic Error - RESOLVED**
-**Fixed password synchronization** between build-time and live system preseed files
-**Updated set_root_password.sh** to modify both `config/preseed/debian-installer.cfg` and `config/includes.binary/preseed.cfg`
-**Enhanced auto-installer.sh** to handle crypted passwords from preseed files
-**Fixed cleanup.sh** to reset both preseed files to default state
-**Verified compatibility** with all password modification tools (customize_iso.sh, usb_creator_gui.py)
#### **Root Cause:**
- `set_root_password.sh` only updated build-time preseed file
- Auto-installer used live system preseed file (which remained unchanged)
- Installed systems always used default "changeme" password
#### **Impact:**
- **Before:** Installed systems couldn't login with configured password
- **After:** Password configuration works correctly across all tools
### 📝 Files Modified
- **Enhanced:** [`set_root_password.sh`](set_root_password.sh) - Updates both preseed files
- **Enhanced:** [`cleanup.sh`](cleanup.sh) - Resets both preseed files
- **Enhanced:** [`config/includes.chroot/usr/local/bin/auto-installer.sh`](config/includes.chroot/usr/local/bin/auto-installer.sh) - Handles crypted passwords
### ✅ Verification
- Tested password setting with `./set_root_password.sh testpassword123`
- Verified both preseed files contain identical crypted passwords
- Confirmed cleanup resets both files to default state
- Validated compatibility with existing tools
---
## Version 2.0.0 - Major Autologin and USB Creator Release (2025-01-04) ## Version 2.0.0 - Major Autologin and USB Creator Release (2025-01-04)
### 🚀 Major Features Added ### 🚀 Major Features Added
......
...@@ -50,8 +50,9 @@ if [ "$EUID" -ne 0 ]; then ...@@ -50,8 +50,9 @@ if [ "$EUID" -ne 0 ]; then
exit 1 exit 1
fi fi
# Revert root password to default in preseed file # Revert root password to default in preseed files
sed -i 's|d-i passwd/root-password-crypted password .*|d-i passwd/root-password password changeme|' config/preseed/debian-installer.cfg sed -i 's|d-i passwd/root-password-crypted password .*|d-i passwd/root-password password changeme|' config/preseed/debian-installer.cfg
sed -i 's|d-i passwd/root-password-crypted password .*|d-i passwd/root-password password changeme|' config/includes.binary/preseed.cfg
# Remove OpenVPN configuration # Remove OpenVPN configuration
if [ -d "config/includes.chroot/etc/openvpn" ]; then if [ -d "config/includes.chroot/etc/openvpn" ]; then
......
...@@ -566,7 +566,15 @@ configure_target_system() { ...@@ -566,7 +566,15 @@ configure_target_system() {
# Set root password from preseed, live system, or use default # Set root password from preseed, live system, or use default
ROOT_PASS=$(get_preseed_value "passwd/root-password") ROOT_PASS=$(get_preseed_value "passwd/root-password")
if [ -n "$ROOT_PASS" ]; then ROOT_PASS_CRYPTED=$(get_preseed_value "passwd/root-password-crypted")
if [ -n "$ROOT_PASS_CRYPTED" ]; then
print_status "Setting root password from crypted preseed file..."
log "Setting root password from crypted preseed"
# Extract the crypted password (remove "password " prefix)
CRYPTED_PASS=$(echo "$ROOT_PASS_CRYPTED" | sed 's/^password //')
# Set the crypted password directly in shadow file
sed -i "s|^root:.*|root:$CRYPTED_PASS|" "$TARGET_MOUNT/etc/shadow"
elif [ -n "$ROOT_PASS" ]; then
print_status "Setting root password from preseed file..." print_status "Setting root password from preseed file..."
log "Setting root password from preseed: ${ROOT_PASS:0:10}..." log "Setting root password from preseed: ${ROOT_PASS:0:10}..."
# Set the password using chpasswd # Set the password using chpasswd
......
...@@ -10,3 +10,7 @@ CRYPTED=$(openssl passwd -1 "$PASSWORD") ...@@ -10,3 +10,7 @@ CRYPTED=$(openssl passwd -1 "$PASSWORD")
sed -i "s|d-i passwd/root-password password changeme|d-i passwd/root-password-crypted password $CRYPTED|" config/preseed/debian-installer.cfg sed -i "s|d-i passwd/root-password password changeme|d-i passwd/root-password-crypted password $CRYPTED|" config/preseed/debian-installer.cfg
sed -i "/d-i passwd\/root-password-again password changeme/d" config/preseed/debian-installer.cfg sed -i "/d-i passwd\/root-password-again password changeme/d" config/preseed/debian-installer.cfg
# Also update the live system preseed file that the auto-installer uses
sed -i "s|d-i passwd/root-password password changeme|d-i passwd/root-password-crypted password $CRYPTED|" config/includes.binary/preseed.cfg
sed -i "/d-i passwd\/root-password-again password changeme/d" config/includes.binary/preseed.cfg
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment