parsed.org

Tips by tag: key

Decrypt RSA Key by xinu on Sep 10, 2005 12:15 AM

Tired of typing your SSL password on boot of your webserver? You can decrypt it if you're certain it's safe:

# openssl rsa -in server.key -out server.key.unsecure
apachebootcommandsencryptionkeyopensslsecurityshellsslwebserver

Given a table MYTABLE in namespace MYNAMESPACE, you can use this SQL to retrieve the primary key column name(s) for the table:

SELECT
  attname::text
FROM
  pg_attribute
JOIN
  pg_class ON pg_attribute.attrelid = pg_class.oid
JOIN
  pg_namespace ON pg_namespace.oid = pg_class.relnamespace
LEFT JOIN
  pg_constraint ON conrelid = pg_class.oid AND pg_constraint.contype = 'p'
WHERE
  pg_namespace.nspname = 'MYNAMESPACE' AND
  pg_class.relname = 'MYTABLE' AND
  pg_attribute.attnum = ANY (pg_constraint.conkey)
ORDER BY
  pg_attribute.attnum;
columnsinternalskeymetadatapostgresqlprimarysql
Xargs & SSH by xinu on Apr 19, 2006 05:48 AM

Let's say you want to check the uptime on a list of servers. We're assuming that you've got a key on each machine otherwise you'll be entering your password often:

$ xargs -i ssh {} uptime < ./server.list
  5:46am  up 155 days, 17:49,  2 users,  load average: 0.12, 0.03, 0.01
  5:46am  up 147 days, 17:14,  2 users,  load average: 0.02, 0.05, 0.01
  5:46am  up 209 days, 17:26,  0 users,  load average: 0.00, 0.00, 0.00
  5:46am  up 89 days,  6:30,  0 users,  load average: 0.00, 0.00, 0.00
  5:46am  up 82 days,  6:40,  0 users,  load average: 0.07, 0.06, 0.01
  5:46am  up 104 days,  9:51,  0 users,  load average: 0.03, 0.03, 0.00
  5:50am  up 68 days,  9:17,  0 users,  load average: 0.00, 0.00, 0.00
  5:48am  up 68 days,  9:15,  0 users,  load average: 0.00, 0.00, 0.00
commandskeyloopremoteserversshellsshuptimexargs
RSS