Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #8 from dylanmei/update_openssh_6.3
Browse files Browse the repository at this point in the history
Ensure TEMP and USERPROFILE variables are always available
  • Loading branch information
joefitzgerald committed Nov 25, 2013
2 parents 52f4a5f + 47a7fa7 commit 517255a
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
6 changes: 3 additions & 3 deletions answer_files/2008_r2/Autounattend.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<Value>vagrant</Value>
<PlainText>true</PlainText>
</Password>
<Username>administrator</Username>
<Username>vagrant</Username>
<Enabled>true</Enabled>
</AutoLogon>
<FirstLogonCommands>
Expand Down Expand Up @@ -225,14 +225,14 @@
</SynchronousCommand>
<!-- WITHOUT WINDOWS UPDATES
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c a:\openssh-6.2.bat START</CommandLine>
<CommandLine>cmd.exe /c a:\openssh.bat START</CommandLine>
<Description>Install OpenSSH</Description>
<Order>99</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand> -->
<!-- WITH WINDOWS UPDATES -->
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c a:\openssh-6.2.bat</CommandLine>
<CommandLine>cmd.exe /c a:\openssh.bat</CommandLine>
<Description>Install OpenSSH</Description>
<Order>99</Order>
<RequiresUserInput>true</RequiresUserInput>
Expand Down
7 changes: 3 additions & 4 deletions answer_files/2012/Autounattend.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<Value>vagrant</Value>
<PlainText>true</PlainText>
</Password>
<Username>administrator</Username>
<Username>vagrant</Username>
<Enabled>true</Enabled>
</AutoLogon>
<FirstLogonCommands>
Expand Down Expand Up @@ -226,14 +226,14 @@
</SynchronousCommand>
<!-- WITHOUT WINDOWS UPDATES
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c a:\openssh-6.2.bat START</CommandLine>
<CommandLine>cmd.exe /c a:\openssh.bat START</CommandLine>
<Description>Install OpenSSH</Description>
<Order>99</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand> -->
<!-- WITH WINDOWS UPDATES -->
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c a:\openssh-6.2.bat</CommandLine>
<CommandLine>cmd.exe /c a:\openssh.bat</CommandLine>
<Description>Install OpenSSH</Description>
<Order>99</Order>
<RequiresUserInput>true</RequiresUserInput>
Expand All @@ -244,7 +244,6 @@
<Order>100</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>

</FirstLogonCommands>
<ShowWindowsLive>false</ShowWindowsLive>
</component>
Expand Down
1 change: 0 additions & 1 deletion scripts/chocolatey.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

set TEMP=C:\Windows\Temp
powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" <NUL

<nul set /p ".=;C:\Chocolatey\bin" >> C:\Windows\Temp\PATH
Expand Down
10 changes: 6 additions & 4 deletions scripts/openssh-6.2.bat → scripts/openssh.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

:: setup openssh
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.mls-software.com/files/setupssh-6.2p2-1-v1(x64).exe', 'C:\Windows\Temp\openssh-6.2.exe')"
cmd /c C:\Windows\temp\openssh-6.2.exe /S /port=22 /privsep=1 /password=D@rj33l1ng
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.mls-software.com/files/setupssh-6.3p1-1(x64).exe', 'C:\Windows\Temp\openssh.exe')"
cmd /c C:\Windows\temp\openssh.exe /S /port=22 /privsep=1 /password=D@rj33l1ng

:: ensure vagrant can log in
mkdir "C:\Users\vagrant\.ssh"
Expand All @@ -11,13 +11,15 @@ cmd /c C:\Windows\System32\icacls.exe "C:\Program Files\OpenSSH\usr\sbin" /grant
powershell -Command "(Get-Content 'C:\Program Files\OpenSSH\etc\passwd') | Foreach-Object { $_ -replace '/home/(\w+)', '/cygdrive/c/Users/$1' } | Set-Content 'C:\Program Files\OpenSSH\etc\passwd'"

:: fix opensshd to not be strict
powershell -Command "(Get-Content 'C:\Program Files\OpenSSH\etc\sshd_config') | Foreach-Object { $_ -replace 'StrictModes yes', 'StrictModes no' } | Set-Content 'C:\Program Files\OpenSSH\etc\sshd_config'"
powershell -Command "(Get-Content 'C:\Program Files\OpenSSH\etc\sshd_config') | Foreach-Object { $_ -replace '#PubkeyAuthentication yes', 'PubkeyAuthentication yes' } | Set-Content 'C:\Program Files\OpenSSH\etc\sshd_config'"
powershell -Command "(Get-Content 'C:\Program Files\OpenSSH\etc\sshd_config') -replace 'StrictModes yes', 'StrictModes no' | Set-Content 'C:\Program Files\OpenSSH\etc\sshd_config'"
powershell -Command "(Get-Content 'C:\Program Files\OpenSSH\etc\sshd_config') -replace '#PubkeyAuthentication yes', 'PubkeyAuthentication yes' | Set-Content 'C:\Program Files\OpenSSH\etc\sshd_config'"
powershell -Command "(Get-Content 'C:\Program Files\OpenSSH\etc\sshd_config') -replace '#PermitUserEnvironment no', 'PermitUserEnvironment yes' | Set-Content 'C:\Program Files\OpenSSH\etc\sshd_config'"

:: use Windows\Temp as /tmp location
rd /S /Q "C:\Program Files\OpenSSH\tmp"
cmd /c ""C:\Program Files\OpenSSH\bin\junction.exe" /accepteula "C:\Program Files\OpenSSH\tmp" C:\Windows\Temp"
cmd /c C:\Windows\System32\icacls.exe "C:\Windows\Temp" /grant vagrant:(OI)(CI)F
powershell -Command "Add-Content C:\Users\vagrant\.ssh\environment "TEMP=C:\Windows\Temp""

:: record the path for use by provisioners
<nul set /p ".=%PATH%" > C:\Windows\Temp\PATH
Expand Down
1 change: 0 additions & 1 deletion scripts/vagrant-ssh.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

:: vagrant public key
mkdir "C:\Users\vagrant\.ssh"
if exist a:\vagrant.pub (
copy a:\vagrant.pub C:\Users\vagrant\.ssh\authorized_keys
) else (
Expand Down
4 changes: 2 additions & 2 deletions windows_2008_r2.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"floppy_files": [
"./answer_files/2008_r2/Autounattend.xml",
"./scripts/win-updates.ps1",
"./scripts/openssh-6.2.bat"
"./scripts/openssh.bat"
],
"vmx_data": {
"RemoteDisplay.vnc.enabled": "false",
Expand All @@ -41,7 +41,7 @@
"floppy_files": [
"./answer_files/2008_r2/Autounattend.xml",
"./scripts/win-updates.ps1",
"./scripts/openssh-6.2.bat",
"./scripts/openssh.bat",
"./scripts/oracle-cert.cer"
],
"vboxmanage": [
Expand Down
4 changes: 2 additions & 2 deletions windows_2012.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"floppy_files": [
"./answer_files/2012/Autounattend.xml",
"./scripts/win-updates.ps1",
"./scripts/openssh-6.2.bat"
"./scripts/openssh.bat"
],
"vmx_data": {
"RemoteDisplay.vnc.enabled": "false",
Expand All @@ -41,7 +41,7 @@
"floppy_files": [
"./answer_files/2012/Autounattend.xml",
"./scripts/win-updates.ps1",
"./scripts/openssh-6.2.bat",
"./scripts/openssh.bat",
"./scripts/oracle-cert.cer"
],
"vboxmanage": [
Expand Down

0 comments on commit 517255a

Please sign in to comment.