Fix acl on .ssh\* files
This commit is contained in:
parent
ea4019a369
commit
2da3ad9264
|
@ -194,8 +194,7 @@ Try {
|
||||||
[String]$NOMMACHINE = "$ENV:COMPUTERNAME"
|
[String]$NOMMACHINE = "$ENV:COMPUTERNAME"
|
||||||
[String]$ENTITE = 'IPR'
|
[String]$ENTITE = 'IPR'
|
||||||
|
|
||||||
$GetWMIObject = Get-WMIObject Win32_ComputerSystem -Computername $NOMMACHINE
|
[String]$CurrentUser = (Get-WmiObject -Class win32_computersystem | Select-Object -ExpandProperty username).split('\')[1]
|
||||||
[String]$CurrentUser = ($GetWMIObject.UserName).Substring(3,($GetWMIObject.UserName).length-3)
|
|
||||||
|
|
||||||
|
|
||||||
# Ménage
|
# Ménage
|
||||||
|
@ -244,7 +243,7 @@ Try {
|
||||||
ssh-keygen -t ed25519 -f "D:\Home\$CurrentUser\Duplicati\.ssh\duplicati_id_ed25519" -q -N '""'
|
ssh-keygen -t ed25519 -f "D:\Home\$CurrentUser\Duplicati\.ssh\duplicati_id_ed25519" -q -N '""'
|
||||||
Write-Log -Message "Création des clefs SSH ed25519 IPR" -Component $CurrentScript -LogFile $LogFile
|
Write-Log -Message "Création des clefs SSH ed25519 IPR" -Component $CurrentScript -LogFile $LogFile
|
||||||
|
|
||||||
Send-MailMessage -SmtpServer smtpint.univ-rennes1.fr -From "$CurrentUser@univ-rennes.fr" -To IPR.ADMIN.EMAIL@univ-rennes.fr -Subject "$Hostname $CurrentUser - Nouvelle clef Duplicati" -Attachments D:\Home\$CurrentUser\Duplicati\.ssh\duplicati_id_ed25519.pub
|
Send-MailMessage -SmtpServer smtpint.univ-rennes1.fr -From "$CurrentUser@univ-rennes1.fr" -To IPR.ADMIN.EMAIL@listes.univ-rennes1.fr -Subject "$Hostname $CurrentUser - Nouvelle clef Duplicati" -Attachments D:\Home\$CurrentUser\Duplicati\.ssh\duplicati_id_ed25519.pub
|
||||||
}
|
}
|
||||||
$fichier = $fichier -replace "TARGETURLUR", "ssh://duplicati.ipr.univ-rennes1.fr//home//$CurrentUser//$NOMMACHINE//?auth-username=$CurrentUser&ssh-fingerprint=ssh-ed25519 32 4A:2D:A0:5F:66:7A:D5:3A:F4:B2:63:EC:EE:1E:D0:21&ssh-keyfile=D:\\Home\\$CurrentUser\\Duplicati\\.ssh\\duplicati_id_ed25519"
|
$fichier = $fichier -replace "TARGETURLUR", "ssh://duplicati.ipr.univ-rennes1.fr//home//$CurrentUser//$NOMMACHINE//?auth-username=$CurrentUser&ssh-fingerprint=ssh-ed25519 32 4A:2D:A0:5F:66:7A:D5:3A:F4:B2:63:EC:EE:1E:D0:21&ssh-keyfile=D:\\Home\\$CurrentUser\\Duplicati\\.ssh\\duplicati_id_ed25519"
|
||||||
}
|
}
|
||||||
|
@ -255,13 +254,16 @@ Try {
|
||||||
ssh-keygen -t rsa -f "D:\Home\$CurrentUser\Duplicati\.ssh\id_rsa_duplicati" -q -N '""'
|
ssh-keygen -t rsa -f "D:\Home\$CurrentUser\Duplicati\.ssh\id_rsa_duplicati" -q -N '""'
|
||||||
Write-Log -Message "Création des clefs SSH RSA FOTON" -Component $CurrentScript -LogFile $LogFile
|
Write-Log -Message "Création des clefs SSH RSA FOTON" -Component $CurrentScript -LogFile $LogFile
|
||||||
|
|
||||||
Send-MailMessage -SmtpServer smtpint.univ-rennes1.fr -From "$CurrentUser@univ-rennes.fr" -To FOTON.ADMIN.EMAIL@univ-rennes.fr -Subject "$Hostname $CurrentUser - Nouvelle clef Duplicati" -Attachments D:\Home\$CurrentUser\Duplicati\.ssh\duplicati_id_ed25519.pub
|
Send-MailMessage -SmtpServer smtpint.univ-rennes1.fr -From "$CurrentUser@univ-rennes1.fr" -To FOTON.ADMIN.EMAIL@univ-rennes.fr -Subject "$Hostname $CurrentUser - Nouvelle clef Duplicati" -Attachments D:\Home\$CurrentUser\Duplicati\.ssh\duplicati_id_ed25519.pub
|
||||||
}
|
}
|
||||||
$fichier = $fichier -replace "TARGETURLUR", "ssh://bkpdop.univ-rennes1.fr//mnt//datastore_backuppc//duplicati//$CurrentUser.$NOMMACHINE//?auth-username=$CurrentUser&ssh-fingerprint=ssh-rsa 2048 02:b9:38:a6:17:66:ba:90:e0:be:bb:7e:fb:a7:e6:14&ssh-keyfile=D:\\Home\\$CurrentUser\\Duplicati\\.ssh\\id_rsa_duplicati"
|
$fichier = $fichier -replace "TARGETURLUR", "ssh://bkpdop.univ-rennes1.fr//mnt//datastore_backuppc//duplicati//$CurrentUser.$NOMMACHINE//?auth-username=$CurrentUser&ssh-fingerprint=ssh-rsa 2048 02:b9:38:a6:17:66:ba:90:e0:be:bb:7e:fb:a7:e6:14&ssh-keyfile=D:\\Home\\$CurrentUser\\Duplicati\\.ssh\\id_rsa_duplicati"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Donne les droits à l'utilisateur courant aux clés ssh générées.
|
||||||
|
get-acl "D:\Home\$CurrentUser" | set-acl D:\Home\$CurrentUser\Duplicati\.ssh\*
|
||||||
|
|
||||||
$fichier = $fichier -replace "SESAME",$CurrentUser
|
$fichier = $fichier -replace "SESAME",$CurrentUser
|
||||||
|
|
||||||
$Fichier | set-content "D:\Home\$CurrentUser\Duplicati\sauvegarde.duplicati.config.json"
|
$Fichier | set-content "D:\Home\$CurrentUser\Duplicati\sauvegarde.duplicati.config.json"
|
||||||
|
|
Loading…
Reference in New Issue