Différences entre versions de « BootStrapWindows »

De Cliss XXI
Sauter à la navigation Sauter à la recherche
imported>VincentAdolphe
m (A protégé « BootStrapWindows »: en cours ([edit=sysop] (infini) [move=sysop] (infini)))
(fix)
 
(16 versions intermédiaires par 2 utilisateurs non affichées)
Ligne 1 : Ligne 1 :
 
{| border="1" cellpadding="15" style="border-collapse:collapse;border-spacing:0px;border-color:lightgrey;"
 
{| border="1" cellpadding="15" style="border-collapse:collapse;border-spacing:0px;border-color:lightgrey;"
||
 
 
||
 
Depuis une installation de base
 
||
 
Depuis une installation existante
 
|-
 
 
|bgcolor="orange" rowspan="2"|
 
|bgcolor="orange" rowspan="2"|
 
Accès physique à la machine (écran clavier)
 
Accès physique à la machine (écran clavier)
 +
+ powershell admin
 
||
 
||
Créer un compte "root" lors de l'installation avec les droits administrateurs
+
* Ajouter la machine a l'inventaire (recuperer les adresses MAC, attribuer un nom et une IP)
||
+
* Nommer la machine
Créer un compte "root" depuis un autre utilisateur
+
* Créer l'utilisateur "root" si besoin / de meme, créer les utilisateurs du poste
<PRE>
+
<pre>
net user cyg_server 'PASS' /add
+
$PASS = 'rootpass'
net localgroup Administrateurs cyg_server /add
+
net user root "$PASS" /add
</PRE>
+
net localgroup Administrateurs root /add
 +
</pre>
 
Sur une installation anglaise, c'est "Administrators"
 
Sur une installation anglaise, c'est "Administrators"
 
|-
 
|-
 
|colspan="2"|
 
|colspan="2"|
* Se connecter avec ce nouveau compte (windows initialise des trucs a ce moment là qui simplifie le login ssh sur ce compte par la suite)
+
* (Se connecter avec ce nouveau compte (windows initialise des trucs a ce moment là qui simplifie le login ssh sur ce compte par la suite))
 
* regler 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)
 
* regler 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) depuis un terminal "power shell admin":<PRE>Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))</PRE>
+
* Installer chocolatey (cf https://chocolatey.org/install) cygwin, cyg-get, openssh, ouvrir le firewall et lancer un shell cygwin :
* installer un serveur VNC:<PRE>choco install -y tightvnc</PRE>
+
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('<nowiki>https://chocolatey.org/install.ps1'</nowiki>))
* configurer le serveur VNC avec un mot de passe
+
choco install -y cygwin cyg-get
 +
cyg-get.bat openssh python3 rsync
 +
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
 +
C:\tools\cygwin\bin\mintty.exe -
 +
|-
 +
|bgcolor="cyan" rowspan="1"|
 +
Accès physique à la machine, shell cygwin admin
 +
||
 +
configurer ssh:
 +
<pre>
 +
PASS='rootpass'
 +
ssh-host-config --yes --name 'sshd' --port 22 --pwd "$PASS"
 +
cygrunsrv.exe --start sshd
 +
</pre>
 
|-
 
|-
|bgcolor="lightblue"|
+
|bgcolor="yellow" rowspan="1"|
Accès à la machine via VNC
+
A preparer sur le poste linux de l'operateur
|colspan="2"|
+
||
* si l'installation est longue, configurer un profil sans mise en veille pour éviter de perdre la main
+
<PRE>
* dans un terminal "power shell admin" installer cygwin et cyg-get:<PRE>choco install -y cygwin cyg-get</PRE>
+
apt-get install tigervnc-common
* puis lancer un terminal "cygwin admin" (ça peut se faire depuis le terminal power shell):<PRE>C:\tools\cygwin\bin\mintty.exe -</PRE>
+
VNCPASS="vncpass"
* dans un terminal "cygwin admin" installer ssh:<PRE>cyg-get.bat openssh</PRE>
+
PASS=$(echo "$VNCPASS" | vncpasswd -f | hexdump -v -e '/1 "%02x "')
* puis configurer ssh:<PRE>ssh-host-config --debug --yes --name 'sshd' --port 22 --pwd "un_mot_de_passe_fort"</PRE>
+
echo 'PASS="'$PASS'"'
* ouvrir le firewall (tcp/22 et ping):
+
</PRE>
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
+
|-
 +
|bgcolor="lightgreen" rowspan="1"|
 +
Accès via ssh
 +
||
 +
* un rôle ansible permettant de pousser les clef ssh publique peut être joué a ce moment.
 +
<PRE>
 +
PASS="hex-pass" # le pass calcule sur la machine de l'operateur
 +
choco install -y tightvnc
 +
regtool  set '\HKLM\software\tightvnc\server\accepthttpconnections' 0
 +
regtool  set '\HKLM\software\tightvnc\server\UseVncAuthentication' 1
 +
regtool --binary set '\HKLM\software\tightvnc\server\password' $PASS
 +
net stop tvnserver
 +
net start tvnserver
 +
</PRE>
 +
* note the gui controler quit but tightvncserver is running
 +
<pre>
 +
choco install -y libreoffice thunderbird firefox vlc
 +
</pre>
 +
* cacher l'utilisateur "root" au login:
 +
<PRE>
 +
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' 0
 +
</PRE>
 +
* Pour vérifier l’état:
 +
<PRE>
 +
regtool -p list '\HKLM\software\microsoft\windows nt\currentversion\winlogon\SpecialAccounts\UserList'
 +
regtool get '\HKLM\software\microsoft\windows nt\currentversion\winlogon\SpecialAccounts\UserList\root'
 +
</PRE>
 +
* Pour créer un profil de mise en veille compatible avec la sauvegarde (pas de mise en veille sur secteur)
 +
<pre>
 +
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
 +
</pre>
 
|}
 
|}

Version actuelle datée du 31 janvier 2022 à 14:43

Accès physique à la machine (écran clavier) + powershell admin

  • Ajouter la machine a l'inventaire (recuperer les adresses MAC, attribuer un nom et une IP)
  • Nommer la machine
  • Créer l'utilisateur "root" si besoin / de meme, créer les utilisateurs du poste
$PASS = 'rootpass'
net user root "$PASS" /add
net localgroup Administrateurs root /add

Sur une installation anglaise, c'est "Administrators"

  • (Se connecter avec ce nouveau compte (windows initialise des trucs a ce moment là qui simplifie le login ssh sur ce compte par la suite))
  • regler 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, openssh, ouvrir le firewall et lancer un shell cygwin :
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install -y cygwin cyg-get
cyg-get.bat openssh python3 rsync
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
C:\tools\cygwin\bin\mintty.exe -

Accès physique à la machine, shell cygwin admin

configurer ssh:

PASS='rootpass'
ssh-host-config --yes --name 'sshd' --port 22 --pwd "$PASS"
cygrunsrv.exe --start sshd

A preparer sur le poste linux de l'operateur

apt-get install tigervnc-common
VNCPASS="vncpass"
PASS=$(echo "$VNCPASS" | vncpasswd -f | hexdump -v -e '/1 "%02x "')
echo 'PASS="'$PASS'"'

Accès via ssh

  • un rôle ansible permettant de pousser les clef ssh publique peut être joué a ce moment.
PASS="hex-pass" # le pass calcule sur la machine de l'operateur
choco install -y tightvnc
regtool  set '\HKLM\software\tightvnc\server\accepthttpconnections' 0
regtool  set '\HKLM\software\tightvnc\server\UseVncAuthentication' 1
regtool --binary set '\HKLM\software\tightvnc\server\password' $PASS
net stop tvnserver
net start tvnserver
  • note the gui controler quit but tightvncserver is running
choco install -y libreoffice thunderbird firefox vlc
  • cacher l'utilisateur "root" au login:
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' 0
  • Pour vérifier l’état:
regtool -p list '\HKLM\software\microsoft\windows nt\currentversion\winlogon\SpecialAccounts\UserList'
regtool get '\HKLM\software\microsoft\windows nt\currentversion\winlogon\SpecialAccounts\UserList\root'
  • Pour créer un profil de mise en veille compatible avec la sauvegarde (pas de mise en veille sur secteur)
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