Technical article 126361

What is the proper technique to create an encrypted filesystem on my Unixware 7.1.4 or OpenServer6 system?

OpenServer 6.0.0UnixWare 7.1.4

Written · Last revised

Problem

How do I create an encrypted filesystem on my Unixware 7.1.4 or OpenServer 6 machine?

Solution

The first step in creating an encrypted filesystem is making a file that is the size of the filesystem you wish to create.

To do this you can use "dd" on Unixware 7.1.4 or "/u95/bin/dd" on OpenServer 6.0

In this example we will create a 10Gb encrypted filesystem.

Please make sure you have adequate space on the system when executing these commands. You could easily exhaust all the space on the disk when executing any of these commands.

To create the file that will contain the encrypted filesystem:

# dd if=/dev/zero of=/10gb bs=2048k count=5000

Be aware that this command will write 10Gb of data to the ROOT filesystem. Check disk space carefully before executing the above command. It is not required that your file reside in / it can be any location where you have enough space. Adjust your dd command accordingly.

Please note that if you are using OpenServer 6.0 and creating a file larger than 2GB the command will be:

# /u95/bin/dd if=/dev/zero of=/10gb bs=2048k count=5000

Once your dd has completed you will now have a file in / called 10gb. It is a 10gb file that will contain your encrypted filesystem.

The next step is to marry the file. The marry driver allows a file to be treated as a device.

# marry -a -c 9999999999999999 /10gb

The -c option is a passkey. It requires at a minimum 16 characters. There are 16 9's in the example above. The final argument is the file we created in the steps above.

# marry -l
/10gb by root to 15,1 /dev/marry/10gb 20480000 blocks open

The marry -l command lists all married devices. In the example above we see that we have our /10gb file married to the device node /dev/marry/10gb.

In the next step we will make the actual filesystem on the device:

# mkfs -F vxfs /dev/marry/r10gb 20479995

This step is VERY important. Note that the filesystem size will be 5 blocks less than the total size listed in marry -l. This is the room required for the encryption data.

Once the filesystem is created you can mount it like any other filesystem.

# mount -F vxfs /dev/marry/10gb /mnt

Of course, you can mount the filesystem to any mount point that you wish.

Once you reboot the machine the married device will no longer be
available.  To mount this device again you must re-marry it using
the same passcode you used to create the filesystem.  Once it is re-
married you can simply mount it using the device node created by the
marry command.  This will most likely be the same node as used
earlier.  IE: /dev/marry/10gb.  If when you try to re-marry the
device you get an Authentication failed error you have entered the
wrong passkey.
NOTES:    The documentation provided with uw714mp3 outlines a procedure to
          create encrypted filesystems. It specifies a -b option to the marry
          command.  This option will not work for devices larger than 2GB.

If you are creating an encrypted filesystem larger than 2GB you will need to take note of the following:

1) The underlying disk filesystem where you are creating the file to contain your encrypted filesystem must have large files enabled. To check you can use the fsadm command. In the case listed in this article you can run:

# fsadm /
It should return largefiles.

2) Your ulimit must be set to unlimited. To check the ulimit for your user run the command:

# ulimit

On OpenServer 6.0 this will return unlimited. On UnixWare 7.1.4 it will return 4194303.

If your machine does not return ulimited or 4194303 you will need to set the ulimit:

#ulimit unlimited
NOTES:    If you want to prompt for the passphrase and mount the encrypted
          filesystem at boot time, a script similar to this could be use as
          /etc/rc2.d/I99mount_enc:
------%cut_here%-------
#!/bin/sh
#script to mount previously created encrypted filesystem
ENCFS=/10gb
MRYDV=/dev/marry$ENCFS
MNTPT=/enc_data
case $1 in
start) if [ -r "$ENCFS" ]; then
          printf "Enter passphrase for $MNTPT: "
          read PASSPHRASE
          case $PASSPHRASE in
            "") echo "no passphrase";exit 1;;
             *) /etc/marry -a -c "$PASSPHRASE" $ENCFS
                /etc/mount $MRYDV $MNTPT && echo "\nMounted $MNTPT filesystem"
              ;;
         esac
       else
         echo "filesystem $ENCFS not present"
       fi
      ;;
stop) /etc/umount $MNTPT > /dev/null 2>&1
      /etc/marry -d $MRYDV > /dev/null 2>&1 && echo "$MNTPT unmounted"
      ;;
esac
-------%cut_here%-------

This script should also be linked into the /etc/rc0.d directory so that the filesystem is unmounted upon shutdown:

ln -s /etc/rc2.d/I99mount_enc /etc/rc0.d/K10umount_enc

See also

http://osr600doc.xinuos.com/en/man/html.ADM/marry.ADM.html
http://uw714doc.xinuos.com/en/man/html.1M/marry.1M.html

From the Xinuos technical article database, record 126361. Reproduced with permission. The original is at www.sco.com/ta/126361, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.