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

Add README with idiot-resistant guide to configure it. #8

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 95 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,100 @@
iface
=====
# iface
![](media/preview.jpg)
Rather bad Windows/Linux RPC interface specialized for a Windows-host/GNU+Linux-guest configuration.

Rather bad Windows/Linux RPC interface specialized for a Windows-host/Linux-guest configuration.
**WARNING**: The Windows/GNU+Linux iface by is EXPERIMENTAL and has nothing to do with good coding, security, etc. **USE AT YOUR OWN RISK**.

**WARNING**: The Windows/Linux iface by is EXPERIMENTAL and has nothing to do with good coding, security, etc. **USE AT YOUR OWN RISK**.
In this guide, I'll show you how to setup Windows-host + GNU/Linux-guest using a VMWare Workstation.

Some details on the configuration can be found here:
https://docs.google.com/document/d/1bq3lXdB2G4Mr2xVSxGdx6icleV7bfWbDUQUOuXzftTY/edit?usp=sharing
# Setting up a Virtual Network Interfaces

* Open VMWare Workstation
* Go to: Edit -> Virtual Network Editor
* Create one Bridged Network Interface and attach your physical Network Adapter to it (it will be used to get the internet access on your linux guest)
* Create another Host-Only Adapter with set it up like on picture below

![](media/virtual-adapters.jpg)

# Virtual Machine Creation
Create a Virtual Machine as you always do, but attach two of those Network Interfaces to it and install your favourite GNU/Linux Distribution (Btw. I use Arch).


# VMWare Tools installation
* Arch Linux: ```sudo pacman -S open-vm-tools xf86-video-vmware```
* Debian/Ubuntu-based: ```sudo apt install open-vm-tools xserver-xorg-video-vmware```
* openSUSE: [software.opensuse.org](https://software.opensuse.org/download.html?project=Virtualization%3AVMware&package=open-vm-tools)

# Clone this repo to your VM
```
git clone https://github.com/synnek1337/win-linux-setup.git
```
# Attaching host physical drivers to Virtual Machine
Make sure your on 4.x kernel or newer: ```uname -r```\
Shut down the Virtual Machine.
In VMWare Workstation go to: **Edit this Virutal Machine settings** -> **Options** -> **Shared Folders** -> Check **Always enabled** -> **Add** -> Add the root folder of every partition you want to attach and name it **DRIVE_C**, **DRIVE_D** etc.

![](media/disk_attaching.jpg)
![](media/disks_attached.jpg)

Start the VM, go to ```win-linux-setup/guest-side-conf-scripts``` and do ```sudo python fstab-conf.py``` **!! USE PYTHON 3**

# Set up Network Interfaces on your Guest
```nmtui```
Set up your host-only interface ipv4 address to 192.168.56.3/24

# Set up Network Interface on your Host
**Control Panel** -> **Network and Sharing Center** -> **Change adapter settings** -> right-click on ***your host-only interface*** -> **Properties** -> **Internet Protocol Version 4 (TCP/IPv4)** -> set it like on picture belown

![](media/network_configuration.jpg)

# Set Up SSH Server on guest-side **(for easier troubleshoting)**
* Install OpenSSH and enable it like it' s described on your distro' s wiki (*https://wiki.archlinux.org/index.php/Secure_Shell*)
* edit ```/etc/ssh/sshd_config``` \
in line ***13*** change ```port``` to something different that 22 **(eg. 2137)** \
in line ***15*** change ```ListenAddress``` to **192.168.56.3** \
in line ***57*** change ```PasswordAuthentication``` to **no** \
in line ***32*** change ```PermitRootLogin``` to **no**.

* Generate SSH Keys \
```ssh-keygen``` and enter the passphrase \
go to ```~/.ssh/``` and rename **id_rsa.pub** to **authorized_keys** \
Transfer ```id_rsa``` to your host by ```cp id_rsa /c/...```

# Set Up PuTTY on Host-side
* [Download](https://the.earth.li/~sgtatham/putty/latest/w64/putty-64bit-0.70-installer.msi) PuTTY or ```choco install putty```
* Open ```puttygen``` \
**Conversions** -> **Import Key** -> **Save private key**
* Edit ```.\host-side-scripts\startup.bat``` \
in line ***4*** ***enter path to your .ppk file***.
* Now you can easily connect to your VM
# Install VcXsrv
* [Download](https://sourceforge.net/projects/vcxsrv/)
* ```choco install vcsrv```

# Configure all host-side scripts
* go to ```.\host-side-scripts``` \
In line *3* in ```l-cmd.bat``` enter path to this repo cloned. \
In line *4* in ```startup.bat``` enter PATH to your private key in **.ppk** format. \
In line *5* in ```startup.bat``` enter path to this repo cloned. \
In line *3* in ```vm-start.bat``` and ```vm-stop.bat``` add path to **.vmx** file of your VM.

* In ```shell:startup``` create link to ```repo\host-side-scripts\startup.bat```

# Configure iface
* Edit ```./RPC/iface.cfg``` \
in line ***2*** enter secure password \
in line ***3*** enter path to *home* directory on guest-side \
in line ***6*** enter path to your **terminal emulator** \
Use same iface.cfg both on guest and host side.

# Add iface to autostart on guest-side
* correct ```guest-side-scripts\startup.sh```
* Install **cron** *check your distro 's wiki* *(for arch it' s ```pacman -S cronie```)*
* ```crontab -e``` \
```@reboot *PATH to startup.sh*``` \
***ctrl+o*** ***ctrl+x***

# Credits
* [@gynvael](https://github.com/gynvael) for providing RPC Interface
* [@vmware](https://github.com/vmware) for providing virtualization solutions
* [@python](https://github.com/python) for providing Python Programming language
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions guest-side-scripts/fstab-conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/env python

from subprocess import check_output
from os import system

drives = check_output("vmware-hgfsclient", shell=True).decode('utf-8').split()
fstab = open('/etc/fstab', 'a')

for drive in drives:
fstab.write(
".host:{} /mnt/{} fuse.vmhgfs-fuse rw,allow_other 0 0".format(drive, drive[0].lower()))
print("{} attached.".format(drive[0].lower()))
system("ln /mnt/{} /{}".format(drive[0].lower(), drive[0].lower()))
print("/{} link created.".format(drive[0].lower()))
20 changes: 20 additions & 0 deletions guest-side-scripts/startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
SCRIPT=/home/gynvael/iface/iface.py # Correct this.
SCRIPT_ARGS=--linux
PYTHON=/usr/local/bin/python # Make sure it' s path to python 2.7!!!
SLEEP=/bin/sleep

# Retry 10 times.
for i in {0..10}
do

if [ -e "$SCRIPT" ]
then
export SHELL=/bin/bash
$PYTHON $SCRIPT $SCRIPT_ARGS >/dev/null 2>/dev/null &
exit 0
else
$SLEEP 2
fi

done
5 changes: 5 additions & 0 deletions host-side-scripts/l-cmd.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off

set %repopath%="Enter path to win-linux-setup directory"

C:\python27\python.exe %repopath%\RPC\if-l-cmd.py %cd%
20 changes: 20 additions & 0 deletions host-side-scripts/startup.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@echo off
color a

set %PRVKEY%="Enter path here"
set %repopath%="Enter path to win-linux-setup directory"

echo Starting vcxsrv...
start c:\bin\vcxsrv.exe :0 -clipboard -multiwindows
start c:\bin\xhost.exe +192.168.56.3
set DISPLAY=127.0.0.1:0
echo vcxsrv is running.

echo starting pageant...
start pageant %PRVKEY%

echo starting virtual machine
call vm-start.bat

echo starting Windows/Linux iface...
start c:\python27\python.exe %repopath%\RPC\iface.py --windows
6 changes: 6 additions & 0 deletions host-side-scripts/vm-start.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off

set %VMPATH%="Enter path to .vmx file here"

"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" start %VMPATH% nogui
echo "VM started."
6 changes: 6 additions & 0 deletions host-side-scripts/vm-stop.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off

set %VMPATH%="Enter path to .vmx file here"

"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" stop %VMPATH%
echo "VM Stopped."
Binary file added media/disk_attaching.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/disks_attached.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/network_configuration.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/preview.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/virtual-adapters.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.