Normally most webservers these days that hold sensitive information allow SSL ciphers of 128 bit or higher. However, it would be nice to redirect older browsers to a different page, suggesting that they upgrade their browser to one supporting decent encryption.
This can be done in Apache with mod_rewrite and enabling lower strength ciphers. Read on to see example configuration code...
Apache's mod_rewrite can be used to do time-sensitive redirects... handy if you have to make a scheduled change at an inconvenient time. But even better, what if you need to get to the original site? This example also includes a url /backdoor that sets a 15 min cookie, redirects to the main page, and an exclusion to not redirect anyone who has that cookie set. Cool stuff.
RewriteEngine On
# Start redirecting after this datetime
RewriteCond %{TIME_YEAR}%{TIME_MON}%{TIME_DAY}%{TIME_HOUR}%{TIME_MIN} >200904040900
# Don't redirect certain paths
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteCond %{REQUEST_URI} !^/webservices
RewriteCond %{REQUEST_URI} !^/backdoor
# Don't redirect if backdoor cookie is active
RewriteCond %{HTTP_COOKIE} !backdoor
# Do the rewrite
RewriteRule .* http://mynewhostname/ [R,L]
# Allow back door access to old site (this site) - hit /backdoor and they get a cookie for
# 15 mins such that they won't be redirected while it is active.
RewriteRule ^/backdoor http://myoldhostname/ [CO=backdoor:yes:myoldhostname:15:/]
One of my passions is automated monitoring and correction of network and server problems. I have the most experience with SiteScope (primarily a commercial website monitoring tool that has branched out to include protocols, application stacks, and whatever custom stuf you want) and Nagios, which is free and open source, and very very configurable.
I would LOVE to form a company implementing these or similar monitoring tools. I've done this a lot at work, and a little bit on the side for a few friends and their companies.
I've been looking around, and it seems that in addition to Nagios, two other contenders are Zenoss and Cacti. I've heard good things about Zenoss, specifically how it is easier to set up than Nagios. I think I may check it out, though I am a fan of Nagios's flexibility.
We had a requirement from a client whose windows website we were migrating to UNIX that the new site be able to handle mixed case tickers, ie, /pwc, /Pwc, /PWC, /pwC, etc. Using mod_rewrite, it was doable:
# Take any mixed or uppercase ticker and set to lower
RewriteMap lowercase int:tolower
RewriteRule ^(/[A-Z]...?)$ ${lowercase:$1} [R,L]
RewriteRule ^(/.[A-Z]..?)$ ${lowercase:$1} [R,L]
RewriteRule ^(/..[A-Z].?)$ ${lowercase:$1} [R,L]
RewriteRule ^(/...[A-Z])$ ${lowercase:$1} [R,L]
This case conversion will be true for any 3 or 4 char URI with an uppercase letter. (It would probably be better to replace the "." above with [a-zA-Z], as it's likely intended for only chars to replace. Above will transform /a/BB as well, which is probably not desired.)
It seems that even selecting a jury in Fort Bend county takes longer than can be done before lunch. I had a deceptively filling steak burrito at a local mexican place, and then decided to spend the remaining 60 of my 90 minute lunch walking around historic Richmond. I noticed an Italian place serving Osso Bucco! Darn, too bad I already ate. Now I almost want to be on the jury so I can go back there as well as another popular looking place or two.
I had the misfortune of walking into a gift shop with a confectionery, and thus walked out with two pieces of peanut butter fudge. Sitting on the bench in the cool afternoon tasting the peanutty treat with the sun on my face really made my day.
I got back to the courtroom with 30 minutes to spare, and I noticed that the jury chairs are nice, padded, blue leather chairs. Did I mention that they recline? I'm dead meat after lunch if I am on the jury!
I wonder if it's OK to have a margarita with lunch? Needless to say, I didn't get selected, so I won't get the opportunity... It's probably also not a good idea to do so during jury days, but having one on the jury selection day can't hurt! Just don't get sloshed. *wink wink*
Interesting note: they pay $40 / day if you are selected on the jury, but not for the jury selection. I guess that's sort of the consolation prize for those who have to return the next day.
Monday, September 04 2006 @ 12:28 AM CDT
Contributed by: nat
Views: 284
I noticed tonight that the baby channel (Noggin) that runs shows like Little Bear, Blues Clues, Barney, etc turns into Teen Soap Opera channel after 5. Wow.... Wife started watching one and didn't want me to switch to something else... and damn, I started following it, too.... There's been a "Degrassi" marathon on tonight that's been on while I've been computing on my laptop. I suppose it's interesting enough for a background show, but it's scary to think that I'd stop computing and do more watching... Like I said, teenage soap opera. More interesting that my wife's soap operas she used to watch, anyway. Is that a bad thing?
Tuesday, August 15 2006 @ 10:55 AM CDT
Contributed by: nat
Views: 299
Lots of times I have a need to make a backup of a file or such that I end up forgetting about and it sits around taking up disk space. Sometimes in annoyance of this, I have simply skipped making the backup, and have been burned by it. Finally I came up with this alternative:
Make a directory on your desktop called DeleteIn2Weeks. In my case, the full path was /home/guytonw/Desktop/DeleteIn2Weeks
Create the following cron entries:
0 1 * * * find /home/guytonw/Desktop/DeleteIn2Weeks -mtime +14 -type f -exec echo Deleting {} \;
1 1 * * * find /home/guytonw/Desktop/DeleteIn2Weeks -mtime +14 -type f -exec rm {} \;
This is nice because any files put in there will automatically be swept away after a sufficient amount of time. (Hopefully I won't need the backup after 2 weeks' time!)
Lately I've been playing Diablo 2 a lot. It came out in the year 2000, and is still selling on shelves today. Nicely enough, Blizzard has released patches over time that have added items and special game events for really high level characters, not to mention changing the dynamics of skill points. OK, OK, I'm geeking out here.
The main reason I started playing was because I did not want to buy a new laptop to play some of the newer games. One day I'll break down, but it's not necessary just yet... At any rate, it's a lot of fun playing online!
Following along in my mod_perl2 notes, I wanted to document how to get CGI::Ajax working with mod_perl2. I hit a couple of snags along the way that are worth noting. First, the generated javascript for my functions was calling httpd? + vars, rather than my URI /modperl_handler/ajax? + vars. This was frustrating, but I determined that it was grabbing httpd from $0, so I changed it locally and the script worked after that. The second snag I hit was because I was instantiating my CGI module globally instead of locally, and I would get segfaults now and then. Instantiating it inside the handler was the right way to go. Here is a working example:
package AjaxTest;
use CGI;
use CGI::Ajax;
use Apache2::RequestRec();
use Apache2::RequestIO();
use Apache2::Const -compile => qw(OK);
sub handler {
my ($r) = @_;
my $cgi = new CGI; # had this outside the handler and was getting segfaults
# Have to redefine $0 for CGI::Ajax because it's used to call further URLs from
# javascript ajax functions. (otherwise it did "httpd?"...)
local $0 = $ENV{"REQUEST_URI"};
$0 =~ s/?.*//;
# Start Ajax stuff
my $pjx = new CGI::Ajax("test_ajax" => &test_ajax);
# Don't compress javascript (1 for user fcns only, 2 for all)
$pjx->JSDEBUG(1);
# Send stderr to web logs
$pjx->DEBUG(1);
print $pjx->build_html( $cgi, &base_page);
return Apache2::Const::OK;
}
sub base_page {
return "Ajax mod_perl testmod_perl 2.0.2 on apache 2.2.2 rocks! <p><div id="test">Change me</div><p>nn";
}
sub test_ajax {
my $time = time();
return "Test successful; $time<p>";
}
1;
I recently bought the Linksys pre-N router (WRT300N) and a laptop PC card. I hate to say it, but the 4x range that it promises is flat out wrong. I get better connection to my wireless G router (WRT54G) up on the second floor. However, the throughput is amazing - 270 mbit/sec as opposed to 54. I just need to get it working well.
I see that they have come out with some firmware upgrades since I last checked a week ago, and it mentions improving wireless power and performance. We'll see what happens!