Public Key, Private Key

If you use ssh (Secure Shell) with public/private keys, here is a quick reference. The private key stays on the computer you will connect/send from. The public key goes on the computer(s) you will connect/send to. You can think of the private and public keys as a signature of the sending computer, and they are used to validate/authenticate the sender. (Keys are also affiliated with the user account that creates them.)

Create the public key, private key pair:

ssh_keygen -t rsa

I used RSA encryption here. You can also use DSA. This generates two files: id_rsa (private key) and id_rsa.pub (public key). Move id_rsa to your .ssh directory.

mv id_rsa ~/.ssh

Copy/send id_rsa.pub to the .ssh directory on the computer you will connect to.

scp id_rsa.pub receiving_username@receiving_domain.com:~/.ssh

Add id_rsa.pub to the authorized_keys file on the receiving computer.

cat id_rsa.pub >> authorized_keys

That is essentially it. Now when you connect from the computer with the private key to the computer with the public key, you will be using a secure connection.

To take this one step further and simplify connection commands, you can add an IdentityFile directive to a ssh config file. This allows you to use the keys along with a known, well used username to connect to the receiving_domain computer more quickly.

Create a config file in your .ssh directory (litterally named config) if you don’t already have one. Add the reference to the private key.

Host receiver
    User: receiving_username
    IdentityFile: ~/.ssh/id_rsa

Then, when you connect, you can issue the command

ssh receiver

and it will ask for the pass phrase (not password) you supplied when you created the private key.

 

TinyMCE hack to shoehorn Paul Irish conditional statements into Cascade Server

Here is some code to shoehorn Paul Irish’s conditional statements for Internet Explorer into Hannon Hill’s Cascade Server using PHP’s ob_start() function. This is a mashup from a few people on the Cascade help forum. Really, it’s a TinyMCE (Cascade’s WYSIWYG editor) hack to get conditional code, i.e. comments, around the HTML tag. I know it’s a very specific use case, but if you are trying to make your web site responsive using HTML5 Boilerplate in Cascade you’ll want this. (Irony: WordPress’s WYSIWYG editor won’t save the code correctly so I took a screen shot.)

Paul Irish Cascade hack

UPDATE

Hannon Hill added a set of special tags in version 7.4 of Cascade that allow code – even “illegal” code – to sit in a page unrendered. You’ll find it in their knowledge base under Code Sections. Below is a revised version of the Boilerplate conditional statements using the new “protect-top” tag.

protect-top-cascade

Un-Minimizing Attributes Written With PHP In TinyMCE

I think this is a “feature” of HH implementation of TinyMCE, but I noticed that the editor would “correct” my attributes when I wrote them properly in an PHP echo statement.

echo "<option value=\"$abc\" selected=\"selected\">$abc</option>\n";

would save as

echo "<option value=\"$abc\" selected="selected">$abc</option>\n";

which of course breaks PHP. No matter how I tried to trick it into using escaped quotes it always changed back to unescaped.

My solution was to use single quotes and concatenate the variables into the string:

echo '<option value="'.$abc.'" selected="selected">'.$abc.'</option>'."\n";

For your reference, here are the minimized attributes that will need this treatment:

HTML XHTML
compact compact=”compact”
checked checked=”checked”
declare declare=”declare”
readonly readonly=”readonly”
disabled disabled=”disabled”
selected selected=”selected”
defer defer=”defer”
ismap ismap=”ismap”
nohref nohref=”nohref”
noshade noshade=”noshade”
nowrap nowrap=”nowrap”
multiple multiple=”multiple”
noresize noresize=”noresize”

There should be a better way to do this. A lot of code is written the proper way in PHP and switching it is untenable.