Showing posts with label sun. Show all posts
Showing posts with label sun. Show all posts

Thursday, 9 September 2010

No news... good news? Solaris 10 licensing terms have changed

Long time no blog. Partly because I enjoyed a(n almost) relaxing summer. Partly because I was standing by, sad and astonished, at what was happening to Solaris and OpenSolaris in the final stages of the Oracle and Sun Microsystems merger.

There's no need for me to blog about the well known changes that OpenSolaris and its communities underwent in the last months. I feel a little bit of sadness but things haven't changed so dramatically. The supported Sun's OpenSolaris distribution has been obliterated in favor of... yet another Solaris Express. Back to the old days. Ben Rockwood has written a good piece in his blog in which he analyses the leaked Oracle memo and makes some insightful considerations. I agree with his analysis.

Until Solaris 11 Express sees the light, I was thinking about upgrading my workstations to Solaris 10 09/10, which was released yesterday. As you'll notice when accepting the OTN license, Solaris 10 licensing terms have changed.

Except for any included software package or file that is licensed to you by Oracle under different license terms, we grant you a perpetual (unless terminated as provided in this agreement), nonexclusive, nontransferable, limited License to use the Programs only for the purpose of developing, testing, prototyping and demonstrating your applications, and not for any other purpose.

After so many fears and speculations, that's good news.



Sunday, 6 June 2010

Credentials and Projects for a Solaris 10 SMF-Managed Service

Introduction

Some posts ago we've learnt about Solaris 10 basic Projects and Resource Caps administration. In that article we examined Solaris 10 Projects facility and how it enables the administrator to group and organize running processes into tasks which are running in a project context. Since projects may define resource caps, processes running inside a project will be subject to such caps.

In the previous post we discovered how easy it is for an administrator to define Solaris 10 projects and assign processes to them. We also said that there was a little gotcha: how would an administrator define the credential (and/or the Solaris 10 project) under which an SMF-managed service will run? In this articles we'll explore the basic Solaris 10 SMF Service Manifest DTD to discover how to define user credentials, privileges and projects for a specific SMF service instance.

The SMF Service Manifest DTD

Solaris 10 SMF uses manifests to describe the characteristics of a managed service. The manifest DTD (Solaris 10, version 1) can be found on:

/usr/share/lib/xml/dtd/service_bundle.dtd.1

Although in some cases there's no need for an administrator to define a manifest for an SMF service (as in the case of inetd-manage services because Solaris 10 will build a manifest for you) it's not bad to quickly glance at the service DTD, at least to discover what can be done.

Method Context

The method context, defined by:

<!ELEMENT method_context
  ( (method_profile | method_credential)?,
    method_environment? ) >

<!ATTLIST method_context
  working_directory CDATA ":default"
  project           CDATA ":default"
  resource_pool     CDATA ":default" >

lets the administrator define credentials and resource managements attributes for an execution method. The method_context element defines the following three attributes:

NameDescription
working_directoryThe working directory to launch the execution method from. The :default token can be used to indicate the user specified for the method (by means of the method_profile or the method_credential element.)
projectThe project under which to run the current execution method. The project can be specified in either the numeric or the text form. The :default token can be used to indicate the use of the default project for the user specified (see working_directory description.)
resource_poolThe resource pool name to launch the method on. The :default token can be used to indicate the default pool for the specified project (see project description above.)

Method Credentials

The method credentials, as outlined in the previous section, can be specified with the optional method_credential subelement of the method_context element. The method_credential element is defined as follows:

<!ELEMENT method_credential EMPTY>

<!ATTLIST method_credential
  user             CDATA #REQUIRED
  group            CDATA ":default"
  supp_groups      CDATA ":default"
  privileges       CDATA ":default"
  limit_privileges CDATA ":default" >

The attributes of the method_credential element are defined as follows:

NameDescription
userThe user id for the current execution method. The user id can be specified in either the numeric or the text form.
groupThe group id for the current execution method. The group id can be specified in either the numeric or the text form. The :default token can de used to specify the default group for the specified user (see user attribute above.)
supp_groupsOptional supplemental groups to associate with the current execution method. A list of groups ids can be specified using a space as a separator. If absent or when the :default token is specified, initgroups(3C) will be specified.
privilegesAn optional privilege set.
limit_privilegesAn optional limit privilege set.

If you're wondering about privileges, please check out the official Solaris RBAC documentation.

An Example Manifest

Many Solaris 10 bundled SMF services use RBAC, hence their manifest make extensive use of such elements. You can, for example, check the default PostgreSQL service manifest:

$ svccfg export postgresql
[...snip...]
<instance name='version_81' enabled='false'>
      <method_context project=':default' resource_pool=':default' working_direct
ory=':default'>
        <method_credential group='postgres' limit_privileges=':default' privileg
es=':default' supp_groups=':default' user='postgres'/>
      </method_context>
[...snip...]

In the service manifest fragment above you can see how the postgresql service definition leverages RBAC and projects to define credential, privileges and resource pools and caps for the default PostgreSQL service.

Flexibility and Simplicity

This mechanisms is indeed simple and flexible: since Solaris 10 RBAC and Solaris 10 Projects use loosely coupled layers to define privileges and resource caps, it's easy to establish a relation between and user and a project (or a privilege set, or whatever), and then Solaris will make the rest for you. As you can see in the previous manifest fragment, there's most of the tokens are :default. The PostgreSQL processes will run under the specified user credentials (postgres) and all of the other parameters (resource pool, project, working directory, privileges, etc.) will be discovered at runtime by Solaris.

Should you need to cap PostgreSQL resources, just define a suitable project and establish it as the default project for the postgres user: you won't (almost) ever need to change the service manifest.

Inetd-Managed Services

As explained in another post, configuring an inetd-managed service on Solaris 10 is almost a one-liner. There's was a gotcha, though. Although the user specified with the legacy inetd syntax was assigned to a default project with a resource cap, I noticed that Solaris 10 wasn't honoring it. Let's try and check the manifest that Solaris 10 generated for us:

$ svccfg export svc:/network/svn/tcp
[...snip...]
<exec_method name='inetd_start' type='method' exec='/opt/csw/bin/svnserve -i -r /home/svnuser/svnrepos' timeout_seconds='0'>
  <method_context>
    <method_credential user='svnuser' group='svngroup'/>
  </method_context>
</exec_method>
[...snip...]

There's no default project specified indeed! Let's notice that a missing project attribute does not tell Solaris 10 to use the default project for the specified user. To solve this, just dump the service definition to a file, modify it and reimport it:

$ svccfg export svc:/network/svn/tcp > svn.xml
$ [add project=':default' attribute]
# svccfg -v import svn.xml

Just check that the service manifest has been correctly import and restart the service.

Conclusion

Solaris 10 offers great and sophisticated tools to ease the life of the system administrator and enable the deployment of flexible and controlled execution environments. But beware: sophisticated doest not imply complicated in the Solaris 10 universe. On the contrary: as much as I discover and use Solaris 10 as much I admire and appreciate its clean and usable administration tools. As a minimum, I never have to modify a descriptor by hand. There always is a command line interface tool to protect me from errors and to ease my scripting experience. Just look for the corresponding *adm or *cfg command to do your job. Solaris 10 documentation and the community around OpenSolaris, moreover, are great places where to go and find the help you need.

For an alternate example that emphasizes the flexibility of the SMF service manifests, have a look at this blog post.  

Enjoy. 



Friday, 4 June 2010

VirtualBox as a Server Virtualization Platform

I'm a faithful VirtualBox user since its first versions for the Solaris platform. Its simplicity and the Solaris support made it a perfect choice for me, casual user of some Windows virtual machine. I could not imagine that VirtualBox would grow so rapidly to be the kind of platform it is today. I'm really glad to VirtualBox community and to Sun for this great piece of software. 

I'm using VirtualBox even on my MacBook: it's especially useful for me to build demos. Few days ago I built a Sun Ray Server demo with a virtualized OpenSolaris (2009.06 upgraded to b134) on my Mac in a question of minutes.


VirtualBox as a Server Virtualization Platform

VirtualBox, as many of you will know, is also used as a server virtualization platform. The very Sun Virtual Desktop Infrastructure can use a VirtualBox behind the scenes. Years ago, the major stopper for such an use, in my opinion, was the lack of a functional virtualized network stack. Since the introduction of Crossbow in Solaris and the Bridged Adapter functionality in VirtualBox, there's no reason I wouldn't run VirtualBox in a server (except resource consumption considerations that are off topic here.)

Having said that, in my office I get an enormous advantage from using VirtualBox on some Sun Fire servers with ZFS. As I told on older posts (see here and here) I take advantage of ZFS snapshots and clone to build a set of preconfigured virtual machines and clone them whenever I register a new instance. Making a ZFS clone and registering a new VirtualBox virtual machine is a no brainer. You can (and should...) even script it using VirtualBox command line interfaces (such as VBoxManage.) Horizontal scalability of such an environment is very good and, moreover, our infrastructure is very cheap. Some Sun Fire X2270 M2 and OpenStorage appliances have lowered the TCO of our desktop and server platforms. Nowadays, we estimate that the typical virtual machine we're running costs us about $60 per month (including server housing fees in a datacenter.) 

If command line interface falls short and you need more advanced administration tools, you should be aware of the VirtualBox Web Console project. Honestly, I don't use it because our environment is relatively small. Surely it does have a place in a large corporate environment.

Remote Virtual Machines and Desktop Virtualization

For the reasons stated above, I no longer execute virtual machine in my own laptop except in the cases when the virtual machine will be used in an external environment (as in the case of demos for our clients.) Whenever I need to use a virtual machine, unless it's already running, I just start it remotely:

$ VBoxManage startvm your-vm-name --type vrdp

The --type vrdp flag is necessary if you want to remotely connect to the virtual machine using the internal VirtualBox RDP implementation. You can even just launch the command using ssh (in my case, certificate authentication is performed so that I can safely script it):

$ ssh your-server VBoxManage [...]

The last thing you need is an RDP client for your client platform. Solaris has got a couple of clients bundled with it. In the case of OS X I just use Microsoft Remote Desktop Connection (yes, I know...)


One virtual machine per user obviously is not the way to go to provide a virtualized desktop experience to your users. If you want to do that, you can make a step forward and use a VirtualBox powered Sun Virtual Desktop Infrastructure and give them access using Sun Ray clients. This way, we reduced TCO of desktop computers for a wide range of user profiles. When feasible, we later moved such users to a Solaris desktop access and spared Windows license fees.

Is It Ready for the Enterprise?

I would say that it depends on your requirements. I consider VirtualBox a mature and very stable product. Together with Solaris, VirtualBox can bring you plenty of advantages:
  • Reduced storage consumption: Solaris has got two (yes, two) built-in technologies that can help you deduplicate your data and spare costly space of your storage infrastructure: ZFS snapshot and clones and ZFS deduplication. ZFS snapshot and clone, alone, has helped us incredibly reduce the footprint of our virtual machine disk images in our storage arrays.
  • Observability: DTrace. Just read the documentation and learn what DTrace can do for you, even on a production system, with no downtime and no performance penalty.
  • Network Virtualization: Project Crossbow has given Solaris a very flexible network virtualization stack. Creating virtual entities such as etherstubs, virtual network adapters and so on, is easy.
  • Predictive Self-Healing: Solaris has got a set of built-in features to improve observability, diagnostics and self-healing.
  • VirtualBox virtual machine can be teleported between a source and a target host while running.
  • Desktop virtualization with Sun Ray appliances.

These a just a few of the reasons why I consider that VirtualBox can be used in an enterprise environment. Undoubtedly, other server virtualization platforms offer characteristics that VirtualBox does not implement and you should review your requirements on a case by case basis. Sometimes tradeoffs are acceptable and more profitable than overkill solutions. Anyway, where VirtualBox isn't sufficient, there aways is an Oracle VM out there.

Conclusions

VirtualBox is a very flexible product and, for the average user, is pretty simpler than full featured server virtualization platforms such as Sun xVM Server (now dead), Oracle VM, other Xen-based platforms or VMWare ESX. If your requirements allow it, VirtualBox is a software to seriously take into account. If you use Solaris, moreover, you will benefit of some of Solaris' great technologies such as DTrace, ZFS snapshot and clones, ZFS deduplication and Solaris virtual network stack (Crossbow.)

On another blog post I will describe how VirtualBox, together with Solaris, can be an easy to manage and powerful solution for small scale deployments of an enterprise virtualization platform. 


Thursday, 3 June 2010

Installing Sun Ray Server Software on OpenSolaris 2009.06

Overview

Yesterday I received my first Sun Ray client and was looking forward to trying. The Sun Ray client is a display device which can be connected to a remote OS instance in basically two ways:
  • Using the Sun Ray Server Software.
  • Using Sun Virtual Desktop Infrastructure.

The Sun Ray client I'm using is a Sun Ray 2, which is a very low power device (about 4W), equipped with the following ports:
  • 1 DVI port
  • 1 serial port
  • 1 Ethernet RJ45 port

Sun Virtual Desktop Infrastructure (VDI) is a connection broker which gives Sun Ray devices access to a supported operating system such as Sun Microsystems' Solaris, Linux or Microsoft Windows which must be executed by one of the virtualization technology supported by VDI:
  • VirtualBox.
  • VMWare.
  • Microsoft Hyper-V.

Sun Ray Server Software (SRSS), on the other end, is a server software available for Solaris and Linux which gives Sun Ray clients remote access to an UNIX desktop session. Since we're only running Solaris on our machines, Sun Ray Server Software and Sun Rays are the quickest way to go to provide a low cost and effective desktop to all of our users.

Prerequisites

Solaris' SRSS prerequisite are very simple: Solaris 10 05/09 or newer. That's where fun begins. Sun Ray Server Software is supported on Solaris 10 but not (yet) on OpenSolaris. We'll be running Solaris 10 on our production environment but, for this proof of concept, I tried to use an already existing OpenSolaris virtual machine (OSOL 2009.06 upgraded to b134 from /dev) running on VirtualBox on a Mac OS X host. Taking into account the problems I've had in the past trying to run software supported on Solaris 10 (such as Sun Java Enterprise System) on OpenSolaris, I seriously considered installing a Solaris 10 VM and get rid of all those problems that are a direct consequence of the great job the OpenSolaris developers are doing (especially package refactoring and changes to Xorg installation paths.) At the end, curiosity kills the cat and now SRSS is running on OpenSolaris.

Installation Steps

First of all, download SRSS. You'll just need the following files:
  • Sun Ray Server Software 4.2.
  • Sun Ray Connector for Windows Operating System (only if you want to connect your Sun Ray client to a Windows operating system instance.)

Unzip SRSS on a temporary location on your Sun Ray server:

# unzip srss_4.2_solaris.zip

I will refer to this path as $SRSS from now on.

Bundled Apache Tomcat for the Sun Ray Admin GUI

If you plan to use the Sun Ray Admin GUI you should install a suitable web container (Servlet 2.4 and JSP 2.0 are required.) SRSS is bundled with Apache Tomcat which you can use to run the Admin GUI:

# cd $SRSS/Supplemental/Apache_Tomcat
# gtar -xvv -C /opt -f apache-tomcat-5.5.20.tar.gz

Please note that GNU tar is required to extract the Apache Tomcat bundle.

Since the default Apache Tomcat installation path used by SRSS is /opt/apache-tomcat you'd better make a symlink to your Apache Tomcat installation path:

# ln -s /opt/apache-tomcat-5.5.20 /opt/apache-tomcat

Installing SRSS

To launch the installation script for SRSS just run:

# $SRSS/utinstall

The script will just ask you a few question. Be ready to provide the following:
  • JRE installation path.
  • Apache Tomcat installation path.

From now on, the SRSS installation path (/opt/SUNWut) will be referred to as SRSS_INST.

Upon script termination it's now required that you restart your Sun Ray server:

# init 6

Planning Your SRSS Network Topology

The first thing you've got to do is defining your network topology. SRSS can be configured with or without a separate DHCP server, on private and shared networks, etc. The official SRSS documentation can give you hints to how to configure your server if your in doubt. For the sake of this proof of concept, I'll choose the simplest network topology: a shared network with an existing DHCP server. For alternate configuration, please have a look at the official SRSS documentation.

To configure SRSS on a shared network using an external DHCP server all you've got to do is:

# $SRSS_INST/sbin/utadm -L on
# $SRSS_INST/sbin/utrestart

On OpenSolaris some required Solaris 10 packages were missing and installation scripts correctly informed me about the situation. The missing packages can be installed with pkg:

# pkg install SUNWdhcs SUNWdhcsb SUNWdhcm

Configuring SRSS

SRSS has got an interactive configuration script which can be run to establish the initial SRSS configuration:

# $SRSS_INST/sbin/utconfig

Please take into account that the script will ask, amongst others, the following questions:
  • SRSS admin password.
  • Configuration parameters for the Admin GUI:
    • Tomcat path.
    • HTTP port.
    • HTTP admin port.
  • Whether you want to enable remote administration.
  • Whether you want to configure kiosk mode:
    • Kiosk user prefix.
    • Kiosk users' group.
    • Number of users.
  • Whether you want to configure a failover group.

To enable the use of GDM by SRSS you'll need to touch the following file:

# touch /etc/opt/SUNWut/ut_enable_gdm

Synchronize the Sun Ray DTU Firmware

The last step in the configuration process is synchronizing the Sun Ray DTU firmware:

# $SRSS_INST/sbin/utfwsync

SRSS Up and Running on Solaris 10

Solaris 10 configuration ends here and SRSS should now be up and running. In the next section I'll detail the workarounds needed to fix the quirks I've found while configuring SRSS on OpenSolaris.

Additional Configuration for OpenSolaris 2009.06 or >b134

As soon as I configured SRSS, I tried to plug my Sun Ray client on to see if it would work correctly. The Sun Ray client was discovering the SRSS server correctly but then hung with a 26 B error code. The SRSS logs were reporting that GDM session was dying almost upon startup. So, there was a problem with GDM.

Fixing Bug 6803899

There's a known bug that affects $SRSS_INST/lib/utdtsession. Open it with vi and replace awk with nawk.

< tid=$(awk -F= '$1 == "TOKEN" {print $2;exit}' ${DISPDIR}/${dpyparm})
> tid=$(nawk -F= '$1 == "TOKEN" {print $2;exit}' ${DISPDIR}/${dpyparm})

NWAM

OpenSolaris has got a new SMF managed service to autoconfigure the network physical layer called NWAM. Using SRSS with NWAM (and with other server software as well) can be quirky. I suggest you disable NWAM and fall back to manual network configuration. More details on this can be found on official OpenSolaris documentation.

Motif

OpenSolaris is not shipped with the Motif libraries (and dependencies) required by SRSS. You can ignore them and set up a new policy accordingly:

# $SRSS_INST/sbin/utpolicy -a -g -z both -D
# $SRSS_INST/sbin/utrestart -c

or proceed and install the missing packages:

# pkg install SUNWmfrun SUNWtltk SUNWdtbas

Since this is a proof of concept I'm not going to use features such as mobility. Nevertheless, I wanted to try and install Motif to see if additional problems would come out.

Fixing GDM

As I told at the beginning of this section, SRSS logs were indicating some kind of problem with GDM. If you're following OpenSolaris evolution, you'll know that, indeed, Xorg as well as GDM have undergone major changes and now notably differ from their Solaris 10 "parents". The first error that was showing up on GDM logs, which can be found on /var/log/gdm, were complaints about missing fonts:

Fatal server error:
could not open default font 'fixed'

Font locations, indeed, changed considerably on latest OpenSolaris builds. To fix this you have to create a file called /etc/opt/SUNWut/X11/fontpath to reflect correct font paths on your system. On OpenSolaris b134 such paths are the following:

/usr/share/fonts/X11/100dpi
/usr/share/fonts/X11/100dpi-ISO8859-1
/usr/share/fonts/X11/100dpi-ISO8859-15
/usr/share/fonts/X11/75dpi
/usr/share/fonts/X11/75dpi-ISO8859-1
/usr/share/fonts/X11/75dpi-ISO8859-15
/usr/share/fonts/X11/encodings
/usr/share/fonts/X11/isas
/usr/share/fonts/X11/misc
/usr/share/fonts/X11/misc-ISO8859-1
/usr/share/fonts/X11/misc-ISO8859-15
/usr/share/fonts/X11/Type1

After fixing font paths GDM complained about missing dependencies for the following libraries: libXfont and libfontenc. Although this is not the "Solaris way" of doing things, a quick and dirty solution was making symlinks to the missing dependencies in /usr/lib:

# cd /usr/lib
# ln -s xorg/libXfont.so
# ln -s xorg/libXfont.so.1
# cd amd64
# ln -s ../xorg/amd64/libXfont.so
# ln -s ../xorg/amd64/libXfont.so.1
# cd /usr/lib
# ln -s xorg/libfontenc.so
# ln -s xorg/libfontenc.so.1
# cd amd64
# ln -s ../xorg/amd64/libfontenc.so
# ln -s ../xorg/amd64/libfontenc.so.1

The last thing to do is fixing a problem in $SRSS_INST/lib/xmgr/gdm/remove-dpy for gdmdynamic syntax:

< gdmglue="; gdmdynamic -b -d "'$UT_DPY'
> gdmglue="; gdmdynamic -d "'$UT_DPY'

Done.

Now, your Sun Ray clients should be able to connect to your SRSS running on OpenSolaris (at least, b134.) As you can see in the following picture, there's my MacBook with a virtualized OpenSolaris (b134) acting as a Sun Ray Server, the Sun Ray 2 client and the virtualized desktop on the screen behind the MacBook.


Have fun!




Tuesday, 18 May 2010

VirtualBox v. 3.2.0 Has Been Released Adding Support For Mac OS X


Today, Oracle Corporation has released VirtualBox v. 3.2.0 and renamed it Oracle VM VirtualBox.

This is a major version which includes many new technologies such as:
  • In-hypervisor networking.
  • Remote Video Acceleration.
  • Page Fusion.
  • Memory Ballooning.
  • Virtual SAS Controller.
  • Mac OS X guest support (on Apple hardware only.)

And much more. If your want to read the official announcement please follow this link. If you want to read the change log please follow this link.

Wednesday, 10 February 2010

Setting up Apache SSL on Solaris 10

Solaris 10 is almost ready to run an SSL-secured Apache instance out of the box. What you really need is just the server certificate. The certificate, basically, contains the public key your clients will use to encrypt the communication with your SSL-secured server. If you're setting up a production site, chances are you already have a certificate from a trusted Certificate Authority. If you don't, go and get one. Instead, if you're running a non critical, internal or testing site, you can build a self-signed certificate and use it for your site.

Stop apache

Stop apache! ;)

# svcadm disable svc:/network/http:apache2

Enabling SSL

Solaris 10 uses SMF to manage its services and the bundled Apache is no exception. To enable SSL for the bundled Apache instance, you've got to modify the service configuration:

svccfg -s apache2 setprop httpd/ssl = boolean: 'true'

Creating a certificate


Safe harbor statement: This step, as explained in the introduction, will not generate a certificate suitable for production use.

Solaris 10 provides a bundled OpenSSL package which is just what you need to produce a self-signed certificate. The openssl binary is installed by default at /usr/sfw/bin/openssl.

To create the certificate, issue the following command:

$ openssl req -new -x509 -out server.crt -keyout server.key

When filling in the questions made by openssl, please note that the Common Name field must contain the name of the server you're creating the certificate for.

The server.key file produced in the previous step is a just a plain text file. If you want (I do) to protect your key with a passphrase, then launch openssl once more:

$ openssl rsa -des3 -in server.key -out server.key.crypt

You can now safely delete server.key and store server.key.crypt in a secure place. However, Apache won't start unless you type a pass phrase and can be a pain. I usually store the key with a very restrictive permission mask (400) and install it unencrypted. Another option you might use if you don't like letting the key unencrypted is using the SSLPassPhraseDialog directive in ssl.conf and built a script to output the pass phrase. Please note, however, that this method is not inherently more secure than leaving the key unencrypted.

Tell Apache where the certificate and the key are

To tell Apache where the certificate and the key are you have to use the

SSLCertificateFile
SSLCertificateKeyFile

directives. Solaris 10 ships with a functional /etc/apache2/ssl.conf file: edit the file and make sure the SSLCertificate* directive are pointing to your certificate and its key.

Reviewing your configuration

You're probably going to spend some minutes reviewing your ssl.conf file and learn about mod_ssl directive you'll find in there in case you need further customization.

Start Apache

Start the Apache service issuing a:

# svcadm enable svc:/network/http:apache2

and test your site with openssl:

$ openssl s_client -connect localhost:443 -state -debug

A note about virtual hosts

If you're using Apache name-based virtual hosts you might be thinking that the same mechanism applies for SSL-secured name-based virtual hosts. I'm sorry but the answer is no. Basically, SSL encapsulates HTTP and Apache won't be able to decide which host the request is directed to because there won't be any Host header before decrypting the communication, which can only be accomplished at the destination server. Moreover, Apache wouldn't be able to choose a certificate to decrypt the communication just because of the same reason: indeed, Apache will ignore multiple SSLCertificate* directives in <VirtualHost/> block and default to the first directive encountered.. If you're looking for more information on the subject, you can start here: Name-based VirtualHosts and SSL. Unless you can accept the restrictions outlined in this article, the only viable options to deploy SSL-secured virtual hosts are using IP-based (or port-based) virtual hosts.

Monday, 21 December 2009

iPhone on a Solaris Host

I'm a moderately happy owner of an iPhone and, as I'm usually running Solaris on my systems, I've struggled to find a working solution to connect my handset to an iTunes instance. One of the major drawbacks of the iPhone is that you really need iTunes: whether you want to upgrade it, back it up, or simply transfer the contents you purchased on the Apple stores, you need iTunes to get the job done.

I'm running several virtualized OS on my Solaris guests with Sun xVM VirtualBox, and never managed to make it work because of some limitations of the Solaris USB driver implementation. A couple of days ago, Sun announced the release of xVM VirtualBox 3.1.2 and in the changelog I read the following:
  • Solaris hosts: several USB fixes (including support for Apple iPhone)

I quickly updated my VirtualBox instance, quickly live-upgraded my Solaris Express Nevada build 116 to Nevada build 129 (during the installation, VirtualBox informed me that it needed recent Nevada builds for the USB kernel module to work properly), plugged the iPhone in an USB slot of a Sun Ultra 24 and it worked!





Sunday, 20 December 2009

Sun xVM VirtualBox v. 3.1.2 has been released

Sun xVM VirtualBox v. 3.1.2 has been released. This is a minor update and the current changelog is:
  • VMM: fixed SMP stability regression
  • USB: fixed USB related host crashes on 64 bits Windows hosts (#5237)
  • Main: wrong default HWVirtExExclusive value for new VMs (bug #5664)
  • Main: DVD passthrough setting was lost (bug #5681)
  • VBoxManage: iSCSI disks do not support adding a comment (bug #4460)
  • VBoxManage: added missing --cpus and --memory options to OVF --import
  • GUI: fixed VBox URL in update dialog for German and Dutch languages
  • GUI: NLS updates
  • OVF: fixed export of non standard storage controller names (bug #5643)
  • Solaris hosts: several USB fixes (including support for Apple iPhone)
  • Mac OS X hosts: several fixes for the 3D support
  • Mac OS X hosts: re-enabled CMD+Key combinations, even if the Host-Key isn't CMD (bug #5684)
  • Mac OS X hosts: fixed to fast scrolling if the mouse wheel is used inside the guest (bug #5672)
  • Mac OS X hosts: dock & menubar don't disappear in fullscreen when the VM is not running on the primary display (bug #1762)
  • Mac OS X hosts: added an option for enabling "Auto show Dock & Menubar in fullscreen" (bug #5636)
  • Windows host installer: fixed starting VBox with wrong privileges right after installation (bug #4162)
  • Host interface and host-only networking: prevent driver from unloading while a VM is still active (Windows host only)
  • Host-only networking: fixed host-only interface creation (Windows host only) (bug #5708)
  • Virtio-net: don't crash without an attached network
  • Virtio-net: fixed the issue with intermittent network in VM with several virtual CPU cores.
  • NAT: fixed port-forwarding regressions (bug #5666)
  • NAT: fixed crash under certain conditions (bug #5427)
  • NAT: fixed resolving of names containing a slash or underscore when using the host resolver DNS proxy (bug #5698)
  • ATA: fixed sporadic crash when resuming after a VM was forcefully paused (e.g. due to iSCSI target being unavailable)
  • SATA: fixed raw vmdk disks (bug #5724)
  • Linux guests: increased the default memory for Redhat and Fedora guests
  • Linux Guest Additions: fixed installation on RHEL 3.9 guests and on some 64bit guests
  • Linux Guest Additions: prevent SELinux warnings concerning text relocations in VBoxOGL.so (bug #5690)
  • X11 guests: fixed mouse support for some Xorg 1.4 guests (openSUSE 11.0)
  • X11 guests: fixed xorg.conf modification for some older Xorg releases (openSUSE 11.1)
  • Windows guests: fixed some VBoxService shutdown issues
  • Windows guests: fixed VBoxVideo spinlock issues on NT4
  • Windows Guest Additions: fixed uninstallation issues of NT4
  • Shared folders: fixed resolving of symlink target (bug #5631)
  • 2D Video acceleration: delay loading of OpenGL dlls for Windows hosts to avoid GUI crashes on misconfigured systems
  • 2D Video acceleration: fixed issues with video picture not displayed on playback

The changelog claims that support for Apple iPhone has been included for Solaris hosts. If working, that's what I'd been waiting for months!

Tuesday, 1 December 2009

Sun xVM VirtualBox v. 3.1.0 has been released

Sun xVM VirtualBox v. 3.1.0 has been released. This is a major update which introduces some brand-new great features such as (change log excerpt):
  • Teleportation (aka live migration); migrate a live VM session from one host to another (see the manual for more information)
  • VM states can now be restored from arbitrary snapshots instead of only the last one, and new snapshots can be taken from other snapshots as well ("branched snapshots"; see the manual for more information)
  • 2D video acceleration for Windows guests; use the host video hardware for overlay stretching and color conversion (see the manual for more information)
  • More flexible storage attachments: CD/DVD drives can be attached to an arbitrary IDE controller, and there can be more than one such drive (the manual for more information)
  • The network attachment type can be changed while a VM is running
  • Complete rewrite of experimental USB support for OpenSolaris hosts making use of the latest USB enhancements in Solaris Nevada 124 and higher
  • Significant performance improvements for PAE and AMD64 guests (VT-x and AMD-V only; normal (non-nested) paging)
  • Experimental support for EFI (Extensible Firmware Interface; see the manual for more information)
  • Support for paravirtualized network adapters (virtio-net; see the manual for more information)

As far as it concerns myself, teleportation is the feature I was looking forward. Great job, guys.

Read the changelog.
Download Sun xVM VirtualBox now.


Thursday, 26 November 2009

Retrieving a server public SSL key on Solaris 10 (such as GMail's)

This is a tip for you, UNIX users (with OpenSSL installed), who wish to obtain a server's public SSL key.

I'm configuring a Java EE application that needs to connect to an IMAP server using SSL on a Solaris 10 box. For that reason, I need to import the IMAP server SSL public key into my Java runtime certificates file.

Solaris 10 brings a bundled OpenSSL package which it's very easy to accomplish this task with. Just launch your favorite shell and execute the following command:
$ openssl s_client -connect destination.server:[service|port]

In my case, being an IMAP server using a non-standard port, I used:

$ openssl s_client -connect my.imap.server:999
CONNECTED(00000004)
[...snip...]
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIDWzCCAsSgAwIBAgIKYgnCCAADAAAJ5DANBgkqhkiG9w0BAQUFADBGMQswCQYD
VQQGEwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzEiMCAGA1UEAxMZR29vZ2xlIElu
dGVybmV0IEF1dGhvcml0eTAeFw0wOTA3MTcxNzEzNDFaFw0xMDA3MTcxNzIzNDFa
MGgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1N
b3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgSW5jMRcwFQYDVQQDEw5pbWFw
LmdtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA+O0vc2pslfjk
pbxnBF4iznJMrP9Qi3fHjKqA3P2RynTcbnZfGEGMKcPeXHT4IOH6XUnf+4Jw+z7I
KiMtjX8IVGo7DeXec/ZREasEZnpMGisxN7+qk7Ho6HyaglQTAFIQJP99UFJkHO9x
dGDy5d2j9senPad1BqtyaIRGkJpHizUCAwEAAaOCASwwggEoMB0GA1UdDgQWBBT0
WHOeLKf4+VNADzHzGh+AEV+6fjAfBgNVHSMEGDAWgBS/wDDr9UMRPme6npH7/Gra
42sSJDBbBgNVHR8EVDBSMFCgTqBMhkpodHRwOi8vd3d3LmdzdGF0aWMuY29tL0dv
b2dsZUludGVybmV0QXV0aG9yaXR5L0dvb2dsZUludGVybmV0QXV0aG9yaXR5LmNy
bDBmBggrBgEFBQcBAQRaMFgwVgYIKwYBBQUHMAKGSmh0dHA6Ly93d3cuZ3N0YXRp
Yy5jb20vR29vZ2xlSW50ZXJuZXRBdXRob3JpdHkvR29vZ2xlSW50ZXJuZXRBdXRo
b3JpdHkuY3J0MCEGCSsGAQQBgjcUAgQUHhIAVwBlAGIAUwBlAHIAdgBlAHIwDQYJ
KoZIhvcNAQEFBQADgYEAXLvdKJJ6ivWAi29p4pPo4cirMEYnRlpNOmPVAW4QYcSq
lEZhm4cQdyitFo9cxiwNgbBjJk8O+oiOhnueT44RXotEE7j3KnNyPRRZg0OCagGC
4G71fFA11P1L0fSd/7k52/DbZQBea3tJgkseoGL50UVvnJm+LZOovIGxoQzipJk=
-----END CERTIFICATE-----
[...snip...]

The key I need to import is the shown certificate, including the beginning and the end line.

I saved the key in a file called imap.key and I imported in my Java runtime certificates file with the following command:

$ /usr/jdk/latest/bin/keytool -import -alias imap.gmail.com -keystore /usr/jdk/latest/jre/lib/security/cacerts -file imap.key
[Insert password here]
[Confirm key import]

Done!
Now, my Java application can use that public key to establish a secure SSL connection with the target imap host.

Sunday, 22 November 2009

Configuring Sendmail to Relay Messages from Other Servers

Index




Part 1. Configuring Sendmail on Solaris 10
Part 2. Configuring Sendmail to Masquerade Your Messages
Part 3. Configuring Sendmail to Relay Messages to Another Server
Part 4. Configuring Sendmail to Relay Messages from Other Servers

Introduction

In the previous post you've learnt how to configure Sendmail to relay messages to another server. Now, such a server should be probably be configured to accept incoming messages to relay from other servers. Solaris 10 Sendmail default configuration does not allow message relay and proper configuration must be applied to Sendmail.

Configuring Relay for Hosts and Domains

The quickest way to have Sendmail relay messages for other domains is by modifying the /etc/mail/relay-domains file. Sendmail will relay mail for every domain listed in that file. If you want your server to relay messages for domain a.com, b.com and c.com, just insert the corresponding lines into /etc/mail/relay-domains and restart your Senmail instance:

# cat /etc/mail/relay-domains
a.com
b.com
c.com

Configuring the Access Database

If you want to relay messages from specific hosts (as well as domains and networks) you can use the access database. The access database lists email addresses, network numbers and domain names and a rule. Available rules are:
  • OK: Accept mail even if other rules in the running ruleset would reject it.
  • RELAY: Accept mail addressed to the indicated domain or received from the indicated
    domain for relaying.
  • REJECT: Reject the sender or recipient with a general purpose message.
  • DISCARD: Discard the message completely using the $#discard mailer.
  • (A RFC-821 compliant error text): Return the error message.

If you want your Sendmail to relay mails for a domain or from some specific hosts, modify your /etc/mail/access accordingly:
your-domain       RELAY
192.168.0         RELAY
another-domain    RELAY
unwanted-host     REJECT

Once done, you have to generate the access db with the following command:

# makemap hash /etc/mail/access.db < /etc/mail/access

Enabling the Access Database

To have your Sendmail use the access database, you must properly configure it adding the access_db feature to its configuration file:

# cat your-file.mc
[...snip...]
FEATURE(`access_db')
[...snip...]

Restart your Sendmail and enjoy!

A Word of Warning: DNS Configuration

Sendmail often requires that host name you use in your configuration files (such as the access database) are properly configured in your name server, both for lookup and reverse lookup. I hope this will spare you some headache while debugging.

Configuring Sendmail to Relay Messages to Another Server

Index




Part 1. Configuring Sendmail on Solaris 10
Part 2. Configuring Sendmail to Masquerade Your Messages
Part 3. Configuring Sendmail to Relay Messages to Another Server
Part 4. Configuring Sendmail to Relay Messages from Other Servers

Introduction

Sometimes you just need to configure your Sendmail to relay messages to another server. I often use such a configuration to centralize Sendmail configuration: if something had to change I would just need to change a reduced number of configuration files. For example, I made heavy use of Solaris Zones technology. Unless particular configuration is needed, whenever I create a new zone, I just configure its Sendmail to relay messages to another server (which is, incidentally, one of the preconfigured Sendmail zones we use).

Setting Up a Sendmail Smart Host

Setting up Sendmail to relay messages to another server is pretty easy. Modify your configuration file and use the following macro:

[...snip...]
define(`SMART_HOST', `your-smart-host')

[...snip...]

The smart host is the host this instance will relay messages to. This macro will be translated into a DS statement in your Sendmail configuration file. You should never modify .cf files directly: always compile .mc files! By the way, sometimes is useful to know .cf syntax if you need to interpret existing .cf files when you've lost the corresponding .mc files (something that should never pass to a seasoned System Administrator).

Configuring Sendmail to Masquerade Your Messages

Index


Part 1. Configuring Sendmail on Solaris 10
Part 2. Configuring Sendmail to Masquerade Your Messages
Part 3. Configuring Sendmail to Relay Messages to Another Server
Part 4. Configuring Sendmail to Relay Messages from Other Servers

Sendmail Masquerading

Now that you've got your Sendmail up and running it's time to do some tweaking. If you try and send mail from your host, you'll notice that messages are sent from an address such as your-user-name@hostname.your.domain. That's not probably what you want (that address isn't probably even reachable from the outside) and you'd rather like: your-user-name@your.domain. Fine, that feature is called masquerading. To masquerade outgoing mail you can use the MASQUERADE_AS and MASQUERADE_DOMAIN macros, as in the following example:

divert(0)dnl
VERSIONID(`@(#)sendmail.mc      1.11 (Sun) 06/21/04')
OSTYPE(`solaris8')dnl
DOMAIN(`solaris-generic')dnl
define(`confFALLBACK_SMARTHOST', `mailhost$?m.$m$.')dnl
MASQUERADE_AS(`your-domain.com')dnl
FEATURE(`masquerade_envelope')dnl
FEATURE(`masquerade_entire_domain')dnl
FEATURE(`always_add_domain')dnl
MASQUERADE_DOMAIN(`your-domain.com')dnl
MAILER(`local')dnl
MAILER(`smtp')dnl

LOCAL_NET_CONFIG
R$* < @ $* .$m. > $*    $#esmtp $@ $2.$m $: $1 < @ $2.$m. > $3

Restart your sendmail and the job is done.

Configuring Sendmail on Solaris 10

Index



Part 1. Configuring Sendmail on Solaris 10
Part 2. Configuring Sendmail to Masquerade Your Messages
Part 3. Configuring Sendmail to Relay Messages to Another Server
Part 4. Configuring Sendmail to Relay Messages from Other Servers

Introduction

Whoever tried to get Sendmail up and running will agree that taming Sendmail requires black magic. I won't even try to enter into Sendmail internal and details: I don't master it and conform with being able to configure my Solaris box (and zones) to fulfill my needs. Nevertheless, I'll admit that Sendmail has got its own spell and felt compelled to keep on reading on to discover what Sendmail is capable of.

Verifying Sendmail State and Starting It Up

Solaris 10 Sendmail is configured as an SMF-managed service. To check sendmail status you can use:

$ svcs \*sendmail\*
STATE          STIME    FMRI
online         14:19:23 svc:/network/smtp:sendmail

If Sendmail were not enabled, just use svcadm to bring it up:

# svcadm enable svc:/network/smtp:sendmail

Configuring Sendmail for Open Mode

Solaris 10 Sendmail configuration is such that Sendmail will only run in local mode, thus rejecting connections from other hosts. If you want to review Sendmail default Solaris 10 configuration, you can use:

# svccfg -s svc:/network/smtp:sendmail listprop
[...snip...]
config/local_only                    boolean  true
[...snip...]

If you're curios, SMF properties are used by SFM methods. A closer examination to Sendmail startup script in Solaris 10, indeed, reveals the following:

    local=`/usr/bin/svcprop -p config/local_only $SMF_FMRI 2>/dev/null`
    if [ $? = 0 -a "$local" = "true" ]; then
        OPTIONS="$OPTIONS -C /etc/mail/local.cf"
    fi

If you want to configure your Sendmail to work in open mode you can run the following:

# svccfg -s svc:/network/smtp:sendmail setprop config/local_only= boolean: false
# svcadm restart svc:/network/smtp:sendmail

Solaris 10 Default configuration

If you inspect the default sendmail.mc file for Solaris 10 you'll find the following:

divert(0)dnl
VERSIONID(`@(#)sendmail.mc      1.11 (Sun) 06/21/04')
OSTYPE(`solaris8')dnl
DOMAIN(`solaris-generic')dnl
define(`confFALLBACK_SMARTHOST', `mailhost$?m.$m$.')dnl
MAILER(`local')dnl
MAILER(`smtp')dnl

LOCAL_NET_CONFIG
R$* < @ $* .$m. > $*    $#esmtp $@ $2.$m $: $1 < @ $2.$m. > $3

Local and smtp mailers are on and you should be able to send mail, both locally and remotely, from such a host. Unless you configure your perform additional configuration, you won't be able to connect remotely to this instance, nor using such an instance as a mail relay. Naturally, some tweaking is usually required and it will be performed with the procedure described in the following sections.

Building a Configuration File for Sendmail

To build a configuration file for your Sendmail you can perform the following:
  • Temporarily disable your Sendmail:

# svcadm disable -t svc:/network/smtp:sendmail

  • Go to Sendmail configuration templates directory:

# cd /etc/mail/cf/cf


  • Start with a fresh file and write your configuration down:

# cp sendmail.mc your-file.mc

Compile your file:

# /usr/ccs/bin/make your-file.cf

Test your configuration:

# sendmail -C your-file.cf -v your-email-address </dev/null

Apply your configuration:

# cp your-file.cf /etc/mail/sendmail.cf

Restart and use Sendmail:

# svcadm enable svc:/network/smtp:sendmail

A good place to start for studying Solaris 10 Sendmail is Solaris System Administration Guide: Network Services (Chapter 13).




Tuesday, 17 November 2009

Apache HTTP Server Virtual Hosts (on Solaris)

Some posts ago (Poor man's web redirection using a servlet filter) I described how I'm sending an HTTP Redirect Status Code back to a client. Such a solution was easy for me to implement because we're already running Java EE applications on our application servers and, on the other hand, we have no other web server available (if you're thinking about Apache HTTP Server). The previous post fails in pointing out that, implementing such a solution from scratch, is really overkill.

If you're one of the many users of Apache HTTP Server you should be aware of a functionality called Virtual Hosts. Virtual hosts let you run multiple web sites on a single Apache HTTP server instance and requests will be forwarded to the appropriate web site by using either the target IP address or the name you used to connect to the site. The last step will be configuring Apache so that such a Virtual Host will be served by proxying the destination server.

With such a proxy/gateway you'll be able, for example:
  • To serve different domains, subdomains or even specific URLs with just one Apache HTTP Server instance.
  • To offer a gateway in the case you've got a reduced number of public IPs and you don't want to publish HTTP services on ports other than 80.

DNS configuration

First of all I substituted the old DNS record with a CNAME which points to this Apache HTTP Server instance. Now, whenever a client requests www.domainA.com, the connection will be established with the target Apache.

Apache HTTP Server Startup

On (Open)Solaris, check if you've got an Apache HTTP Server instance running:
# svcs \*apache\*
STATE          STIME    FMRI
legacy_run     Mar_13   lrc:/etc/rc3_d/S50apache
disabled       Mar_13   svc:/network/http:apache2

If it isn't running, create a suitable configuration file in /etc/apache2:
# cp httpd.conf-example httpd.conf

Once the configuration file is created, the service should start normally:
# svcadm enable svc:/network/http:apache2
# svcs http:apache2
STATE          STIME    FMRI
online         Nov_15   svc:/network/http:apache2

Apache HTTP Server Configuration

The last thing to do is creating virtual hosts:

NameVirtualHost *

<VirtualHost *>
ServerName domainA.com
DocumentRoot /var/apache2/htdocs
</VirtualHost>

<VirtualHost *>
ServerName subdomain.domainA.es
ProxyPreserveHost On
ProxyPass / http://localhost:8083/
ProxyPassReverse / http://localhost:8083/
</VirtualHost>

In the previous fragment you can notice the following:
  • the NameVirtualHost directive lets you configure Apache to listen on a specific address and port. In this case, any IP address and any port (*) have been configured.
  • The VirtualHost sections let you define virtual hosts. Please note that the NameVirtualHost value and the VirtualHost value must be the same (in this case, *).
  • The ServerName directive is used to assign the domain name a virtual host should serve.
  • ProxyPreserveHost is used to tell Apache not to override the Host HTTP header when connecting to the proxied host.
  • ProxyPass and ProxyPassReverse lets you map proxied URL spaces. In this case, everything (/) is sent to the proxied host (http://localhost:8083/).

Further Readings
If you want to go into deeper detail, please read the following:


Sun xVM VirtualBox 3.0.12 has been released

On November, 17th, Sun has announced the release of Sun xVM VirtualBox 3.0.12. The changelog for this release is the following:
  • VMM: reduced IO-APIC overhead for 32 bits Windows NT/2000/XP/2003 guests; requires 64 bits support (VT-x only; bug #4392)
  • VMM: fixed double timer interrupt delivery on old Linux kernels using IO-APIC (caused guest time to run at double speed; bug #3135)
  • VMM: reinitialize VT-x and AMD-V after host suspend or hibernate; some BIOSes forget this (Windows hosts only; bug #5421)
  • VMM: fix loading of saved state when RAM preallocation is enabled
  • BIOS: ignore unknown shutdown codes instead of causing a guru meditation (bug #5389)
  • GUI: never start a VM on a single click into the selector window (bug #2676)
  • Serial: reduce the probability of lost bytes if the host end is connected to a raw file
  • VMDK: fix handling of split image variants and fix a 3.0.10 regression (bug #5355)
  • VRDP: fixed occasional VRDP server crash
  • Network: even if the virtual network cable was disconnected, some guests were able to send / receive packets (E1000; bug #5366)
  • Network: even if the virtual network cable was disconnected,
    the PCNet card received some spurious packets which might confuse the
    guest (bug #4496)
  • Shared folders: fixed changing case of file names (bug #2520)
  • Windows Additions: fix crash in seamless mode (contributed by Huihong Luo)
  • Linux Additions: fix writing to files opened in O_APPEND mode (bug #3805)
  • Solaris Additions: fix regression in guest additions driver
    which among other things caused lost guest property updates and
    periodic error messages being written to the system log

If you want to update or if you want to give VirtualBox a test drive, download it now.

Thursday, 29 October 2009

Sun xVM VirtualBox 3.0.10 has been released

Today, October 29th, Sun released a minor update for its flagship desktop virtualization solution, xVM VirtualBox. The changelog of VirtualBox 3.0.10 is the following:
  • VMM: guest SMP stability fixes
  • VMM: fixed guru meditation with nested paging and SMP guests (bug #5222)
  • VMM: changed VT-x/AMD-V usage to detect other active
    hypervisors; necessary for e.g. Windows 7 XP compatibility mode
    (Windows & Mac OS X hosts only; bug #4239)
  • VMM: guru meditation during SCO OpenServer installation and reboot (VT-x only; bug #5164)
  • VMM: fixed accessed bit handling in certain cases (bug #5248)
  • VMM: fixed VPID flushing (VT-x only)
  • VMM: fixed broken nested paging for 64 bits guests on 32 bits hosts (AMD-V only; bug #5285)
  • VMM: fixed loading of old saved states/snapshots (bug #3984)
  • Mac OS X hosts: fixed memory leaks (bug #5084)
  • Mac OS X hosts (Snow Leopard): fixed redraw problem in a dual screen setup (bug #4942)
  • Windows hosts: installer updates for Windows 7
  • Solaris hosts: out of memory handled incorrectly (bug #5241)
  • Solaris hosts: the previous fix for #5077 broke the DVD host support on Solaris 10 (VBox 3.0.8 regression)
  • Linux hosts: fixed module compilation against Linux 2.6.32rc4 and later
  • Guest Additions: fixed possible guest OS kernel memory exhaustion
  • Guest Additions: fixed stability issues with SMP guests
  • Windows Additions: fixed color depth issue with low resolution hosts, netbooks, etc. (bug #4935)
  • Windows Additions: fixed NO_MORE_FILES error when saving to shared folders (bug #4106)
  • Windows Additions: fixed subdirectory creation on shared folders (bug #4299)
  • Linux Additions: sendfile() returned -EOVERFLOW when executed on a shared folder (bug #2921)
  • Linux Additions: fixed incorrect disk usage value (non-Windows hosts only)
  • Linux installer: register the module sources at DKMS even if the package provides proper modules for the current running kernel
  • 3D support: removed invalid OpenGL assertion (bug #5158)
  • Network: fixed the Am79C973 PCNet emulation for QNX (and probably other) guests (bug #3206)
  • VMDK: fix handling of split image variants
  • VHD: do not delay updating the footer when expanding the image to prevent image inconsistency
  • USB: stability fix for some USB 2.0 devices
  • GUI: added a search index to the .chm help file
  • GUI/Windows hosts: fixed CapsLock handling on French keyboards (bug #2025)
  • Shared clipboard/X11 hosts: fixed a crash when clipboard initialisation failed (bug #4987)

If you want to give VirtualBox a try, you can go and download the package for your platform of choice.

Sunday, 11 October 2009

Sun xVM VirtualBox v. 3.0.8 has been released

On October, 6th 2009 Sun Microsystems announced the release of a minor update to its flagship desktop virtualization solution, Sun xVM VirtualBox v. 3.0.8. As usual, you can check the changelog out at this address.

  • VMM: fixed 64 bits guest on 32 bits host regression in 3.0.6 (VT-x only; bug #4947)
  • VMM: fixed a recompiler triple fault guru meditation (VT-x & AMD-V only; bug #5058)
  • VMM: fixed hang after guest state restore (AMD-V, 32 bits Windows guest and IO-APIC enabled only; bug #5059)
  • VMM: fixed paging issue with OS/2 guests
  • VMM: fixed guru meditation in rare cases (2.0 regression; software virtualization only)
  • VMM: fixed release assertion during state restore when using the Sound Blaster 16 emulation (bug #5042)
  • Security: fixed vulnerability that allowed to execute commands with root privileges
  • Linux hosts: fixed runtime assertion in semaphore implementation which was triggered under certain conditions (bug #616)
  • Linux hosts: change the default USB access mode on certain distributions (bugs #3394 and #4291)
  • Linux hosts: on hardened Gentoo, the VBoxSVC daemon crashed by opening the VM network settings (bug #3732)
  • Linux hosts, Solaris hosts: pass the XAUTHORITY variable along
    the DISPLAY variable when starting a VM from VBoxManage or from the VM
    selector (bug #5063)
  • Linux hosts: use sysfs to enumerate host drives if hal is not available
  • Solaris hosts: fixed a bug which would hang the host sporadically as interrupts were not re-enabled everytime
  • Solaris hosts: fixed a kernel panic with bridged and host-only networking (bug #4775)
  • Solaris hosts: fixed incorrectly persistent CD/DVD-ROMs when changing them (bug #5077)
  • X11-based hosts: support additional function keys on Sun keyboards (bug #4907)
  • Mac OS X hosts (Snow Leopard): fixed problem starting headless VMs without a graphical session (bug #5002)
  • Mac OS X hosts: fixed problem listing host-only adapter names with trailing garbage (attached VMs won't start)
  • Windows Additions: now work with Vista 64-bit Home editions (bug #3865)
  • Windows Additions: fixed screen corruption with ZoomText Magnifier
  • Windows Additions: fixed NPGetUniversalName failure (bug #4853)
  • Windows Additions: fixed Windows NT regression (bug #4946)
  • Windows Additions: fixed VBoxService not running if no Shared Folders are installed
  • Linux Additions: implemented ftrunctate (bug #4771)
  • VRDP: start VM even if configured VRDP port is in use
  • Networking: the PCnet network device stopped receiving under rare conditions (bug #4870)
  • VBoxManage: implemented controlvm vrdpport command
  • iSCSI: fixed issue with NetApp targets (#5072)
  • SCSI: add support for virtual disks larger than 2TB
  • USB: fixed potential crash when unplugging USB2 devices (bug #5089)
  • NAT: IPSEC did not properly work with Linux guests (bug #4801)

Thursday, 3 September 2009

Sun xVM: Cloning your domU

If you're using Sun xVM for server virtualization the capability of cloning a domU is a real time-saver: reduced downtime and reuse of a corporate-standard OS installation and configuration. Really cool. If you sum up the power of ZFS snapshots and clones to all this, the picture is impressing: you can configure you domU to use ZFS volumes that you can take snapshot of and clone at will.

Now that you have the big picture, assuming you already know how to administer you ZFS pools, how can you clone your domU? This way: the first thing you have to do is shutting down your domU:

# virsh shutdown your-domain

Now you can copy your domain disk files or snapshot the corresponding ZFS volumes with a command such as:

# zfs snapshot your-fs@snap-name
# zfs clone your-fs@snap-name your/clone/name

If your just using files, then:

# cp your-domain-disk-file your-new-domain-disk-file

The next thing you've got to do is dumping and editing your source domain configuration:

# virsh dumpxml your-domain > your-domain.xml
# cp your-domain.xml your-new-domain.xml

Now, before importing this file, you've got to apply some modifications. Since Sun xVM identifies domains by means of a name and an uuid: then, you've got to edit the domain definition file to change the name and remove the already-used uuid. A new uuid will be generated for you as soon as Sun xVM wil import the domain definition. So, open the file:

# vi your-new-domain.xml

First, change the name you'll find in the <name/> element and then remove the entire <uuid/> element. The last modification you must apply is having the new domain point to the new file or ZFS volume you copied or cloned earlier. An example of a disk definition is the following excerpt from a domain configuration:

<disk type='file' device='disk'>
  <driver name='file'/>
  <source file='/export/home/xvm/db-server/winsrv2003.img'/>
  <target dev='hda'/>
</disk>

Just change the file attribute of the <source/> element and the job is done.

Last thing you've got to do is importing the new domain definition:

# virsh define your-new-domain.xml

Done! Now you can boot your new domain.

A last word of warning: chances are your just-cloned system shouldn't be running aside the old one without proper configuration. Double check your virtualized OS configuration for parameters such as:
  • network configuration (hostname, DNS, static IP addresses, etc.)
  • network service which may clash

Enjoy your virtualized server environment.





Monday, 24 August 2009

Setting up SSH access to Subversion repositories on Solaris 10 (with zones)

If you followed my previous installments, you're probably running some Subversion repositories in your Solaris box. Chances are you're running the Subversion daemon, svnserve, and using the svn protocol to access the repositories: in a previous post I explained how you can set it up as an inetd service and in another post I gave you a pointer to an SMF manifests' repository where you can find a manifest to configure your Subversion daemon with the Solaris SMF framework.

There's another interesting way to access your Subversion repositories: tunneling the communication with svnserve over an encrypted SSH connection.


Why SSH?

There are many reasons that may lead you to such a choice and the most important might be:

  • You're accessing your repositories from outside your network and want to use an encrypted connection.
  • You don't want to maintain (yet another) user registry into the repository configuration files and you'd rather leverage your existing authentication strategy.

With SSH you can have existing users authenticate into your Solaris instances without additional effort. If you're already using some directory service, such as Sun Java System Directory Server, you already know the benefits of centralizing your user registry. If you're not, you should consider using a directory service before starting to duplicate sensible information such as user accounts, groups and privileges. If you're planning to give access to your repositories to users outside your organization, you could think a directory is not a good choice. Well, in this post I'll show you a possible workaround.

Tasks


To configure such a solution, you have to take into account the characteristics and the consequences of using SSH to authenticate your users into the Solaris Operating System. Whether you're using a directory service or local files (passwd, group, etc.), users who are going to connect must be managed at operating system level. You'll be able to give users access to your repositories without actually allowing them to perform any other operation on your system. Paranoid administrators shouldn't worry about users logging in into their machines, if they don't want to.

Subversion client configuration also allows you to fine tune the tunnel settings: you can change the binding port or the entire command itself, if you wish to.

You will also pay attention to the repositories' permissions: connecting via SSH, under some aspects, is just like using the local file protocol. Users connecting to your repositories, then, should have appropriate permissions on the repositories' directories.

You will also be able to leverage the Solaris Zones technology to isolate your Subversion repositories and users into a non global zone.

Configuring Subversion


This is pretty easy: if you're not fine tuning the tunnel definition, there's really nothing to configure. Just invoke the Subversion client using the svn+ssh schema and the job is done.

If you wished to fine tune your tunnel settings, you can edit the Subversion client config file. This file contains a section named [tunnels]. The config file is located in the .subversion subdirectory into your $HOME. If you want to change the default behavior associated to the svn+ssh schema, just edit (or create if it's missing) a line such as:

ssh = command

To change the default port, you could use:

ssh = ssh -p portnumber

If you wanted, you could also define your own schemas:

yourschema = yourcommand

would be used when accessing the repository with the svn+yourschema schema.

Another nice feauture of the configuration file is the possibility to override the tunnel definition with an environment variable. Defining a schema with the following syntax

yourschema = $YOURVAR yourcommand

has the following effect:

  • If the variable $YOURVAR exists, it's used as the tunnel definition.
  • If the variable doesn't exist, the tunnel definition provided in the configuration file is used instead.

The default value for the SSH tunnel definition is indeed the following:

ssh = $SVN_SSH ssh

When overriding the SSH tunnel definition you may choose to setup the $SVN_SSH variable for your users instead of modyfing the Subversion configuration file. We'll use this technique later.

Setting up the repository


One thing to take into account when using the SSH tunnel is that the svnserve command will be run with your user identity. This means that the user you're logging with must have proper permissions to access the repository files. The easiest way to go is probably creating a group for your users, let's say svn-group, and gave them write access to the repository directory, repository-dir:

$ chgrp -R svn-group repository-dir

$ chmod -R g+w repository-dir

If you're setting up multiple repositories you can create a group for each one of them. Please take into account that the Solaris operating systems allows an user to belong to a maximum of NGROUPS_MAX groups. If you also need to change the current group membership of an user because the required group is a Solaris secondary group, you can wrap the svnserve command into a script which changes the current user's group with the newgrp command.

Another good practice is setting a sane umask before accessing the repository files. You could wrap the svnserve command, or even the svn command if you're using the file schema too, into a shell script which sets the umask for the user:

#!/bin/sh
umask 002
# your commands here

Setting up public keys to use with SSH (and restrict user to only use Subversion)


When opening a SSH session, you're usually asked a password to authenticate into the remote machine. As explained in an earlier post, you can generate key pairs and use them for authentication. Key pairs also have another advantage: you can provide some users a key pair to authenticate and configure the SSH daemon to restrict their abilities to interact with the system. Specifically, you can setup the remote machine to only allow some users to launch a specific command, svnserve in this case, when authenticating. This is especially useful when you share a repository with users outside your organization. You can create user accounts and key pairs for them: with a proper configuration such users, although listed in your user database (both local files or directories such as LDAP), they will only be able to login and launch the svnserve command in tunnel mode. This approach together with Solaris Zone technology will give you the possibility:

  • To quickly set up zones on your system to host subversion repositories.
  • To optionally centralize your user accounts in the directory of your choice.
  • To limit some user account to only use the Subversion server, effectively prohibiting them to open an interactive login session into your system.
  • You can centralize the setup of the users' home directory by using the Solaris automounter. Subversion-only users will have their homes automounted from an ad-hoc server.

To configure the machine, or the Solaris zone, which hosts the Subversion server, you only have to follow the instructions in this post to provide them a key to connect to the server. Once this is done, if you want to limit your user ability by specifying a command to execute at login, you just have to add this fragment before the public part of the key:

command="/opt/csw/bin/svnserve -t"

In this case I specified svnserve path as installed by the Blastwave's package: if your setup is different, just change the path. If you're using Solaris Express Community Edition or OpenSolaris, Subversion may be found in:

command="/usr/bin/svnserve -t"


Please be aware that this fragment must be inserted before the key fragment and in the same line.

If the number of the users is such that you don't want to manage this process manually, you can for example:

  • Use a script to generate the keys and to concatenate the public part into the authorized_keys2 file.
  • Manage a centralized authorized_keys2 file.
  • Share the authorized_keys2 file amongst users' home directories: they won't be able to read that file.
  • Optionally automount users' home directories to share this configuration in many systems or zones.

Configure your users' groups


As mentioned earlier, users should belong to a group with the necessary permissions (read and write) on the repository directory. If you manage your users with local files, just assign them the proper primary and secondary roles: if you need secondary roles for some users you can use the newgrp command in a wrapper shell script to have an user login into the desired group before invoking the Subversion commands.

If you use a directory service, configure the directory appropriately. If you're using the Sun Java System Directory Server and you're using the default LDAP schema, assigning groups to user is pretty easy:

  • The primary group can be specified setting the gidnumber attribute of the LDAP user entry.
  • The secondary groups can be specified by adding multiple memberuid attributes into the group entry.

To add the users joe and john to a group you just add:

memberuid: joe

memberuid: john

into the group definition.


An alternative configuration with just one subversion user


If you do not want to leverage your existing user repository or you don't even have one, don't worry. In that case, all you have to do is setup your subversion repositories as usual and then manually setup the user for the current tunnel with the --tunnel-user=username option in the authorized_keys files. That's it.

Setting up zones


Setting up sparse zones in Solaris 10 is really straightforward and Sun Solaris 10 official Zones documentation covers the topic with great detail.

If you need to configure the zone to use an LDAP, please refer to the Solaris 10 Naming and Directory Services administration guide.

If you want to follow my advice, you can setup a zone for installing Blastwave's software and share the installation between zone using a loopback mount.

Next steps

You can now:



If some of your users run Windows, you can read the following post to learn how to configure TortoiseSVN to use your public key to connect to Subversion using an SSH-tunneled connection.