From c73b4e920c39197957d61b40d2bba3518c87b18a Mon Sep 17 00:00:00 2001 From: Michal Moskal Date: Wed, 1 Mar 2006 21:52:47 +0000 Subject: [PATCH] - mostly copied from VMware-workstation Changed files: VMware-server-Makefile.patch -> 1.1 VMware-server-dhcpd.conf -> 1.1 VMware-server-nat.conf -> 1.1 VMware-server-run_script.patch -> 1.1 VMware-server-vmnet.conf -> 1.1 VMware-server.desktop -> 1.1 VMware-server.init -> 1.1 VMware-server.png -> 1.1 --- VMware-server-Makefile.patch | 134 ++++++++++ VMware-server-dhcpd.conf | 11 + VMware-server-nat.conf | 46 ++++ VMware-server-run_script.patch | 349 +++++++++++++++++++++++++ VMware-server-vmnet.conf | 18 ++ VMware-server.desktop | 11 + VMware-server.init | 450 +++++++++++++++++++++++++++++++++ VMware-server.png | Bin 0 -> 6026 bytes 8 files changed, 1019 insertions(+) create mode 100644 VMware-server-Makefile.patch create mode 100644 VMware-server-dhcpd.conf create mode 100644 VMware-server-nat.conf create mode 100644 VMware-server-run_script.patch create mode 100644 VMware-server-vmnet.conf create mode 100644 VMware-server.desktop create mode 100755 VMware-server.init create mode 100644 VMware-server.png diff --git a/VMware-server-Makefile.patch b/VMware-server-Makefile.patch new file mode 100644 index 0000000..4ccad44 --- /dev/null +++ b/VMware-server-Makefile.patch @@ -0,0 +1,134 @@ +diff -urN vmmon-only.org/Makefile vmmon-only/Makefile +--- vmmon-only.org/Makefile 2004-05-12 16:49:05.732456176 +0200 ++++ vmmon-only/Makefile 2004-05-12 16:57:25.454486880 +0200 +@@ -14,9 +14,9 @@ + VM_UNAME = $(shell uname -r) + + # Header directory for the running kernel +-HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include ++HEADER_DIR = /usr/src/linux/include + +-BUILD_DIR = $(HEADER_DIR)/.. ++BUILD_DIR = . + + DRIVER := vmmon + +@@ -55,9 +55,6 @@ + + VMCCVER := $(shell $(CC) -dumpversion) + +-# If there is no version defined, we are in toplevel pass, not yet in kernel makefiles... +-ifeq ($(VERSION),) +- + ifeq ($(VM_KBUILD), 24) + DRIVER_KO := $(DRIVER).o + else +@@ -72,41 +69,14 @@ + $(DRIVER): $(DRIVER_KO) + cp -f $< $@ + +-# Pass gcc version down the chain, so we can detect if kernel attempts to use unapproved compiler +-VM_CCVER := $(VMCCVER) +-export VM_CCVER +-VM_CC := $(CC) +-export VM_CC +- + MAKEOVERRIDES := $(filter-out CC=%,$(MAKEOVERRIDES)) + + $(DRIVER_KO): + make -C $(BUILD_DIR) SUBDIRS=$$PWD SRCROOT=$$PWD/$(SRCROOT) modules + +-else +- +-ifneq ($(VM_CCVER), $(VMCCVER)) +-$(warning *** Inappropriate build environment: you wanted to use gcc \ +- version $(VM_CCVER) while kernel attempts to use gcc version $(VMCCVER).) +-$(error For proper build you'll have to replace $(CC) with symbolic \ +- link to $(VM_CC)) +-endif +- +-endif + + include $(SRCROOT)/Makefile.kernel + +-ifdef TOPDIR +-ifeq ($(VM_KBUILD), 24) +- +-O_TARGET := $(DRIVER).o +- +-obj-y := $($(DRIVER)-y) +- +-include $(TOPDIR)/Rules.make +-endif +-endif +- + else + + include $(SRCROOT)/Makefile.normal +diff -urN vmnet-only.org/Makefile vmnet-only/Makefile +--- vmnet-only.org/Makefile 2004-05-12 16:49:09.091945456 +0200 ++++ vmnet-only/Makefile 2004-05-12 16:49:19.904301728 +0200 +@@ -14,9 +14,9 @@ + VM_UNAME = $(shell uname -r) + + # Header directory for the running kernel +-HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include ++HEADER_DIR = /usr/src/linux/include + +-BUILD_DIR = $(HEADER_DIR)/.. ++BUILD_DIR = . + + DRIVER := vmnet + +@@ -90,9 +67,6 @@ + + VMCCVER := $(shell $(CC) -dumpversion) + +-# If there is no version defined, we are in toplevel pass, not yet in kernel makefiles... +-ifeq ($(VERSION),) +- + ifeq ($(VM_KBUILD), 24) + DRIVER_KO := $(DRIVER).o + else +@@ -102,41 +76,13 @@ + auto-build: $(DRIVER_KO) + cp -f $< $(SRCROOT)/../$(DRIVER).o + +-# Pass gcc version down the chain, so we can detect if kernel attempts to use unapproved compiler +-VM_CCVER := $(VMCCVER) +-export VM_CCVER +-VM_CC := $(CC) +-export VM_CC +- + MAKEOVERRIDES := $(filter-out CC=%,$(MAKEOVERRIDES)) + + $(DRIVER_KO): + make -C $(BUILD_DIR) SUBDIRS=$$PWD SRCROOT=$$PWD/$(SRCROOT) modules + +-else +- +-ifneq ($(VM_CCVER), $(VMCCVER)) +-$(warning *** Inappropriate build environment: you wanted to use gcc \ +- version $(VM_CCVER) while kernel attempts to use gcc version $(VMCCVER).) +-$(error For proper build you'll have to replace $(CC) with symbolic \ +- link to $(VM_CC)) +-endif +- +-endif +- + include $(SRCROOT)/Makefile.kernel + +-ifdef TOPDIR +-ifeq ($(VM_KBUILD), 24) +- +-O_TARGET := $(DRIVER).o +- +-obj-y := $($(DRIVER)-y) +- +-include $(TOPDIR)/Rules.make +-endif +-endif +- + else + + include $(SRCROOT)/Makefile.normal diff --git a/VMware-server-dhcpd.conf b/VMware-server-dhcpd.conf new file mode 100644 index 0000000..914cbec --- /dev/null +++ b/VMware-server-dhcpd.conf @@ -0,0 +1,11 @@ +allow unknown-clients; +default-lease-time 1800; # 30 minutes +max-lease-time 7200; # 2 hours + +subnet 192.168.76.0 netmask 255.255.255.0 { + range 192.168.76.128 192.168.76.254; + option broadcast-address 192.168.76.255; + option domain-name-servers 192.168.76.2; + option domain-name "localdomain"; + option routers 192.168.76.2; +} diff --git a/VMware-server-nat.conf b/VMware-server-nat.conf new file mode 100644 index 0000000..0e65c51 --- /dev/null +++ b/VMware-server-nat.conf @@ -0,0 +1,46 @@ +# Linux NAT configuration file +[host] +# NAT gateway address +ip = 192.168.76.2 +netmask = 255.255.255.0 +# or ip = 192.168.76.2/24 + +# enable configuration; disabled by default for security reasons +#configport = 33445 + +# VMnet device if not specified on command line +device = /dev/vmnet8 + +# Allow PORT/EPRT FTP commands (they need incoming TCP stream...) +activeFTP = 1 + +# Allows the source to have any OUI. Turn this one if you change the OUI +# in the MAC address of your virtual machines. +#allowAnyOUI = 1 + +[udp] +# Timeout in seconds, 0 = no timeout, default = 60; real value might +# be up to 100% longer +timeout = 60 + +[incomingtcp] +# Use these with care - anyone can enter into your VM through these... + +# FTP (both active and passive FTP is always enabled) +# ftp localhost 8887 +#8887 = 192.168.76.128:21 + +# WEB (make sure that if you are using named webhosting, names point to +# your host, not to guest... And if you are forwarding port other +# than 80 make sure that your server copes with mismatched port +# number in Host: header) +# lynx http://localhost:8888 +#8888 = 192.168.76.128:80 + +# SSH +# ssh -p 8889 root@localhost +#8889 = 192.168.76.128:22 + +[incomingudp] +# UDP port forwarding example +#6000 = 192.168.76.128:6001 diff --git a/VMware-server-run_script.patch b/VMware-server-run_script.patch new file mode 100644 index 0000000..b746825 --- /dev/null +++ b/VMware-server-run_script.patch @@ -0,0 +1,349 @@ +--- vmware-distrib/bin/vmware 2005-03-23 05:54:18.000000000 -0600 ++++ vmware-distrib.new/bin/vmware 2005-04-13 09:35:12.000000000 -0500 +@@ -8,162 +8,7 @@ + # the VMware software is installed. --hpreg + # + +-# BEGINNING_OF_DB_DOT_SH +-#!/bin/sh +- +-# +-# Manage an installer database +-# +- +-# Add an answer to a database in memory +-db_answer_add() { +- local dbvar="$1" # IN/OUT +- local id="$2" # IN +- local value="$3" # IN +- local answers +- local i +- +- eval "$dbvar"'_answer_'"$id"'="$value"' +- +- eval 'answers="$'"$dbvar"'_answers"' +- # There is no double quote around $answers on purpose +- for i in $answers; do +- if [ "$i" = "$id" ]; then +- return +- fi +- done +- answers="$answers"' '"$id" +- eval "$dbvar"'_answers="$answers"' +-} +- +-# Remove an answer from a database in memory +-db_answer_remove() { +- local dbvar="$1" # IN/OUT +- local id="$2" # IN +- local new_answers +- local answers +- local i +- +- eval 'unset '"$dbvar"'_answer_'"$id" +- +- new_answers='' +- eval 'answers="$'"$dbvar"'_answers"' +- # There is no double quote around $answers on purpose +- for i in $answers; do +- if [ "$i" != "$id" ]; then +- new_answers="$new_answers"' '"$i" +- fi +- done +- eval "$dbvar"'_answers="$new_answers"' +-} +- +-# Load all answers from a database on stdin to memory (_answer_* +-# variables) +-db_load_from_stdin() { +- local dbvar="$1" # OUT +- +- eval "$dbvar"'_answers=""' +- +- # read doesn't support -r on FreeBSD 3.x. For this reason, the following line +- # is patched to remove the -r in case of FreeBSD tools build. So don't make +- # changes to it. -- Jeremy Bar +- while read -r action p1 p2; do +- if [ "$action" = 'answer' ]; then +- db_answer_add "$dbvar" "$p1" "$p2" +- elif [ "$action" = 'remove_answer' ]; then +- db_answer_remove "$dbvar" "$p1" +- fi +- done +-} +- +-# Load all answers from a database on disk to memory (_answer_* +-# variables) +-db_load() { +- local dbvar="$1" # OUT +- local dbfile="$2" # IN +- +- db_load_from_stdin "$dbvar" < "$dbfile" +-} +- +-# Iterate through all answers in a database in memory, calling with +-# id/value pairs and the remaining arguments to this function +-db_iterate() { +- local dbvar="$1" # IN +- local func="$2" # IN +- shift 2 +- local answers +- local i +- local value +- +- eval 'answers="$'"$dbvar"'_answers"' +- # There is no double quote around $answers on purpose +- for i in $answers; do +- eval 'value="$'"$dbvar"'_answer_'"$i"'"' +- "$func" "$i" "$value" "$@" +- done +-} +- +-# If it exists in memory, remove an answer from a database (disk and memory) +-db_remove_answer() { +- local dbvar="$1" # IN/OUT +- local dbfile="$2" # IN +- local id="$3" # IN +- local answers +- local i +- +- eval 'answers="$'"$dbvar"'_answers"' +- # There is no double quote around $answers on purpose +- for i in $answers; do +- if [ "$i" = "$id" ]; then +- echo 'remove_answer '"$id" >> "$dbfile" +- db_answer_remove "$dbvar" "$id" +- return +- fi +- done +-} +- +-# Add an answer to a database (disk and memory) +-db_add_answer() { +- local dbvar="$1" # IN/OUT +- local dbfile="$2" # IN +- local id="$3" # IN +- local value="$4" # IN +- +- db_remove_answer "$dbvar" "$dbfile" "$id" +- echo 'answer '"$id"' '"$value" >> "$dbfile" +- db_answer_add "$dbvar" "$id" "$value" +-} +- +-# Add a file to a database on disk +-# 'file' is the file to put in the database (it may not exist on the disk) +-# 'tsfile' is the file to get the timestamp from, '' if no timestamp +-db_add_file() { +- local dbfile="$1" # IN +- local file="$2" # IN +- local tsfile="$3" # IN +- local date +- +- if [ "$tsfile" = '' ]; then +- echo 'file '"$file" >> "$dbfile" +- else +- date=`date -r "$tsfile" '+%s' 2> /dev/null` +- if [ "$date" != '' ]; then +- date=' '"$date" +- fi +- echo 'file '"$file$date" >> "$dbfile" +- fi +-} +- +-# Add a directory to a database on disk +-db_add_dir() { +- local dbfile="$1" # IN +- local dir="$2" # IN +- +- echo 'directory '"$dir" >> "$dbfile" +-} +-# END_OF_DB_DOT_SH +- +-db_load 'vm_db' '/etc/vmware/locations' ++. /etc/vmware/locations + + if [ "vmware" = "vmware-console" ]; then + vmware_config_name="vmware-config-console" +--- vmware-distrib/vmware-console-distrib/bin/vmware-console~ 2006-03-01 21:07:14.275705656 +0100 ++++ vmware-distrib/vmware-console-distrib/bin/vmware-console 2006-03-01 21:08:49.076293776 +0100 +@@ -8,173 +8,18 @@ + # the VMware software is installed. --hpreg + # + +-# BEGINNING_OF_DB_DOT_SH +-#!/bin/sh ++. /etc/vmware-console/locations + +-# +-# Manage an installer database +-# +- +-# Add an answer to a database in memory +-db_answer_add() { +- local dbvar="$1" # IN/OUT +- local id="$2" # IN +- local value="$3" # IN +- local answers +- local i +- +- eval "$dbvar"'_answer_'"$id"'="$value"' +- +- eval 'answers="$'"$dbvar"'_answers"' +- # There is no double quote around $answers on purpose +- for i in $answers; do +- if [ "$i" = "$id" ]; then +- return +- fi +- done +- answers="$answers"' '"$id" +- eval "$dbvar"'_answers="$answers"' +-} +- +-# Remove an answer from a database in memory +-db_answer_remove() { +- local dbvar="$1" # IN/OUT +- local id="$2" # IN +- local new_answers +- local answers +- local i +- +- eval 'unset '"$dbvar"'_answer_'"$id" +- +- new_answers='' +- eval 'answers="$'"$dbvar"'_answers"' +- # There is no double quote around $answers on purpose +- for i in $answers; do +- if [ "$i" != "$id" ]; then +- new_answers="$new_answers"' '"$i" +- fi +- done +- eval "$dbvar"'_answers="$new_answers"' +-} +- +-# Load all answers from a database on stdin to memory (_answer_* +-# variables) +-db_load_from_stdin() { +- local dbvar="$1" # OUT +- +- eval "$dbvar"'_answers=""' +- +- # read doesn't support -r on FreeBSD 3.x. For this reason, the following line +- # is patched to remove the -r in case of FreeBSD tools build. So don't make +- # changes to it. -- Jeremy Bar +- while read -r action p1 p2; do +- if [ "$action" = 'answer' ]; then +- db_answer_add "$dbvar" "$p1" "$p2" +- elif [ "$action" = 'remove_answer' ]; then +- db_answer_remove "$dbvar" "$p1" +- fi +- done +-} +- +-# Load all answers from a database on disk to memory (_answer_* +-# variables) +-db_load() { +- local dbvar="$1" # OUT +- local dbfile="$2" # IN +- +- db_load_from_stdin "$dbvar" < "$dbfile" +-} +- +-# Iterate through all answers in a database in memory, calling with +-# id/value pairs and the remaining arguments to this function +-db_iterate() { +- local dbvar="$1" # IN +- local func="$2" # IN +- shift 2 +- local answers +- local i +- local value +- +- eval 'answers="$'"$dbvar"'_answers"' +- # There is no double quote around $answers on purpose +- for i in $answers; do +- eval 'value="$'"$dbvar"'_answer_'"$i"'"' +- "$func" "$i" "$value" "$@" +- done +-} +- +-# If it exists in memory, remove an answer from a database (disk and memory) +-db_remove_answer() { +- local dbvar="$1" # IN/OUT +- local dbfile="$2" # IN +- local id="$3" # IN +- local answers +- local i +- +- eval 'answers="$'"$dbvar"'_answers"' +- # There is no double quote around $answers on purpose +- for i in $answers; do +- if [ "$i" = "$id" ]; then +- echo 'remove_answer '"$id" >> "$dbfile" +- db_answer_remove "$dbvar" "$id" +- return +- fi +- done +-} +- +-# Add an answer to a database (disk and memory) +-db_add_answer() { +- local dbvar="$1" # IN/OUT +- local dbfile="$2" # IN +- local id="$3" # IN +- local value="$4" # IN +- +- db_remove_answer "$dbvar" "$dbfile" "$id" +- echo 'answer '"$id"' '"$value" >> "$dbfile" +- db_answer_add "$dbvar" "$id" "$value" +-} +- +-# Add a file to a database on disk +-# 'file' is the file to put in the database (it may not exist on the disk) +-# 'tsfile' is the file to get the timestamp from, '' if no timestamp +-db_add_file() { +- local dbfile="$1" # IN +- local file="$2" # IN +- local tsfile="$3" # IN +- local date +- +- if [ "$tsfile" = '' ]; then +- echo 'file '"$file" >> "$dbfile" +- else +- date=`date -r "$tsfile" '+%s' 2> /dev/null` +- if [ "$date" != '' ]; then +- date=' '"$date" +- fi +- echo 'file '"$file$date" >> "$dbfile" +- fi +-} +- +-# Add a directory to a database on disk +-db_add_dir() { +- local dbfile="$1" # IN +- local dir="$2" # IN +- +- echo 'directory '"$dir" >> "$dbfile" +-} +-# END_OF_DB_DOT_SH +- +-db_load 'vm_db' '/etc/vmware-console/locations' +- +-if [ -e '/etc/vmware-console/not_configured' ]; then ++if [ -e '/etc/vmware-console/not_configured' ]; then + echo 'vmware-console is installed, but it has not been (correctly) configured' + echo 'for this system. To (re-)configure it, invoke the following command:' +- echo "$vm_db_answer_BINDIR"'/vmware-config-console.pl.' ++ echo "$VM_BINDIR"'/vmware-config-console.pl.' + echo + + exit 1 + fi + +-exec "$vm_db_answer_LIBDIR"'/lib/wrapper-gtk24.sh' \ +- "$vm_db_answer_LIBDIR"'/lib' \ +- "$vm_db_answer_LIBDIR"'/bin/vmware-console' \ +- "$vm_db_answer_LIBDIR"'/libconf' "$@" ++exec "$VM_LIBDIR"'/lib/wrapper-gtk24.sh' \ ++ "$VM_LIBDIR"'/lib' \ ++ "$VM_LIBDIR"'/bin/vmware-console' \ ++ "$VM_LIBDIR"'/libconf' "$@" diff --git a/VMware-server-vmnet.conf b/VMware-server-vmnet.conf new file mode 100644 index 0000000..4d62051 --- /dev/null +++ b/VMware-server-vmnet.conf @@ -0,0 +1,18 @@ +# +# Configuration file for VMware Workstation networking +# + +# Wanna VMware Workstation networking? +VM_NETWORKING=yes + +# Bridged networking on /dev/vmnet0 - sufficient in most cases +VNET_0_INTERFACE=eth0 + +# Host-only networking on /dev/vmnet1 - samba subpackage needed +#VNET_1_HOSTONLY_HOSTADDR=192.168.23.1 +#VNET_1_HOSTONLY_NETMASK=255.255.255.0 + +# NAT networking on /dev/vmnet8 +#VNET_8_NAT=yes +#VNET_8_HOSTONLY_NETMASK=255.255.255.0 +#VNET_8_HOSTONLY_HOSTADDR=192.168.76.2 diff --git a/VMware-server.desktop b/VMware-server.desktop new file mode 100644 index 0000000..31e3653 --- /dev/null +++ b/VMware-server.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=VMware Workstation +Type=Application +Comment=VMware Workstation +Comment[pl]=VMware Workstation +Exec=vmware +Icon=VMware-workstation.png +Terminal=false +Categories=Utility;Emulator; +Encoding=UTF-8 +# vi: encoding=utf-8 diff --git a/VMware-server.init b/VMware-server.init new file mode 100755 index 0000000..9a30488 --- /dev/null +++ b/VMware-server.init @@ -0,0 +1,450 @@ +#!/bin/sh + +# +# Copyright 1998 VMware, Inc. All rights reserved. +# + +# vmnet: Manages the services needed to run VMware networking +# +# description: Manages the services needed to run VMware networking +# +# chkconfig: 235 90 8 +# +# probe: true +# hide: true + +subsys=vmnet +driver=vmmon +vnet=vmnet +bridge=vmnet-bridge +dhcpd=vmnet-dhcpd +netifup=vmnet-netifup +natd=vmnet-natd +ping=vmware-ping +smbd=vmware-smbd +nmbd=vmware-nmbd + +# Source config files +vmware_etc_dir=/etc/vmware +vmnet_cfg="$vmware_etc_dir"/vmnet.conf +VM_BINDIR=/usr/bin + +for f in $vmnet_cfg; do + if [ -r $f ]; then + . $f + else + echo "FATAL: Unable to read $f" + exit 1 + fi +done + +# System wide functions +. /etc/rc.d/init.d/functions + +# Create /dev/vmnetXX device +vmware_create_vmnet() { + local vHubNr="$1" # IN + local vDevice="/dev/vmnet$vHubNr" + + if [ ! -e "$vDevice" ]; then + mknod -m 600 "$vDevice" c 119 "$vHubNr" + fi +} + +# +# Create a temporary directory +# + +# They are a lot of small utility programs to create temporary files in a +# secure way, but none of them is standard. So I wrote this --hpreg +make_tmp_dir() { + local dirname="$1" # OUT + local prefix="$2" # IN + local tmp + local serial + local loop + + tmp="${TMPDIR:-/tmp}" + # Don't overwrite existing user data + # -> Create a directory with a name that didn't exist before + # + # This may never succeed (if we are racing with a malicious process), but at + # least it is secure + serial=0 + loop='yes' + while [ "$loop" = 'yes' ]; do + # Check the validity of the temporary directory. We do this in the loop + # because it can change over time + if [ ! -d "$tmp" ]; then + echo 'Error: "'"$tmp"'" is not a directory.' + echo + exit 1 + fi + if [ ! -w "$tmp" -o ! -x "$tmp" ]; then + echo 'Error: "'"$tmp"'" should be writable and executable.' + echo + exit 1 + fi + # Be secure + # -> Don't give write access to other users (so that they can not use this + # directory to launch a symlink attack) + if mkdir -m 0755 "$tmp"'/'"$prefix$serial" >/dev/null 2>&1; then + loop='no' + else + serial=`expr "$serial" + 1` + if [ "`expr "$serial" % 200`" = '0' ]; then + echo 'Warning: The "'"$tmp"'" directory may be under attack.' + echo + fi + fi + done + eval "$dirname"'="$tmp"'"'"'/'"'"'"$prefix$serial"' +} + +# +# Utilities +# + +# Compute the subnet address associated to a couple IP/netmask +ipv4_subnet() { + local ip="$1" + local netmask="$2" + + # Split quad-dotted addresses into bytes + # There is no double quote around the back-quoted expression on purpose + # There is no double quote around $ip and $netmask on purpose + set -- `IFS='.'; echo $ip $netmask` + echo $(($1 & $5)).$(($2 & $6)).$(($3 & $7)).$(($4 & $8)) +} + +# Compute the broadcast address associated to a couple IP/netmask +ipv4_broadcast() { + local ip="$1" + local netmask="$2" + + # Split quad-dotted addresses into bytes + # There is no double quote around the back-quoted expression on purpose + # There is no double quote around $ip and $netmask on purpose + set -- `IFS='.'; echo $ip $netmask` + echo $(($1 | (255 - $5))).$(($2 | (255 - $6))).$(($3 | (255 - $7))).$(($4 | (255 - $8))) +} + +# Count the number of running virtual machines by looking at the number of references +# to the $driver module. +countVMs() { + # Beware of module dependancies here. An exact match is important + /sbin/lsmod | awk 'BEGIN {n = 0;} {if ($1 == "'"$driver"'") n = $3;} END {print n;}' +} + +# Check if there is an IP route for a given subnet via a given interface +# Return true if there is _NO_ such route +noRoutePresent() { + local subnet="$1" # IN + local intf="$2" # IN + + # Beware, there may be several identical routes + [ "`/sbin/route -n | grep '^'"$subnet"'.*'"$intf"'$'`" = '' ] +} + + +# Macro definitions +# +# Note: +# . Each daemon must be started from its own directory to avoid busy devices +# . Each PID file doesn't need to be added to the installer database, because +# it is going to be automatically removed when it becomes stale (after a +# reboot). It must go directly under /var/run, or some distributions +# (RedHat 6.0) won't clean it +# + +# Terminate a process synchronously +vmware_synchrone_kill() { + local pid="$1" # IN + local signal="$2" # IN + local second + + kill -"$signal" "$pid" + # Wait a bit to see if the dirty job has really been done + for second in 0 1 2 3 4 5 6 7 8 9 10; do + if [ ! -d /proc/"$pid" ]; then + # Success + return 0 + fi + sleep 1 + done + # Timeout + return 1 +} + +# Kill the process associated to a pidfile +vmware_stop_pidfile() { + local pidfile="$1" # IN + local pid + + pid=`cat "$pidfile" 2>/dev/null` + if [ "$pid" = '' ]; then + # The file probably does not exist or is empty. Success + return 0 + fi + # Keep only the first number we find, because some Samba pid files are really + # trashy: they end with NUL characters + # There is no double quote around $pid on purpose + set -- $pid + pid="$1" + # First try a nice SIGTERM + if vmware_synchrone_kill "$pid" 15; then + return 0 + fi + # Then send a strong SIGKILL + if vmware_synchrone_kill "$pid" 9; then + return 0 + fi + return 1 +} + +# Start the host-only network user service +vmware_start_hostonly() { + local vHubNr="$1" # IN + local vHostIf="$2" # IN + local ifIp="$3" # IN + local ifMask="$4" # IN + local run_dhcpd="$5" # IN + local run_samba="$6" # IN + local ifNet + + # Do a cursory check to see if the host-only network + # configuration is still ok. We do this so that mobile + # hosts don't get setup at install time and then moved to + # a new locale where the host-only network config is no + # longer valid. + # + # NB: This really needs to be done at power-on time when + # VM is configured to use host-only networking so that + # we aren't fooled by dynamic changes in the network. + # + # XXX ping takes 10 seconds to timeout if nobody answers + # that slows boot too much so we do this bit in the + # background. + if "$VM_BINDIR"/"$ping" -q "$ifIp"; then + echo 'Host-only networking disabled because '"$ifIp" + echo 'appears to be a real, physical, existing address.' + echo 'Please modify your host-only network configuration.' + exit 1 + fi + cd "$VM_BINDIR" && "$VM_BINDIR"/"$netifup" \ + -d /var/run/"$netifup"-"$vHostIf".pid /dev/vmnet"$vHubNr" "$vHostIf" + [ "$?" -eq 0 ] || exit 1 + # Configure the virtual host ethernet interface and define the private IP + # network + # + # . We provide the broadcast address explicitly because versions of ifconfig + # prior to 1.39 (1999-03-18) seem to miscompute it + # . 2.0.x kernels don't install a route when the interface is marked up, but + # 2.2.x kernel do. Since we want to see any errors from route we don't + # just discard messages from route, but instead check if the route got + # installed before manually adding one. + ifNet=`ipv4_subnet "$ifIp" "$ifMask"` + if ifconfig "$vHostIf" inet "$ifIp" netmask "$ifMask" \ + broadcast "`ipv4_broadcast "$ifIp" "$ifMask"`" up \ + && noRoutePresent "$ifNet" "$vHostIf"; then + route add -net "$ifNet" netmask "$ifMask" "$vHostIf" + fi + if [ "$run_dhcpd" = 'yes' ]; then + # Start a DHCP server on a private IP network + # The daemon already logs its output in the system log, so we can safely + # trash it + cd "$VM_BINDIR" && "$VM_BINDIR"/"$dhcpd" \ + -cf "$vmware_etc_dir"/"$vHostIf"/dhcpd/dhcpd.conf \ + -lf "$vmware_etc_dir"/"$vHostIf"/dhcpd/dhcpd.leases \ + -pf /var/run/"$dhcpd"-"$vHostIf".pid "$vHostIf" >/dev/null 2>&1 || exit 1 + fi + if [ "$run_samba" = 'yes' ]; then + # Start a SMB name server on a private IP network + # Disable logging to avoid the uncontrolled creation of unmanaged files + cd "$VM_BINDIR" && "$VM_BINDIR"/"$nmbd" -D -l /dev/null \ + -s "$vmware_etc_dir"/"$vHostIf"/smb/smb.conf \ + -f /var/run/"$nmbd"-"$vHostIf".pid || exit 1 + # Start a SMB share server on a private IP network + # Disable logging to avoid the uncontrolled creation of unmanaged files + cd "$VM_BINDIR" && "$VM_BINDIR"/"$smbd" -D -l /dev/null \ + -s "$vmware_etc_dir"/"$vHostIf"/smb/smb.conf \ + -f /var/run/"$smbd"-"$vHostIf".pid || exit 1 + fi +} + +# Stop the host-only network user service +vmware_stop_hostonly() { + local vHostIf="$1" # IN + local ifIp="$2" # IN + local ifMask="$3" # IN + local ifNet + + # Terminate the private network + ifNet=`ipv4_subnet "$ifIp" "$ifMask"` + noRoutePresent "$ifNet" "$vHostIf" || route del -net "$ifNet" netmask "$ifMask" || exit 1 + # To test if the interface exists, we can not just look at the exitcode + # because old versions of ifconfig don't exit with 1 when invoked with a + # non-existing interface + if [ "`ifconfig "$vHostIf" 2>/dev/null`" != '' ]; then + ifconfig "$vHostIf" down || exit 1 + fi + vmware_stop_pidfile /var/run/"$netifup"-"$vHostIf".pid || exit 1 +} + +# See how we were called. +case "$1" in + start) + if [ -f /var/lock/subsys/"$subsys" ]; then + msg_already_running "VMware Workstation networking" + fi + # Try to load parport_pc. Failure is allowed as it does not exist + # on kernels 2.0 + /sbin/modprobe parport_pc >/dev/null 2>&1 + msg_starting 'Virtual machine monitor' + busy + /sbin/modprobe $driver + [ "$?" -eq "0" ] && ok || fail + if [ "$VM_NETWORKING" = 'yes' ]; then + msg_starting 'Virtual ethernet' + busy + /sbin/modprobe $vnet + [ "$?" -eq 0 ] && ok || fail + vHubNr=0 + while [ $vHubNr -lt 9 ]; do + eval 'interface="$VNET_'"$vHubNr"'_INTERFACE"' + eval 'hostaddr="$VNET_'"$vHubNr"'_HOSTONLY_HOSTADDR"' + eval 'netmask="$VNET_'"$vHubNr"'_HOSTONLY_NETMASK"' + if [ -n "$interface" ]; then + vmware_create_vmnet "$vHubNr" + # Connect a physical host ethernet interface to a virtual ethernet hub + msg_starting 'Bridged networking on /dev/vmnet'"$vHubNr" + busy + cd "$VM_BINDIR" && "$VM_BINDIR"/"$bridge" \ + -d /var/run/"$bridge"-"$vHubNr".pid /dev/vmnet"$vHubNr" "$interface" + [ "$?" -eq 0 ] && ok || fail + elif [ -n "$hostaddr" -a -n "$netmask" ]; then + vmware_create_vmnet "$vHubNr" + eval 'samba="$VNET_'"$vHubNr"'_SAMBA"' + msg_starting 'Host-only networking on /dev/vmnet'"$vHubNr" + busy + vmware_start_hostonly "$vHubNr" 'vmnet'"$vHubNr" "$hostaddr" \ + "$netmask" 'yes' "$samba" + [ "$?" -eq 0 ] && ok || fail + eval 'nat="$VNET_'"$vHubNr"'_NAT"' + if [ "$nat" = 'yes' ]; then + # Start the NAT network user service + msg_starting 'NAT networking on /dev/vmnet'"$vHubNr" + busy + cd "$VM_BINDIR" && "$VM_BINDIR"/"$natd" \ + -d /var/run/"$natd"-"$vHubNr".pid \ + -m /var/run/"$natd"-"$vHubNr".mac \ + -c "$vmware_etc_dir"/vmnet"$vHubNr"/nat/nat.conf >/dev/null 2>&1 + [ "$?" -eq 0 ] && ok || fail + fi + fi + vHubNr=$(($vHubNr + 1)) + done + fi + touch /var/lock/subsys/"$subsys" + ;; + + stop) + if [ "`countVMs`" -gt 0 ]; then + echo 'At least one instance of VMware Workstation is still running.' + echo 'Please stop all running instances of VMware Workstation first.' + echo + fi + if [ ! -f /var/lock/subsys/"$subsys" ]; then + msg_not_running "VMware Workstation networking" + fi + # Try to unload parport_pc. Failure is allowed as it does not exist + # on kernels 2.0, and some other process could be using it. + /sbin/modprobe -r parport_pc >/dev/null 2>&1 + if [ "$VM_NETWORKING" = "yes" ]; then + # NB: must kill off processes using vmnet before + # unloading module + vHubNr=0 + while [ $vHubNr -lt 9 ]; do + eval 'interface="$VNET_'"$vHubNr"'_INTERFACE"' + eval 'hostaddr="$VNET_'"$vHubNr"'_HOSTONLY_HOSTADDR"' + eval 'netmask="$VNET_'"$vHubNr"'_HOSTONLY_NETMASK"' + if [ -n "$interface" ]; then + # Disconnect a physical host ethernet interface from a virtual ethernet hub + msg_stopping "Bridged networking on /dev/vmnet$vHubNr" + busy + vmware_stop_pidfile /var/run/"$bridge"-"$vHubNr".pid + [ "$?" -eq 0 ] && ok || fail + elif [ -n "$hostaddr" -a -n "$netmask" ]; then + # Stop a DHCP server on a private IP network + msg_stopping "DHCP server on /dev/vmnet$vHubNr" + busy + vmware_stop_pidfile /var/run/"$dhcpd"-"vmnet$vHubNr".pid + [ "$?" -eq 0 ] && ok || fail + eval 'samba="$VNET_'"$vHubNr"'_SAMBA"' + if [ "$samba" = "yes" ]; then + # Stop a SMB share server on a private IP network + msg_stopping 'SMB share server on /dev/vmnet'"$vHubNr" + busy + vmware_stop_pidfile /var/run/"$smbd"-'vmnet'"$vHubNr".pid + [ "$?" -eq 0 ] && ok || fail + # Stop a SMB name server on a private IP network + msg_stopping 'SMB name server on /dev/vmnet'"$vHubNr" + busy + vmware_stop_pidfile /var/run/"$nmbd"-'vmnet'"$vHubNr".pid + [ "$?" -eq 0 ] && ok || fail + fi + eval 'nat="$VNET_'"$vHubNr"'_NAT"' + if [ "$nat" = "yes" ]; then + # Stop the NAT network user service + msg_stopping 'NAT networking on /dev/vmnet'"$vHubNr" + busy + vmware_stop_pidfile /var/run/"$natd"-"$vHubNr".pid + [ "$?" -eq 0 ] && ok || fail + fi + msg_stopping 'Host-only networking on /dev/vmnet'"$vHubNr" + busy + vmware_stop_hostonly 'vmnet'"$vHubNr" "$hostaddr" "$netmask" + [ "$?" -eq 0 ] && ok || fail + + fi + vHubNr=$(($vHubNr + 1)) + done + msg_stopping 'Virtual machine monitor' + busy + if /sbin/lsmod | grep -q ^"$driver"; then + /sbin/rmmod "$driver" + fi + [ "$?" -eq "0" ] && ok || fail + msg_stopping 'Virtual ethernet' + busy + if /sbin/lsmod | grep -q ^"$vnet"; then + /sbin/rmmod "$vnet" + fi + [ "$?" -eq "0" ] && ok || fail + fi + rm -f /var/lock/subsys/"$subsys" + ;; + status) + if [ "`countVMs`" -gt 0 ]; then + echo 'At least one instance of VMware Workstation is still running.' + echo + fi + if [ "$VM_NETWORKING" = "yes" ]; then + status "$bridge" + status "$dhcpd" + status "$netifup" + fi + if [ "$VM_NETWORKING" = "yes" ]; then + echo -n "Module $vnet " + /sbin/modprobe "$vnet" >/dev/null 2>&1 && echo installed || echo "not installed" + fi + ;; + restart) + "$0" stop && "$0" start + ;; + *) + echo "Usage: `basename "$0"` {start|stop|status|restart}" + exit 3 +esac + +exit 0 diff --git a/VMware-server.png b/VMware-server.png new file mode 100644 index 0000000000000000000000000000000000000000..3de65fb033b3f018a02d7fcbd201c4f006625049 GIT binary patch literal 6026 zcmV;57j@`~P)1_?b80))`%9@5?I?(Oc(bbtAyr)PWj4!9GLk*02Dc6NHc_wW04FEKNw zv%R?YXnM!Kfwd&OMMNS60HA3-;>0($e;BOQAhZ6>HJ@I(@4Y;drlWwrx#ia@Up_E$ zzwk2)hzLXg(f^n9vGB}b2EYuh6-Pn&j!&J#Uth6!K`ocdP5XIbsyE*Iix1P%QB1l0Hf*=Uyn9#7(d)%9!my99I*dz!-Nb*u`fBoPShkm$v_3BJ-Z|}6NF=Y?9 zWc`osOJ!$XC1Sye1cU&x84p3I5k`7~rQXZd>{*^5q*D^rKtX8+YldbGtr;q)@*jTn z-OC2wc;RVgE>CA1Z>l#6;jc|BBt#PSm1+crNdwFrhbhPZIf>h;OAZhS_DKW+5kWDd zQj6>@fFO{Ly+!)eGUKGr19**y4lr}{zAJ!8%yMI%$Vv?pj~ollY^=|m2r=D_j21v7 zz{DUB1g!RB1u){P3M2%C^ydLM9l%=vitoDu8ZBgPUKf~|!CHfLe2h3*oq!7%9TNmG zNDx2*TGSJkRS<~bL`n+4TmUT}i~^{!+OcDCtr@lPk@D+1AKz9w{^n7WTG;uf@e?#Y zf|{8N}99sq#ddd!UC@au!y9=_?` zN^!6VAOcW{Z`JYcVWKMt0LnSn@ilVJB>?rt%a1>^@S|6L@^Tw({}OOb)8J#$W7dMl zxBheI=PtbPLhRnXJ24Ou#d%7HN~zsXJ@wR`H{X2o9UC@m2zq;arnSS%unB519lwT4m(Q4}GHA}FO0hGBASKXdP?)oQ3# zs|ac}fHjykz#3o$Kqtv~vS+*FhGB?Osf4z+w#(P9UHf$a?Ne5OhylJ30wk=Z1O!=F z(wOCc`O9Cf9UUEAP_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