]> git.donarmstrong.com Git - bin.git/commitdiff
update sa and add simple_ssl
authorDon Armstrong <don@donarmstrong.com>
Fri, 11 Nov 2005 05:00:16 +0000 (05:00 +0000)
committerDon Armstrong <don@donarmstrong.com>
Fri, 11 Nov 2005 05:00:16 +0000 (05:00 +0000)
sa
simple_ssl [new file with mode: 0755]

diff --git a/sa b/sa
index fd43d453e8a196184e5fc11ab15c4246ed88616a..a8da86b179084620d396ae960b550dc22f48567b 100755 (executable)
--- a/sa
+++ b/sa
@@ -86,6 +86,7 @@ sub parse_config_file {
          next if /^#/;
          my ($repo,$command) = split /\t/,$_,2;
          $repo =~ s/^\~/$home/;
+         $command =~ s/^\~/$home/ if defined $command;
          $$repos{$repo} = $command;
      }
 }
diff --git a/simple_ssl b/simple_ssl
new file mode 100755 (executable)
index 0000000..831dc42
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+make_key () {
+    # Takes one argument, the Distinguished name
+    # Creates a single signed cert, cert.pem in the current directory
+    cat -<<EOF |openssl req -nodes -new -keyout key.pem -out key.req -days 9000 >/dev/null 2>&1
+.
+.
+.
+.
+.
+$1
+.
+
+
+EOF
+    openssl x509 -in $CACERT -noout -next_serial -out serial >/dev/null 2>&1
+    touch database database.attr
+    cp /usr/lib/ssl/openssl.cnf config
+    perl -pi -e 's/(database|serial)\s*=.+/$1=$1/' config
+    openssl ca -config config -policy policy_anything -keyfile $CAKEY -cert $CACERT \
+       -out cert.pem -outdir . -notext -days 9000 -batch -infiles key.req > /dev/null 2>&1
+    rm -f database database.attr database.old database.attr.old config serial serial.old
+    rm -f key.req
+}
+
+
+if [ -n "$1" -a ! -e $1 ]; then
+
+    cat -<<EOF |openssl req -new -nodes -x509 -keyout $1.key -out $1.crt -days 9000 >/dev/null 2>&1
+.
+.
+.
+.
+My CA Key
+.
+
+EOF
+
+fi;
+
+CACERT=$1.crt;
+CAKEY=$1.key;
+make_key $2
+mv key.pem  $2.pem
+mv cert.pem $2.crt