wiki:bootstrapwindows

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
wiki:bootstrapwindows [14/05/2024 16:10] vincent.adolphewiki:bootstrapwindows [17/05/2024 11:58] (Version actuelle) vincent.adolphe
Ligne 1: Ligne 1:
 ====== Bootstraper une machine Windows ====== ====== Bootstraper une machine Windows ======
- 
-  * https://doc.cliss21.com/wiki/BootStrapWindows 
  
 TL;DR: TL;DR:
  
-Dans un powershell admin (clic droit sur le menu démarrer, puis choisir "Terminal (administrateur)" ou "Powershell (admin)"+Dans un powershell admin (clic droit sur le menu démarrer, puis choisir "Terminal (administrateur)" ou "Powershell (admin)" et copier/coller la ligne suivante:
 <code bash> <code bash>
-#WIP Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://interne.cliss21.org/bootstrap/windows.ps'))+Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://forge.cliss21.org/cliss21/bootstrap/raw/branch/main/windows.ps1'))
 </code> </code>
  
Ligne 21: Ligne 19:
 </code> </code>
 Sur une installation anglaise, c'est "Administrators" Sur une installation anglaise, c'est "Administrators"
-==== Accès physique à la machine, shell cygwin admin  ====+ 
 +==== powershell admin en tant que root  ==== 
 +Se connecter avec ce nouveau compte ''root'' (windows initialise des trucs a ce moment là qui simplifie le login ssh sur ce compte par la suite) 
 + 
 +  * régler les éventuels pb d'antivirus/firewall (certain en s'installant ou se désinstallant modifie le firewall de windows (en pratique laisser l'antivirus fournis avec l'OS et dégager les autres) 
 +  * Installer chocolatey (cf https://chocolatey.org/install) cygwin, cyg-get, opensshouvrir le firewall et lancer un shell cygwin :<code bash> 
 +# install chocolatey 
 +Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) 
 +# install cygwin 
 +choco install -y cygwin cyg-get 
 +# install ssh, python, rsync in cygwin environment 
 +cyg-get.bat openssh python3 rsync 
 +# open firewall for SSH and PING 
 +netsh advfirewall firewall add rule name="SSH" dir=in action=allow protocol=TCP localport=22 
 +netsh advfirewall firewall add rule name="ICMP ping" protocol=icmpv4:8,any dir=in action=allow 
 +# Launch a cygwin bash windows 
 +C:\tools\cygwin\bin\mintty.exe - 
 +</code> 
 + 
 +==== shell cygwin admin  ==== 
 +configurer ssh: 
 +<code bash> 
 +PASS='rootpass' 
 +ssh-host-config --yes --name 'sshd' --port 22 --pwd "$PASS" 
 +mkpasswd -l > /etc/passwd 
 +mkgroup -l > /etc/group 
 +cygrunsrv.exe --start sshd 
 +</code> 
 + 
 +===== Accès via SSH ===== 
 +Un rôle ansible permettant de pousser les clef ssh publique peut être joué a ce moment. 
 + 
 +  * installer quelques logiciels libres 
 +<code bash> 
 +choco install -y libreoffice thunderbird firefox vlc 
 +</code> 
 +  * cacher l'utilisateur "root" au login:<code bash> 
 +regtool add '\HKLM\software\microsoft\windows nt\currentversion\winlogon\SpecialAccounts' 
 +regtool add '\HKLM\software\microsoft\windows nt\currentversion\winlogon\SpecialAccounts\UserList' 
 +regtool -d set '\HKLM\software\microsoft\windows nt\currentversion\winlogon\SpecialAccounts\UserList\root'
 +</code> 
 +  * vérifier:<code bash> 
 +regtool -p list '\HKLM\software\microsoft\windows nt\currentversion\winlogon\SpecialAccounts\UserList' 
 +regtool get '\HKLM\software\microsoft\windows nt\currentversion\winlogon\SpecialAccounts\UserList\root' 
 +</code> 
 +  * Pour créer un profil de mise en veille compatible avec la sauvegarde (pas de mise en veille sur secteur):<code bash> 
 +powercfg /duplicatescheme 381b4222-f694-41f0-9685-ff5bb260df2e 381b4222-f694-41f0-9685-ff5bb260df2f 
 +# ignorer l'erreur si le profil est deja duplique 
 +powercfg /changename 381b4222-f694-41f0-9685-ff5bb260df2f "svg" 
 +powercfg /setactive 381b4222-f694-41f0-9685-ff5bb260df2f 
 +powercfg /change standby-timeout-ac 0 
 +powercfg /change hibernate-timeout-ac 0 
 +# desactiver la mise en veille des disques dur: 
 +powercfg /SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2f 0012ee47-9041-4b5d-9b77-535fba8b1442 6738e2c4-e8a5-4a42-b16a-e040e769756e 0x0 
 +</code> 
 +===== Installation TightVNC (Facultatif) ===== 
 + 
 +==== Sur le poste de l'opérateur ==== 
 +<code bash> 
 +VNCPASS="vncpass" 
 +apt-get install tigervnc-common 
 +PASS=$(echo "$VNCPASS" | vncpasswd -f | hexdump -v -e '/1 "%02x "'
 +echo 'PASS="'$PASS'"' 
 +</code> 
 + 
 +==== Accès via SSH ==== 
 + 
 +<code bash> 
 +PASS="hex-pass" # le pass calcule sur la machine de l'operateur 
 +choco install -y tightvnc 
 +regtool  set '\HKLM\software\tightvnc\server\accepthttpconnections'
 +regtool  set '\HKLM\software\tightvnc\server\UseVncAuthentication'
 +regtool --binary set '\HKLM\software\tightvnc\server\password' $PASS 
 +net stop tvnserver 
 +net start tvnserver 
 +</code> 
 + 
 +La GUI de tightvnc s'arrête mais tightvncserver continue a tourner 
 + 
 +===== Outils divers ===== 
 + 
 +==== Windows10Debloater ==== 
 +Fonctionne sous windows10 et windows11 
 +  * cf https://www.begeek.fr/windows-comment-se-debarrasser-des-bloatwares-en-une-seule-ligne-de-commande-367401 
 +  * source: https://github.com/Sycnex/Windows10Debloater 
 +  * utilisation <code bash> 
 +iwr -useb https://git.io/debloat|iex 
 +</code> 
  
  
  • wiki/bootstrapwindows.1715695850.txt.gz
  • Dernière modification : 14/05/2024 16:10
  • de vincent.adolphe