Nevyn's Blog

Monday, 4 August 2008

BlueQuartz::DB4

Hi folks - just having some more fun poking around under the hood of the sausalito UI (user interface) for BlueQuartz linux. I'm actually just trying to amend one of the package names installed under the BlueLinQ tab, because I have installed Webmin 1.250, and after upgrading it to 1.420 BlueLinQ has frustratingly kept the original 1.250 version number.

I have traversed the JavaScripts, read the PHP, and found my way into the $cce objects. That led me to the discovery of the cce.so module used by the php4 admin backend webserver. it would appear that with this, the $cce object in PHP communicates with the /usr/sausalito/sbin/cced daemon via the cced.socket unix socket. (I could be slightly off here, but that seems to be vaguely representative?)

There are 2 xml files in the /usr/sausalito/ui/style folder which define the colour schemes, 'Merlot' and 'trueBlue'. However, there are over 100 other .xml files in the /usr/sausalito/ui subfolders, which looked like a good place to find where BlueQuartz kept its data, but upon inspection appeared only to contain definitions for the various menus etc associated with the admin UI.

Without looking at (for) the objects, methods and function calls in the php which manipulate the cced, I investigated the cceclient /usr/sausalito/bin/cceclient. I recommend setting up an alias by using a line like "alias cceclient='/usr/sausalito/bin/cceclient'" in your terminal session (or better, in your ~/.bashrc file) to make it easier. See my earlier post for commands you can use, and READ THE WARNINGS!

So now you've got access to the backend. Perhaps you can even GET and SET some values, and whilst this may be enough to solve the above problem (altering the description of an installed package), I was still curious about where it stored the data, as it wasnt in any of the .xml files found thus far, I couldn't see any evidence in the MySQL db, and there was no sign of a postgreSQL server either.

The clue is /usr/sausalito/db4 - looks like a Berkeley db4 v4.0.14 backend, and sure enough, the apache admin instance also has dba support built in. It doesnt appear to use SQL, resembling more of a structured file like xml with key=value pairs. I'll try and update this section shortly...

Until then, for more info see these links:

/usr/sausalito/db4/docs/index.html is the path to the (local) documentation on BlueQuartz and contains the API for C/C++, Java and Tcl. See also the docu about the supporting utilities (in db4/bin)

Adding dba support to php

How to Create a db4 Database from a Text File or Array

http://www.stanford.edu/services/pubsw/package/libraries/db4.html

"Description: Embedded database and hash file library
Source: http://www.sleepycat.com/

Berkeley DB is a programmatic toolkit that provides high-performance built-in database support for desktop and server applications and for information appliances.

The Berkeley DB access methods include B+tree, Extended Linear Hashing, Fixed and Variable-length records, and Queues. Berkeley DB provides full transactional support, database recovery, online backups, and separate access to locking, logging and shared memory caching subsystems."

Labels: , , , , , , , ,

Sunday, 3 August 2008

Samba howto - connecting from linux

Credits once again go to www.raqpak.com (site offline) for this. Its targeted towards Cobalt users, but it could be applicable to anyone on a linux machine trying to access a windows resource. I included it mainly for my own reference here, although I suppose I could compliment it with the counterpart - how to setup a Samba share on Cobalt / BlueQuartz / Linux for windows users to access


Mount a windows NT/2000/98 path

If you want to mount a windows filesystem onto your Qube3 use the following command:

mount -t smbfs -o username=theuser,password=thepass //servername/sharename /home/groups/home/network

Change username/password as required (If you dont need to authenticate, remove the entry and the -o option parameter completely)
Create the directory you want to mount the drive to, so in the above example create /home/groups/home/network first then do the mount statement.

If possible, before a reboot or shutdown, do a:
umount /home/groups/home/network
otherwise the reboot will take longer as it unmounts the system itself.

(For this to work i'm assuming you've configured your network file sharing/workgroup stuff correctly as its all related)

Labels: , , , , , ,

RaQ::Packages (manual installation)

one more article from www.raqpak.com (site offline)

Manually install PKGs

Incredibly simple HOWTO this one, but one that I constantly forget, to install a PKG via the ssh/command-line simply use:

/usr/local/sbin/cobalt_upgrade nameof.pkg

This is the case for RaQ3 and RaQ4.
For the Qube3 do:

/usr/sausalito/sbin/pkg_prepare.pl [-i] [-R] -f
/usr/sausalito/sbin/pkg_prepare.pl [-i] [-R] -u

Where -i means install, and R means do not automatically reboot.

- Andy

Labels: , , ,

RaQ::LCD messages

A howto that came from www.raqpak.com (site offline)

Writing messages to LCD

How to write messages to the LCD on Qube3 and Raq3 or greater

If you want to write messages or information to the LCD screen on your Cobalt Raq (3 and above) or Cobalt Qube (3 and above in this example) it is simply done using a set of binary utilities used by Cobalt's own interfaces.

In the /sbin/ directory there are several scripts available to use. I'll try to explain each one, so that you can do similar functions to Cobalts own setup/configure/control scripts.

lcd-write is the main script, this allows a normal message to be written to the screen. You can write to both lines in the following way:

/sbin/lcd-write "line1" "line2"

Whenever writing to the LCD you must call the LCD-STOP script first. This releases lock files and allows you access to the display. So a correct implementation would be:

/sbin/lcdstop /sbin/lcd-write "line1" "line2"

To return the LCD to its original state, simply call

/sbin/lcdstart


To create the loading type display (Information followed by a blinking * symbol) call the lcd-swrite package, which is also in the /sbin location. This is called in the same way as lcd-write and simply changes what is displayed and the duration for display.

An example would be

/sbin/lcd-swrite "Loading" "Custom pkg"

NOTE: Don't forget the character length that the screen can display, and that it can't accept many of the extended characters


(I'll add more info shortly folks - Andy@raqpak.com )

Labels: , , , ,

RaQ::Security - htaccess

Another article I found from www.raqpak.com (site offline)

htaccess & directory security
HowTo secure your folders


There are a lot of posts to do with .htaccess file and how to use them correctly on Cobalt Raq products.

The most noted problem is the authentication actually seems to allow anyone whos registered with the RaQ to get behind the secured area. This is only true if the file hasn't been configured correctly, as when set correctly it will read only the users specified in the .htpasswd file as per any normal configuration.

Create the .htaccess file as follows:

# Access file
order allow,deny
allow from all
require valid-user
AuthPAM_Enabled off
Authname "My Secure Directory"
Authtype Basic
AuthUserFile /home/sites/home/path/to/.htpasswd


This is the same as any standard .htaccess except it includes the AUTHPAM setting, this is because Apache on the RaQ's have been compiled with PAM (Pluggable Authentication Module) support, and so will authenticate via the system if it cannot authenticate via the password file.

Create the htpasswd file in the usual way:
htpasswd -c /home/sites/home/path/to/.htpasswd myuser
And type the password in.

Labels: , , , , , , , , ,

BlueQuartz::Using the cceclient tool

Came across this excellent article whilst messing around with Sausalito, the backend UI on my BlueQuartz server. Its a low level way of accessing cce, the Cobalt Configuration Engine, and from what I gather an efficient way of hosing your system if not careful.

(It resembles accessing Cisco switches over serial console links, or using the MSC / MMSC on my SGI Origin servers, and has a very arcane feel to it. Perhaps I should set the terminal font colour to green or amber for best effect)

I pinched it from http://www.cobaltfaqs.com/index.php/Using_cceclient_tool, and reposted it here, because you never know when useful stuff like this will disappear. Dont forget to check the original page, in case their copy is fresher.

Using cceclient tool
From CobaltFAQs

CCE is the Cobalt Configuration Engine. It is a series of XML files that are used to configure the user interface settings. This is not a beginner tool. There is no undo function so be careful.

You must be logged in as root. Then issue the command:

/usr/sausalito/bin/cceclient

This will bring you to a command prompt:

100 CSCP/0.80 200 READY

Help is available by typing

help

ADMIN suspend | resume : suspend or resume write operations

AUTH : Authenticate as a user

AUTHKEY : Attempt to resume a session

BEGIN : Begin a transaction

BYE [SUCCESS | FAIL | DEFER] : Disconnect immediately, indicating exit status

CLASSES : List all classes

CREATE [= ...] : Create a new instance of the specified class

DESTROY : Destroy the specified object

ENDKEY : Expire the current sessionid now

FIND [= ...] : Find instances of the specified class, matching given criteria

GET [.] : Get a list of key=value pairs for the specified object

HELP : Show help about all commands currently available

NAMES | : List available namespaces for an object or class

SET [.] [= ...] : Set all listed keys to listed values in the specified object

WHOAMI : Get the object id of the currently logged in user

To exit use the command:

bye

Please note that commands are case specific! Also, there is no undo for these commands so I suggest capturing the settings before editing by using the GET command. Use the cceclient command at your own risk!

--ChrisD 18:18, 15 May 2005 (UTC)

Labels: , , , , , ,