Showing posts with label gotcha. Show all posts
Showing posts with label gotcha. Show all posts

Jan 3, 2013

Citrix XenApp Fundamentals installation on AWS



Installing a trial version was a painful experience, description below.

Create a new Windows 2008 R2 x64 Amazon instance, I used AMI:Windows_Server-2008-R2_SP1-English-64Bit-Base-2012.12.12 (ami-2542c04c).

The following ports should be open in security group:
tcp 80,tcp 443,tcp 1494,tcp 2598,tcp 3389

Download the installation image - XAF_6_0_0_ML_dvd.iso.
Mount the ISO with Virtual CloneDrive or any other tool, launch setup.

After a few minutes setup will crash.
Quit the installation and restart the server.

Uninstall Citrix Licensing server, and launch setup again. This time installation will prompt you to restart.
After restart, launch setup again, it will continue.

Launch Citrix Quick Start, setup the license.
Configure external access - for simplicity use self-signed certificate.
Either disable Windows firewall, or just verify that port 443 is open.

Current version of Google Chrome cannot navigate to the citrix url (https://hostname/CitrixAccess/site/default.aspx), probably old/unsupported tls version, use other browser.

By default citrix assumes that you're logging in with domain+user+password, since aws machine is in workgroup mode, you need to use the machine name instead, same name that you used for license.

Since you used self-signed certificate, launching citrix will fail with message: untrusted root certificate - Citrix Access Essentials Test Root Certificate.

QuickStart -> External Access -> Save Root certificate (rootcert.cer), transfer it to your desktop and install.


Jun 5, 2012

Slow start of java servers on linux VM


During server boot sequence, java process hangs with no apparent IO/CPU activity.
Running "cat /proc/sys/kernel/random/entropy_avail" prints low number < 100.
Usually this means that server tries to read random data from /dev/random, and blocks.
Sample stack of such process might look similar to this:

...    at java/io/FileInputStream.read(FileInputStream.java:220)    at sun/security/provider/NativePRNG$RandomIO.readFully(NativePRNG.java:185)    at sun/security/provider/NativePRNG$RandomIO.implGenerateSeed(NativePRNG.java:202)(NativePRNG.java:202)    ^-- Holding lock: java/lang/Object@0x9e5d2e80[biased lock]    at sun/security/provider/NativePRNG$RandomIO.access$300(NativePRNG.java:108)    at sun/security/provider/NativePRNG$RandomIO.access$300(NativePRNG.java:108)    at sun/security/provider/NativePRNG.engineGenerateSeed(NativePRNG.java:102)    at java/security/SecureRandom.generateSeed    at java/security/SecureRandom.generateSeed(SecureRandom.java:495)...

What happens?

Linux keeps track of how much random data was read, and blocks /dev/random reading if there is no "entropy" available.
Entropy regeneration depends on entropy sources: some semi-random events, like network card/disk keyboard/mouse signals. On a machine without keyboard/mouse/display (virtual machine as an example), kernel has less sources of randomness, and regeneration could be slow.

What I can do?

Blocking random source, might make sense in security-sensitive environment, on production servers, but in most cases pointless on dev/test VM, and just wastes your time.
Attaching hardware random noise generator, redefining randomness source to /dev/urandom, are possible  solutions, but there is a simple hack: this script (http://pastebin.com/jxEDbbXK).
It will copy data from /dev/urandom to /dev/random, feeding it with "fake entropy", and thus unblocking pending reads from /dev/random.

The script should to be run as root/sudo (to be able to write into /dev/random). Upon completion it will print random bits count before, and after injection. Usually, number <= 100 means that your system was "starving". It is possible to execute it as cron job, but I usually just run it manually before/during service restart.

Disclaimer: it's probably a bad idea to run this script on production environment! Random data, used to generate cryptographic keys for ssl/ssh is "less random".

Jan 5, 2011

VMware Server weirdness

Virtual machine working flawlessly on my PC, but adding the same image on another machine fails with some unrelated log entries:
...\VMware\VMware Server\hostd-0.log


[xxxx 'Vmsvc' 8376 info] Foundry_CreateEx failed: Error: (4002) Cannot read the virtual machine configuration file[xxxx 'vm:C:\Virtual Machines\xxx\xxx.vmx' 8376 info] Failed to load virtual machine.
[xxxx 'vm:C:\Virtual Machines\xxx\xxx.vmx' 8376 info] Failed to load virtual machine. Marking as unavailable: vim.fault.InvalidVmConfig

The difference is in the default system locale, which is reflected in .vmx and(!) .vmdk:
machine 1: 
.vmx:
.encoding = "windows-1251"
.vmdk:
ddb.encoding = "windows-1251"

machine 2 .vmx:
.encoding = "windows-1255"
.vmdk:
ddb.encoding = "windows-1255"

VMware server version: 2.0, running on Windows XP/Windows 7

Hint:
Editing .vmdk file is not trivial on windows, most editors will fail to handle multi gigabyte files, you can use biew/beye utility for this.

Nov 6, 2007

Microsoft Platform SDK

It appears that PSDK (Windows Server 2003 R2) does not recognize Visual C Express installation, and therefore Build Envs are not functioning.
VCDetect.Exe invoked during PSDK installation, ad should find Visual studio, and create setenv.bat.
To make story short, here how it should look:

@ECHO OFF
CALL "C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\VSVars32.bat"
SET MSVCVer=8.0


Long story:

VCDetect.Exe looks up in the registry keys:
SOFTWARE\Microsoft\VisualStudio\(7.0|7.1|8.0)\Setup\VS\ProductDir


Visual studio express also has this key, but in:
SOFTWARE\Microsoft\VCExpress\8.0\Setup\VC...