Saturday, July 14, 2012

OpenVPN Routing

Expanding the scope of the VPN to include additional machines on either the client or server subnet.


Including multiple machines on the server side when using a routed VPN (dev tun)


Once the VPN is operational in a point-to-point capacity between
client and server, it may be desirable to expand the scope of the VPN so
that clients can reach multiple machines on the server network, rather
than only the server machine itself.


For the purpose of this example, we will assume that the server-side LAN uses a subnet of 10.66.0.0/24 and the VPN IP address pool uses 10.8.0.0/24 as cited in the server directive in the OpenVPN server configuration file.


First, you must advertise the 10.66.0.0/24
subnet to VPN clients as being accessible through the VPN. This can
easily be done with the following server-side config file directive:



<strong>push "route 10.66.0.0 255.255.255.0"</strong>


Next, you must set up a route on the server-side LAN gateway to route the VPN client subnet (10.8.0.0/24) to the OpenVPN server (this is only necessary if the OpenVPN server and the LAN gateway are different machines).


Make sure that you've enabled IP and TUN/TAP forwarding on the OpenVPN server machine.


Including multiple machines on the server side when using a bridged VPN (dev tap)


One of the benefits of using ethernet bridging is that you get this for free without needing any additional configuration.


Including multiple machines on the client side when using a routed VPN (dev tun)


In a typical road-warrior or remote access scenario, the client
machine connects to the VPN as a single machine. But suppose the client
machine is a gateway for a local LAN (such as a home office), and you
would like each machine on the client LAN to be able to route through
the VPN.


For this example, we will assume that the client LAN is using the 192.168.4.0/24 subnet, and that the VPN client is using a certificate with a common name of client2.
Our goal is to set up the VPN so that any machine on the client LAN can
communicate with any machine on the server LAN through the VPN.


Before setup, there are some basic prerequisites which must be followed:


  • The client LAN subnet (192.168.4.0/24 in our example) must not be
    exported to the VPN by the server or any other client sites which are
    using the same subnet. Every subnet which is joined to the VPN via
    routing must be unique.
  • The client must have a unique Common Name in its certificate ("client2" in our example), and the duplicate-cn flag must not be used in the OpenVPN server configuration file.

First, make sure that IP and TUN/TAP forwarding is enabled on the client machine.


Next, we will deal with the necessary configuration changes on the
server side. If the server configuration file does not currently
reference a client configuration directory, add one now:



<strong>client-config-dir ccd</strong>


In the above directive, ccd should be the name of a
directory which has been pre-created in the default directory where the
OpenVPN server daemon runs. On Linux this tends to be /etc/openvpn and on Windows it is usually \Program Files\OpenVPN\config.
When a new client connects to the OpenVPN server, the daemon will check
this directory for a file which matches the common name of the
connecting client. If a matching file is found, it will be read and
processed for additional configuration file directives to be applied to
the named client.


The next step is to create a file called client2 in the ccd directory. This file should contain the line:



<strong>iroute 192.168.4.0 255.255.255.0</strong>


This will tell the OpenVPN server that the 192.168.4.0/24 subnet should be routed to client2.


Next, add the following line to the main server config file (not the ccd/client2 file):



<strong>route 192.168.4.0 255.255.255.0</strong>


Why the redundant route and iroute statements, you might ask? The reason is that route controls the routing from the kernel to the OpenVPN server (via the TUN interface) while iroute controls the routing from the OpenVPN server to the remote clients. Both are necessary.


Next, ask yourself if you would like to allow network traffic between
client2's subnet (192.168.4.0/24) and other clients of the OpenVPN
server. If so, add the following to the server config file.



<strong>client-to-client<br />push "route 192.168.4.0 255.255.255.0"</strong>


This will cause the OpenVPN server to advertise client2's subnet to other connecting clients.


The last step, and one that is often forgotten, is to add a route to
the server's LAN gateway which directs 192.168.4.0/24 to the OpenVPN
server box (you won't need this if the OpenVPN server box is
the gateway for the server LAN). Suppose you were missing this step and
you tried to ping a machine (not the OpenVPN server itself) on the
server LAN from 192.168.4.8? The outgoing ping would probably reach the
machine, but then it wouldn't know how to route the ping reply, because
it would have no idea how to reach 192.168.4.0/24. The rule of thumb to
use is that when routing entire LANs through the VPN (when the VPN
server is not the same machine as the LAN gateway), make sure that the
gateway for the LAN routes all VPN subnets to the VPN server machine.


Similarly, if the client machine running OpenVPN is not also the
gateway for the client LAN, then the gateway for the client LAN must
have a route which directs all subnets which should be reachable through
the VPN to the OpenVPN client machine.


Including multiple machines on the client side when using a bridged VPN (dev tap)


This requires a more complex setup (maybe not more complex in practice, but more complicated to explain in detail):


  • You must bridge the client TAP interface with the LAN-connected NIC on the client.
  • You must manually set the IP/netmask of the TAP interface on the client.
  • You must configure client-side machines to use an IP/netmask that is inside of the bridged subnet, possibly by querying a DHCP server on the OpenVPN server side of the VPN.

Saturday, February 18, 2012

Fixing no HDMI audio on 9600GT

From the link http://forums.nvidia.com/index.php?showtopic=88391&pid=513648&mode=threaded&start=0#entry513648

Got it to work, Example of mine.




nv_SoftwareDeviceSettings]

HKR,, OverrideEdidFlags0, %REG_BINARY%, 4C,2E,12,0A,00,00,FF,FF,04,00,00,00,7E,01,00

HKR,, InstalledDisplayDrivers, %REG_MULTI_SZ%, nv4_disp

HKR,, VgaCompatible, %REG_DWORD%, 0

HKR,, MultiFunctionSupported, %REG_DWORD%, 1

HKR,, RotateFlag, %REG_DWORD%, 4

HKR,, DevSwitchSuppressMask, %REG_DWORD%, 7

HKR,, HDTVModePruning, %REG_DWORD%, 6

HKLM,"Software\NVIDIA Corporation\Global\NvSvc\OemConfigurations"
,LoadLimitedSID,%REG_SZ%,"S-1-5-11"



HKR,, NV_Modes, %REG_MULTI_SZ%, "{*}S 720x480
720x576=1;720x576=8032;SHV 1680x1050=1;1920x1200x32 1920x1440
2048x1536=1F;640x480 800x600 848x480 960x600
1024x768x8,16=1FFF;1600x900x32 1600x1200x32
1920x1200x8,16=3F;1280x720x32 1280x768x32 1280x800x32 1280x960x32
1280x1024x32 1360x768x32=3FF;1600x900x8,16
1600x1200x8,16=7F;1280x720x8,16 1280x768x8,16 1280x800x8,16
1280x960x8,16 1280x1024x8,16 1360x768x8,16=7FF;1024x768x32 1152x864
1440x900=FFF;"



[nv_SoftwareDeviceSettings_G7x]

HKR,, InstalledDisplayDrivers, %REG_MULTI_SZ%, nv4_disp

HKR,, VgaCompatible, %REG_DWORD%, 0

HKR,, MultiFunctionSupported, %REG_DWORD%, 1

HKR,, RotateFlag, %REG_DWORD%, 4

HKR,, DevSwitchSuppressMask, %REG_DWORD%, 7

HKR,, HDTVModePruning, %REG_DWORD%, 6

HKLM,"Software\NVIDIA Corporation\Global\NvSvc\OemConfigurations"
,LoadLimitedSID,%REG_SZ%,"S-1-5-11"



HKR,, NV_Modes, %REG_MULTI_SZ%, "{*}S 720x480
720x576=1;720x576=8032;SHV 1680x1050=1;1920x1200x32 1920x1440
2048x1536=1F;640x480 800x600 848x480 960x600
1024x768x8,16=1FFF;1600x900x32 1600x1200x32
1920x1200x8,16=3F;1280x720x32 1280x768x32 1280x800x32 1280x960x32
1280x1024x32 1360x768x32=3FF;1600x900x8,16
1600x1200x8,16=7F;1280x720x8,16 1280x768x8,16 1280x800x8,16
1280x960x8,16 1280x1024x8,16 1360x768x8,16=7FF;1024x768x32 1152x864
1440x900=FFF;"



[nv_SoftwareDeviceSettings_77]

HKR,, OverrideEdidFlags0, %REG_BINARY%, 4C,2E,12,0A,00,00,FF,FF,04,00,00,00,7E,01,00

HKR,, InstalledDisplayDrivers, %REG_MULTI_SZ%, nv4_disp

HKR,, VgaCompatible, %REG_DWORD%, 0

HKR,, MultiFunctionSupported, %REG_DWORD%, 1

HKR,, RotateFlag, %REG_DWORD%, 4

HKR,, DevSwitchSuppressMask, %REG_DWORD%, 7

HKR,, HDTVModePruning, %REG_DWORD%, 6

HKLM,"Software\NVIDIA Corporation\Global\NvSvc\OemConfigurations"
,LoadLimitedSID,%REG_SZ%,"S-1-5-11"





Search your model of card, mine being a 8200 look
toward the bottom of the inf and it will have a number to the left of it
which mine was 77, so i found the line nv_softwaredeviceSettings_77 and
also added the line i inserted into nv_softwaredevicesettings. Hope
this helps :)






NVIDIA_C73.DEV_07E1.1 = "NVIDIA GeForce 7100 / NVIDIA nForce 630i"

NVIDIA_C73.DEV_07E2.1 = "NVIDIA GeForce 7050 / NVIDIA nForce 630i"

NVIDIA_C73.DEV_07E3.1 = "NVIDIA GeForce 7050 / NVIDIA nForce 610i"

NVIDIA_C73.DEV_07E5.1 = "NVIDIA GeForce 7050 / NVIDIA nForce 620i"

NVIDIA_C77.DEV_0846.1 = "NVIDIA GeForce 9200"

NVIDIA_C77.DEV_0848.1 = "NVIDIA GeForce 8300"

NVIDIA_C77.DEV_0849.1 = "NVIDIA GeForce 8200"

NVIDIA_C77.DEV_084A.1 = "NVIDIA nForce 730a"

NVIDIA_C77.DEV_084B.1 = "NVIDIA GeForce 8200 "

NVIDIA_C77.DEV_084C.1 = "NVIDIA nForce 780a SLI"

NVIDIA_C77.DEV_084D.1 = "NVIDIA nForce 750a SLI"

NVIDIA_C77.DEV_084F.1 = "NVIDIA GeForce 8100 / nForce 720a"

NVIDIA_C79.DEV_0860.1 = "NVIDIA GeForce 9400"

Friday, February 17, 2012

Protect your android from theft

I must recommend the following android applications as the best to protect and find your phone in case of theft:
1. Avast Mobile Security
2. Cerberus

I have tested many others but these came out the best with features, cost and especially rooted protection of the phone!
Also tried:
webroot, lookout, AVG, mcaffee,
Open Prey seems very good but pretty expensive!

Monday, December 12, 2011

Galaxy S I9000 unavailable internal sd / flash

Helping a friend with his Galaxy S I9000 which wouldn't boot has taught me the following things about the device:

1. Stock firmware - there is a difference between Froyo (2.2) and Gingerbread (2.3) stock firmware - they format the internal flash differently.
2. Heimdall is Opensource replacement for ODIN which can install a kernel when phone in download mode:

heimdall flash --kernel zImage

3. The nand partitions layout in Samsung Galaxy S I9000 is controlled by a pit file (Partition Information Table), while for the mmc drive, it is hard coded in the init file.

For example, in Samsung Galaxy S I9000, the stock partition tables for s1_odin_20100512.pit should look like this:

NAND disk */dev/block/stl1 - stl6 omitted
device name mount point size in MB remarks
/dev/block/stl7 n/a 7.5 known as KERNEL, for holding zImage
/dev/block/stl8 n/a 7.5 known as RECOVERY, for storing a copy of zImage
/dev/block/stl9 /system 286.5 known as FACTORYFS
/dev/block/stl10 /dbdata 134 known as DBDATA
/dev/block/stl11 /cache 35 known as CACHE
/dev/block/stl12 n/a 7.5 known as MODEM, for storing modem.bin
MMC disk
device name mount point size in MB remarks
/dev/block/mmcblk0p1 /mnt/sdcard (/sdcard) ~6200 (8G) / ~14200 (16G) none
/dev/block/mmcblk0p2 /data ~2000 none


For other pit files like s1_odin_20100513 and s1_odin_20100803, the size of /system and /dbdata are different. So for a larger /system partition, a smaller /dbdata and/or /cache will be resulted and vice versa since the total size of the nand is fixed (~500MB)

When we flash a rom to our phone, the above information will be read by odin to decide where the files will be stored. For instance, the zImage will be written to /dev/block/stl7 (/dev/block/bml7) and /dev/block/stl8 (/dev/block/bml8), while the FACTORYFS.rfs will be stored on /dev/block/stl9 (or /dev/block/bml9) at a specific start block address, up to the size of the file and so forth.

As a result, if we wanna use our own customized partition layout, we have to deal with the pit file and the mmc via fdisk or parted, etc


BOOT (bml01) = 01 = 1 = 0.25 MB (bootloader)
PIT (bml02) = 01 = 1 = 0,25 MB (the partition table)
EFS (bml03) = 28 = 40 = 10 MB (imei data and such)
SBL (bml04) = 05 = 5 = 1,25 MB (secondary bootloader)
SBL2 (bml05) = 05 = 5 = 1,25 MB (secondary bootloader backup)
PARAM (bml06) = 14 = 20 = 5 MB (the images shown when something is wrong)
KERNEL (bml07) = 1E = 30 = 7,5 MB (kernel image)
RECOVERY (bml08) = 1E = 30 = 7,5 MB (kernel image backup)
FACTORYFS (bml09) = 47A = 1146 = 286,5 MB (/system)
DBDATA (bml10) = 218 = 536 = 134 MB (/dbdata)
CACHE (bml11) = 8C = 140 = 35 MB (/cache)
MODEM (bml12) = 32 = 50 = 12,5 MB (software for wireless)

4. Parted download http://www.sendspace.com/file/w6hi6x

Note also that I had run unrevoked forever (so my phone was S-OFF) ... I'm not sure if that's required or not.

So, grab parted from the link above. Now you need to extract the individual binaries from the .zip (the 6 files in the sdparted folder within the zip), ideally to your android-sdk\tools directory. Now push all 6 files (adb push [file] /sbin/). Next, we need to make them useable, so go into the shell (adb shell). Change to your /sbin/ directory, and run: chmod 0755 on each of the 6 files.

Now, we need to fix the partitions. This is assuming that the partitions are there, just the wrong format (which is what happened to me .. I accidentally made them FAT32 instead of ext). So, run the following: parted /dev/block/mmcblk0 mkfs ext2. It will ask if you want to continue, hit yes. When it asks for the partition number, enter 1. Next, when it asks for the format, enter ext2. Let it do its thing. Now, once it's done, run parted again. This time, enter partition 2 (everything else is the same).

Once all that's done, your recovery program should be able to mount both the /data and /cache partitions. If that's true, you're pretty much done! One thing I found was that I couldn't directly install a new OS (I tried both Cyanogen and Ultimate). In both cases, it would look for stuff in the davik-cache that it couldn't find, so something wasn't installing correctly I think. So, if that happens, flash back to the stock PB31IMG.zip (put it in the root of your /sdcard/ and let hboot install it), and then root your phone anew. That's what I ended up doing.

Again, huge credit for this goes to -Steveo- and ciwrl for helping me figure out which partitions were the right ones (and for supplying parted, which I hadn't been able to find anywhere). If something doesn't end up working, just drop me a pm and we'll see what we can do.

5. Parted show partitions "print"
6. The phone should have 2 flash partitions as described. If they are not available - there is a problem with the flash module
7. More about PIT files: http://forum.xda-developers.com/showthread.php?t=816449 and
http://forum.xda-developers.com/showthread.php?t=999097

Saturday, July 30, 2011

HD2 Preferred network type

*#*#4636#*#*

Scroll Down and set your Preferred Network Type to GSM auto (PRL) - NOTE this does not disable 3G or HSDPA! Speed tests still show I am receiving speeds up to 2.4mbps - NOTE there will still be the 3G and H icons in your status bar
This will remove lots of logs if you are on GSM network and improve reception and reduce CPU use on idle.
Phone will not try to connect to WCDMA