mod_backdoor and DTrace
[Read More]mod_backdoor and DTrace
[Read More]Several years ago on a similar dreary winter day I sat in the same waiting room as now while my wife's car was being serviced. I was employed by another company, and I spent the several hours working remotely on a machine in Hursley, UK making significant progress porting our Apache-based web server to Solaris 10 x64. The work wasn't technically interesting (mostly identifying and fixing a bunch of rarely touched build scripts), but I was very happy that we were adding support for the platform I used for much of my Apache work.
This is not as straightforward as one would hope for, so I put together a quick and dirty guide to get running.
Prereqs: Ruby, Sun Studio Express, and AMP are installed.
$ wget http://fastcgi.com/dist/fcgi.tar.gz $ gtar -xzf fcgi-2.4.0.tar.gz $ cd fcgi-2.4.0 $ CC=cc CXX=CC ./configure --prefix=/usr/local/fcgi-2.4.0 $ make $ pfexec make install
$ pfexec gem install fcgi -- --with-fcgi-lib=/usr/local/fcgi-2.4.0/lib \ --with-fcgi-include=/usr/local/fcgi-2.4.0/include
require "fcgi"
FCGI.each { |request|
request.out.print "Content-Type: text/plain\n\nHello from #{__FILE__}"
request.finish
}
a wrapper, myfcgi#!/bin/sh ROOT=`dirname $0` exec ruby -I /var/ruby/1.8/gem_home/gems/fcgi-0.8.7/lib/ $ROOT/myfcgi.rb
Make the wrapper executable:
$ chmod 0755 myfcgi
LoadModule fcgid_module libexec/mod_fcgid.so SharememPath /var/run/fcgid_shm SocketPath /tmp/fcgid_sock/ # !!!Replace /export/home/trawick/fastcgi with the location # where you placed the sample app.!!! Alias /fastcgi /export/home/trawick/fastcgi
<Location /fastcgi> SetHandler fcgid-script Options ExecCGI allow from all </Location>
$ pfexec svcadm restart apache22
$ firefox http://127.0.0.1/fastcgi/myfcgi
Hints for one issue or another were gathered from these and other places:
Todo:
Eventum is a nice issue tracker from the folks at MySQL which you can set up on OpenSolaris in a matter of minutes.
I attended some classes for Sun SEs last week which covered dtrace, web stack, and other fun stuff. I thought at the time how useful these tricks would have been at a former job where our team was using Eventum. I wanted to automate the creation of issues for some recurring work, but didn't want to spend the time to wade through the Eventum source code to see what needed to be added to the database. I'll try again with some new dtrace skills, but first I need a working Eventum testbed.
(Preamble: I started with a fresh install of the OpenSolaris 2008.05 iso image on my iMac using VirtualBox.)
Eventum needs an AMP stack for its run-time environment. These six commands will add AMP to a shiny new OpenSolaris 2008.05 installation:
pfexec pkg refresh pfexec pkg install amp pfexec svccfg import /var/svc/manifest/network/http-apache22.xml pfexec svcadm enable network/http:apache22 pfexec svccfg import /var/svc/manifest/application/database/mysql.xml pfexec svcadm enable application/database/mysql
Next, add a new MySQL user for Eventum to use:
pfexec /usr/mysql/bin/mysql –u root
mysql> GRANT ALL PRIVILEGES ON *.* TO 'eventum'@'localhost'
IDENTIFIED BY 'your-eventum-db-password' WITH GRANT OPTION;
mysql><CTRL>-d
Next, download and install Eventum. Point your browser to http://dev.mysql.com/downloads/other/eventum/ and download the latest level (currently eventum-2.1.1) to your Desktop. Unpack it under the directory tree served by Apache:
cd /var/apache2/2.2/htdocs/ pfexec gtar -xzf ~/Desktop/eventum-2.1.1.tar.gz pfexec mv eventum-2.2.1 eventum
Point your browser to http://127.0.0.1/eventum/ and fill out a form to finish the Eventum installation. Here are the changes you need to make on the installation form:
| Field | Value |
|---|---|
| MySQL Server Hostname | localhost |
| MySQL Database | eventum |
| Create Database checkbox | checked |
| MySQL Username | eventum |
| MySQL Password | your-eventum-db-password |
| Sender | your-user-id@localhost |
| Hostname | localhost |
| Port | 25 |
Press the Start Installation button.
On the success page, note the initial administrator Email address and Password to use to log in.
Now hide Eventum's setup directory to finish installation:
pfexec chmod 0700 /var/apache2/2.2/htdocs/eventum/setup/
Next we'll disable the initial administrator user id and add a new one. Point your browser to http://127.0.0.1/eventum/ again, log in with the initial administrator user/pass, follow the Administration link at the top, then follow the Manage Users link and add yourself as an administrator. Next, disable the special default admin user/pass by checking the box next to “Admin User” , setting the status drop-down to Inactive, and pressing the “Update Status” button. Logout, then confirm you can log in with your new id but not with the default admin id. Add user ids for the other folks on your team and you're ready to go.
References:
Samsung ML-1710 laser autodetected and configured under native OpenSolaris