Skip to content

Installer fixes: Wi-Fi validation, HTTPS, system disk check / Kurulum düzeltmeleri: Wi-Fi denetimi, HTTPS, sistem diski kontrolü - #4

Open
FurkanKY wants to merge 3 commits into
schematrix:mainfrom
FurkanKY:fix/installer-hardening
Open

FurkanKY wants to merge 3 commits into
schematrix:mainfrom
FurkanKY:fix/installer-hardening

Conversation

@FurkanKY

@FurkanKY FurkanKY commented Nov 1, 2026

Copy link
Copy Markdown

English · Türkçe

English

Three small installer fixes. Each one is a separate commit, so any of them can be dropped.

1. Wi-Fi name and password are validated before they are written (install.sh)

  • Passwords longer than 63 characters were accepted. The install finished but the hotspot never came up (the "invalid WPA passphrase length" item in Troubleshooting). Now 8–63 printable ASCII characters are required, as WPA2 does.
  • A " in the password was silently removed: abc"defgh was saved as abcdefgh, so the user could not join with the password they typed. Now ", \, {{, {% and {# are rejected with a message instead (they break the YAML string or Ansible templating).
  • Non-ASCII characters (ş, ğ, ı…) in the password are rejected with a clear message. The network name is checked against the 32-byte limit (Turkish letters take 2 bytes).
  • The password is asked twice, because it is typed hidden and a typo would leave a hotspot nobody can join.
  • Leading and trailing spaces were silently removed by read. The password is now read as typed, and leading or trailing spaces are rejected with a message.

2. The Internet-in-a-Box installer is downloaded over HTTPS (install.sh)
curl d.iiab.io/install.txt | bash used plain HTTP and runs as root. https://d.iiab.io/install.txt serves the same file.

3. The system disk check also catches partitions (scripts/setup-ssd.sh)
The old check compared device names as text. On a Pi 5 booting from NVMe (root on /dev/nvme0n1p2), passing /dev/nvme0n1p1 was not caught, and the boot partition could be formatted. Now the script finds the physical disk of both the target and / (via lsblk PKNAME) and refuses if they are the same. If the system disk cannot be determined, it stops instead of guessing. This includes an overlay (read-only) root, where / is not a block device; there the script now stops with a message.

Testing

  • bash -n and ShellCheck (-S warning) are clean on both files, apart from one warning on an unchanged line in setup-ssd.sh.
  • The new functions were run in isolation: 37 cases covering valid and invalid passwords and network names, the full prompt loop writing local_vars.yml, and the disk check with SD boot, NVMe boot, a USB disk and a device-mapper root (lsblk was stubbed).
  • Not tested on a real Raspberry Pi. A run on hardware would be welcome.

Türkçe

Kurulumda üç küçük düzeltme. Her biri ayrı bir commit, istenmeyen çıkarılabilir.

1. Wi-Fi adı ve şifresi yazılmadan önce denetleniyor (install.sh)

  • 63 karakterden uzun şifre kabul ediliyordu. Kurulum bitiyor ama hotspot hiç açılmıyordu (Sorun giderme'deki "invalid WPA passphrase length" maddesi). Artık WPA2'nin istediği gibi 8–63 İngilizce klavye karakteri gerekiyor.
  • Şifredeki " sessizce siliniyordu: abc"defgh, abcdefgh olarak kaydediliyordu ve kullanıcı yazdığı şifreyle bağlanamıyordu. Artık ", \, {{, {% ve {# bir mesajla reddediliyor (YAML'ı ya da Ansible'ı bozuyorlar).
  • Şifrede Türkçe karakter (ş, ğ, ı…) varsa açık bir mesajla reddediliyor. Ağ adı 32 bayt sınırına göre denetleniyor (Türkçe harf 2 bayt).
  • Şifre gizli yazıldığı için iki kez soruluyor; yazım hatası kimsenin bağlanamadığı bir hotspot bırakırdı.
  • Baştaki ve sondaki boşluklar read tarafından sessizce siliniyordu. Şifre artık yazıldığı gibi okunuyor; başta ya da sonda boşluk varsa bir mesajla reddediliyor.

2. Internet-in-a-Box kurulum dosyası HTTPS ile indiriliyor (install.sh)
curl d.iiab.io/install.txt | bash şifresiz HTTP kullanıyordu ve root olarak çalışıyor. https://d.iiab.io/install.txt aynı dosyayı veriyor.

3. Sistem diski kontrolü bölümleri de yakalıyor (scripts/setup-ssd.sh)
Eski kontrol aygıt adlarını yazı olarak karşılaştırıyordu. NVMe'den açılan bir Pi 5'te (kök /dev/nvme0n1p2) /dev/nvme0n1p1 verilirse yakalanmıyor, açılış bölümü biçimlendirilebiliyordu. Artık betik hedefin ve /'nin fiziksel diskini (lsblk PKNAME) bulup aynıysa reddediyor. Sistem diski belirlenemezse tahmin etmek yerine duruyor. Buna salt-okunur (overlay) kök de dahil: orada / bir blok aygıtı değil ve betik artık bir mesajla duruyor.

Test

  • İki dosyada da bash -n ve ShellCheck (-S warning) temiz; yalnızca setup-ssd.sh'te değiştirilmemiş bir satırda bir uyarı var.
  • Yeni fonksiyonlar tek başına çalıştırıldı: geçerli ve geçersiz şifre ve ağ adları, local_vars.yml'e yazan soru akışının tamamı ve SD'den açılış, NVMe'den açılış, USB disk ve device-mapper kökü senaryolarıyla disk kontrolü olmak üzere 37 durum (lsblk taklit edildi).
  • Gerçek bir Raspberry Pi'de denenmedi. Donanımda bir deneme çok iyi olur.

The old check compared device names as text, so on a Pi booting from
NVMe (root on /dev/nvme0n1p2) passing /dev/nvme0n1p1 was not caught and
the boot partition could be formatted. Compare physical disks instead,
and stop if the system disk cannot be determined.
install.sh piped d.iiab.io/install.txt into a root shell over plain HTTP. The same file is served over HTTPS.
- Reject passwords outside 8-63 printable ASCII characters. Longer ones
  were accepted and the hotspot never came up ("invalid WPA passphrase
  length").
- Reject ", \, {{, {% and {# instead of silently removing ". They break
  the YAML string or Ansible templating, and a silently changed password
  cannot be used to join.
- Read the password as typed (read stripped leading/trailing spaces) and
  reject leading or trailing spaces.
- Check the network name against the 32-byte SSID limit.
- Ask for the password twice, since it is typed hidden.
@schematrix

schematrix commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Emeğine sağlık, özellikle sistem diskinin formatlanma ihtimali gözümden kaçmıştı, iyi ki yakalamışsın. #10'la benzer değişiklikler var, ikisinden birini alacağım. Pi'de sıfırdan kurulum yapıp deneyeceğim, sorun yoksa merge ederim.

Thanks a lot, I had totally missed that the system disk could get formatted, glad you caught it. There's some overlap with #10 so I'll pick one of them. I'll do a fresh install on the Pi and merge if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants