Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment with creating and configuring cloud dev VM #6

Closed
patheard opened this issue Sep 20, 2019 · 12 comments
Closed

Experiment with creating and configuring cloud dev VM #6

patheard opened this issue Sep 20, 2019 · 12 comments

Comments

@patheard
Copy link
Collaborator

  • Use Azure/AzureStack
  • All configuration-as-code (ideally one-action create and ready to use).
@patheard
Copy link
Collaborator Author

patheard commented Sep 20, 2019

Observations about AzureStack VM (Windows Server 2016 Datacenter):

  • IE was set to restrict file download, running active scripts.
  • Needed to change this with a custom security level in Internet Options > Security > Internet Zone.
  • Performance is quite good. ~500-1000ms on input lag.
  • Internet transfer speed very good ~10MB/s.

@patheard
Copy link
Collaborator Author

Possible fix for exposing CPU virtualization to guest OS:

Set-VMProcessor -VMName <Target VM's Name> -ExposeVirtualizationExtensions $true

@patheard
Copy link
Collaborator Author

Linux VM is now also up and running and can communicate with Windows VM.

Tested with following Docker container:

docker run --name test-nginx -p 80:80 -d nginx

And then connecting to http://<linux-vm-host> in a browser on the Windows VM.

@patheard
Copy link
Collaborator Author

Confirmed linux/windows VM can communicate over 443. This should let me test with Ansible with a linux control node and windows host.

@patheard
Copy link
Collaborator Author

Steps to setup:

# Linux control node
sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
# Windows host
choco install python

@patheard
Copy link
Collaborator Author

Created local Ansible playbook based on esdc-devx/dev-laptop.

dto-btn/ansible-dev-laptop#1

@patheard
Copy link
Collaborator Author

  • Localhost provision worked nicely at Linux VM.
  • Next test is to see if it can provistion Windows VM.

@patheard
Copy link
Collaborator Author

Commands to share windows folder on linux:

# windows
New-SMBShare –Name "Development" –Path "C:\path\to\folder" –FullAccess domain\username

# linux
sudo apt-get install cifs-utils
sudo mount.cifs //WindowsPC/path ~/path/to/mount -o user=username

@patheard patheard self-assigned this Sep 22, 2019
@patheard
Copy link
Collaborator Author

patheard commented Sep 22, 2019

Setting up windows host with SSH:

Linux control node:

# Create ssh keys
ssh-keygen -t rsa -b 4096

# Grant ownership to the default `local_tmp` and `remote_tmp` in ansible.cfg
# Alternative: change these directories
chown -R username:usergroup ~/.ansible

Windows host:

# Install and start server
choco install openssh --package-parameters='"/SSHServerFeature"'

# Copy control node `id_rsa.pub` contents into %userprofile%\.ssh\authorized_keys

# Update %programdata%\ssh\sshd_config:
PubkeyAuthentication yes
# Match Group administrators
#       AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

# Restart sshd service
Restart-Service -Name sshd -Force

# Set default SSH shell to powershell (optional)
Set-Itemproperty -path 'HKLM:\SOFTWARE\OpenSSH' -Name 'DefaultShell' -value 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'

Debug public key authentication not working:

ssh -vvv windows-host

@patheard
Copy link
Collaborator Author

patheard commented Sep 22, 2019

Test command with plaintext auth and public key auth from linux control node:

# plaintext
# can alternatively set `ansible_user` and `ansible_password` in encryped ansible.cfg file
ansible windows -m win_whoami -u username --ask-pass

Test command with pubkey authentication:

# pubkey
ansible windows -m win_whoami

patheard pushed a commit to dto-btn/ansible-dev-laptop that referenced this issue Sep 22, 2019
Uses experimental OpenSSH rather than WinRM for processing
commands from control node.

Relates to dto-btn/todo#6
patheard pushed a commit to dto-btn/ansible-dev-laptop that referenced this issue Sep 23, 2019
Organized repo into ./ubuntu and ./windows directories.
Related to dto-btn/todo#6
patheard pushed a commit to dto-btn/ansible-dev-laptop that referenced this issue Sep 23, 2019
Organized repo into ./ubuntu and ./windows directories.
Related to dto-btn/todo#6
@patheard
Copy link
Collaborator Author

Commands for installing Ubuntu desktop on a UbuntuServer image and enablding RDP from Windows:

sudo apt install ubuntu-desktop
sudo apt install xrdp
sudo systemctl enable xrdp

@patheard
Copy link
Collaborator Author

Allow xrdp to listen on 443:

sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/sbin/xrdp
sudo vi /etc/xrdp/xrdp.ini # change port=443

patheard pushed a commit to dto-btn/ansible-dev-laptop that referenced this issue Sep 24, 2019
This removes the need for it in the setupssh.ps1 script.
Related dto-btn/todo#6
patheard pushed a commit to dto-btn/ansible-dev-laptop that referenced this issue Sep 24, 2019
This removes the need for it in the setupssh.ps1 script.
Related dto-btn/todo#6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant