code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/bin/sh # Copyright 2006 Bernhard Reutner-Fischer # Licensed under GPLv2 or later, see file LICENSE in this source tree. . ./testing.sh a="taskset" # testing "test name" "opts" "expected result" "file inp" "stdin" testing "taskset (get from pid 1)" "$a -p 1 >/dev/null;echo \$?" "0\n" "" "" testing "tas...
Shell
#!/bin/sh # Copyright 2008 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh test x"`id -u`" = x"0" || { echo "SKIPPED: makedevs (must be root to test this)" exit 0 } unset LANG unset LC_COLLATE unset LC_ALL # ls -ln is showing date. Need to remove that, it's variable ...
Shell
#!/bin/sh # Copyright 2008 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh umask 022 # ls -ln shows date. Need to remove that, it's variable. # sed: coalesce spaces # cut: remove date # grep: remove "total NNN" lines FILTER_LS="sed 's/ */ /g' | cut -d' ' -f 1-5,9- | gr...
Shell
#!/bin/sh # Copyright 2008 by Denys Vlasenko <vda.linux@googlemail.com> # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "description" "command" "result" "infile" "stdin" testing "comm test 1" "comm input -" "\t123\n""456\n""abc\n""\tdef\n" "456\nabc\n" "123\ndef\n...
Shell
#!/bin/sh # Tests for the sourcecode base itself. # Copyright 2006 by Mike Frysinger <vapier@gentoo.org> # Licensed under GPLv2, see file LICENSE in this source tree. [ -n "$srcdir" ] || srcdir=$(pwd) . ./testing.sh # # if we don't have the sourcecode available, let's just bail # [ -s "$srcdir/../Makefile" ] || exi...
Shell
#!/bin/sh . ./md5sum.tests sha3sum c29d77bc548fa2b20a04c861400a5360879c52156e2a54a3415b99a9a3123e1d5f36714a24eca8c1f05a8e2d8ba859c930d41141f64a255c6794436fc99c486a
Shell
#!/bin/sh # Copyright 2009 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "test name" "options" "expected result" "file input" "stdin" # Simple one-block file transfer # rx => 'C' # rx <= SOH <blockno> <255-blockno> <128 byte padded with x1A> <crc> <crc> # rx...
Shell
#!/bin/sh # Copyright 2009 by Denys Vlasenko <vda.linux@googlemail.com> # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "description" "arguments" "result" "infile" "stdin" testing "tr does not treat [] in [a-z] as special" \ "tr '[q-z]' '_Q-Z+'" \ "_QWe+" "" "[qwe]" testing...
Shell
#!/bin/sh # unit test for sum. # Copyright 2007 by Bernhard Reutner-Fischer # Licensed under GPLv2 or later, see file LICENSE in this source tree. # AUDIT: Unit tests for sum . ./testing.sh # testing "test name" "options" "expected result" "file input" "stdin" # file input will be file called "input" # test can...
Shell
#!/bin/sh # SUSv3 compliant sort tests. # Copyright 2005 by Rob Landley <rob@landley.net> # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # The basic tests. These should work even with the small busybox. testing "sort" "sort input" "a\nb\nc\n" "c\na\nb\n" "" testing "sort #2" "sort inp...
Shell
#!/bin/sh # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com> # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh test -f "$bindir/.config" && . "$bindir/.config" test "`id -u`" = 0 || { echo "SKIPPED: mount (must be root to test this)" exit 0 } if test x"$CONFIG_MKFS_MINIX" != x...
Shell
#!/bin/sh FAILCOUNT=0 ext=bz2 bb="busybox " unset LC_ALL unset LC_MESSAGES unset LANG unset LANGUAGE hello_gz() { # Gzipped "HELLO\n" #_________________________ vvv vvv vvv vvv - mtime $ECHO -ne "\x1f\x8b\x08\x00\x85\x1d\xef\x45\x02\x03\xf3\x70\xf5\xf1\xf1\xe7" $ECHO -ne "\x02\x00\x6e\xd7\xac\xfd\x...
Shell
#!/bin/sh . ./md5sum.tests sha256sum 8e1d3ed57ebc130f0f72508446559eeae06451ae6d61b1e8ce46370cfb8963c3
Shell
#!/bin/sh # Wrapper for User Mode Linux emulation environment RUNFILE="$(pwd)/${1}.testroot" if [ -z "$RUNFILE" ] || [ ! -x "$RUNFILE" ] then echo "Can't run '$RUNFILE'" exit 1 fi shift if [ -z $(which linux) ] then echo "No User Mode Linux." exit 1; fi linux rootfstype=hostfs rw init="$RUNFILE" TESTDIR=`p...
Shell
#!/bin/sh # Copyright 2008 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # Need this in order to not execute shell builtin bb="busybox " # testing "test name" "command" "expected result" "file input" "stdin" testing "printf produces no further output 1" \ "${bb}prin...
Shell
#!/bin/sh # Copyright 2011 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "test name" "commands" "expected result" "file input" "stdin" testing "uncompress < \x1f\x9d\x90 \x01 x N" \ 'uncompress 2>&1 1>/dev/null; echo $?' \ "\ uncompress: corrupted data 1 " \...
Shell
#!/bin/sh # Tests for busybox applet itself. # Copyright 2005 by Rob Landley <rob@landley.net> # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh HELPDUMP=`true | busybox 2>&1 | cat` # We need to test under calling the binary under other names. optional FEATURE_VERBOSE_USAGE testing "busy...
Shell
#!/bin/sh # Copyright 2008 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "test name" "cmd" "expected result" "file input" "stdin" testing "start-stop-daemon -x without -a" \ 'start-stop-daemon -S -x true 2>&1; echo $?' \ "0\n" \ "" "" testing "start-stop...
Shell
#!/bin/sh # Copyright 2008 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "test name" "command" "expected result" "file input" "stdin" testing "xargs -E _ stops on underscore" \ "xargs -E _" \ "a\n" \ "" "a\n_\nb\n" testing "xargs -E ''" \ "xargs -E ''" ...
Shell
#!/bin/sh # Copyright 2009 by Denys Vlasenko <vda.linux@googlemail.com> # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "test name" "command" "expected result" "file input" "stdin" # file input will be file called "input" # test can create a file "actual" instead of writing...
Shell
#!/bin/sh # Copyright 2008 by Denys Vlasenko <vda.linux@googlemail.com> # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh COLLAPSE=$(( 0x00010000)) TRIM=$(( 0x00020000)) GREEDY=$(( 0x00040000)) MIN_DIE=$(( 0x00100000)) KEEP_COPY=$((0x00200000)) ESCAPE=$(( 0x00400000)) NORMAL=$(( ...
Shell
#!/bin/sh # Copyright 2010 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh test -f "$bindir/.config" && . "$bindir/.config" rm -rf ls.testdir 2>/dev/null mkdir ls.testdir || exit 1 # testing "test name" "command" "expected result" "file input" "stdin" # With Unicode pr...
Shell
#!/bin/sh # Copyright 2008 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "test name" "command(s)" "expected result" "file input" "stdin" testing "patch with old_file == new_file" \ 'patch 2>&1; echo $?; cat input' \ "\ patching file input 0 qwe asd zxc " \ ...
Shell
#!/bin/sh # Copyright 2009 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh unset LANG unset LANGUAGE unset LC_COLLATE unset LC_ALL umask 022 rm -rf tar.tempdir 2>/dev/null mkdir tar.tempdir && cd tar.tempdir || exit 1 # testing "test name" "script" "expected result" "f...
Shell
#!/bin/sh # pidof tests. # Copyright 2005 by Bernhard Reutner-Fischer # Licensed under GPLv2, see file LICENSE in this source tree. # AUDIT: . ./testing.sh # testing "test name" "options" "expected result" "file input" "stdin" testing "pidof (exit with error)" \ "pidof veryunlikelyoccuringbinaryname ; echo \$?" "...
Shell
#!/bin/sh # SUSv3 compliant uniq tests. # Copyright 2005 by Rob Landley <rob@landley.net> # Licensed under GPLv2, see file LICENSE in this source tree. # AUDIT: Full SUSv3 coverage (except internationalization). . ./testing.sh # testing "test name" "options" "expected result" "file input" "stdin" # file input wil...
Shell
#!/bin/sh # Readlink tests. # Copyright 2006 by Natanael Copa <n@tanael.org> # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh TESTDIR=readlink_testdir TESTFILE="$TESTDIR/testfile" TESTLINK="testlink" FAILLINK="$TESTDIR/$TESTDIR/testlink" # create the dir and test files mkdir -p "./$TESTD...
Shell
#!/bin/sh # Copyright 2008 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # ls -ln is showing date. Need to remove that, it's variable # sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces # cut: remove date FILTER_LS="grep -v '^total ' | sed -e 's/, */,/g' -e 's/ */...
Shell
#!/bin/sh # Copyright 2010 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh test -f "$bindir/.config" && . "$bindir/.config" # testing "test name" "command" "expected result" "file input" "stdin" testing "cal 2000" "cal 1 2000" "\ January 2000 Su Mo Tu We Th Fr Sa ...
Shell
#!/bin/sh # SUSv3 compliant mount and umount tests. # Copyright 2005 by Rob Landley <rob@landley.net> # Licensed under GPLv2, see file LICENSE in this source tree. if [ -z "$TESTDIR" ] then echo 'Need $TESTDIR' exit 1 fi cd "$TESTDIR" . testing.sh # If we aren't PID 1, barf. #if [ $$ -ne 1 ] #then # echo "SK...
Shell
#!/bin/sh # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com> # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "test name" "options" "expected result" "file input" "stdin" # file input will be file called "input" # test can create a file "actual" instead of writing...
Shell
#!/bin/sh # Copyright 2008 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "test name" "commands" "expected result" "file input" "stdin" optional DESKTOP testing "od -b" \ "od -b" \ "\ 0000000 110 105 114 114 117 0000005 " \ "" "HELLO" SKIP= optional DESKTO...
Shell
#!/bin/sh # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com> # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "test name" "command" "expected result" "file input" "stdin" # file input will be file called "input" # test can create a file "actual" instead of writing...
Shell
#!/bin/sh # Copyright 2008 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh test -f "$bindir/.config" && . "$bindir/.config" # testing "test name" "options" "expected result" "file input" "stdin" testing "unexpand case 1" "unexpand" \ "\t12345678\n" "" " 12345678...
Shell
#!/bin/sh # Copyright 2008 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "test name" "commands" "expected result" "file input" "stdin" # diff outputs date/time in the header, which should not be analysed # NB: sed has tab character in s command! TRIM_TAB="se...
Shell
#!/bin/sh # Copyright 2010 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # Opening quote in "omitting directory 'dir'" message: sq='`' # GNU cp: ` sq="'" # bbox cp: ' rm -rf cp.testdir >/dev/null mkdir cp.testdir mkdir cp.testdir/dir > cp.testdir/dir/file ln -s fil...
Shell
#!/bin/sh # Tests for unzip. # Copyright 2006 Rob Landley <rob@landley.net> # Copyright 2006 Glenn McGrath # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "test name" "options" "expected result" "file input" "stdin" # file input will be file called "input" # test can create...
Shell
#!/bin/sh # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com> # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "description" "command" "result" "infile" "stdin" testing "awk -F case 0" "awk -F '[#]' '{ print NF }'" "" "" "" testing "awk -F case 1" "awk -F '[#]' '{ ...
Shell
#!/bin/sh . ./bunzip2.tests
Shell
# Simple test harness infrastructure for BusyBox # # Copyright 2005 by Rob Landley # # License is GPLv2, see LICENSE in the busybox tarball for full license text. # This file defines two functions, "testing" and "optional" # and a couple more... # The following environment variables may be set to enable optional beha...
Shell
#!/bin/sh # Copyright 2009 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh test -f "$bindir/.config" && . "$bindir/.config" # testing "test name" "options" "expected result" "file input" "stdin" testing "fold -s" "fold -w 7 -s" \ "123456\n\t\nasdf" \ "" ...
Shell
#!/bin/sh # Depmod output may be hard to diff. # This script sorts dependencies within "xx.ko: yy.ko zz.ko" lines, # and sorts all lines too. # Usage: # # [./busybox] depmod -n | ./depmod_process.sh | sort >OUTFILE # # and then you can diff OUTFILEs. Useful for comparing bbox depmod # with module-init-tools depmod and...
Shell
#!/bin/sh target="$1" loc="$2" test "$target" || exit 1 test "$loc" || loc=. test -x "$loc/usage" || exit 1 test "$SED" || SED=sed test "$DD" || DD=dd # Some people were bitten by their system lacking a (proper) od od -v -t x1 </dev/null >/dev/null if test $? != 0; then echo 'od tool is not installed or cannot acce...
Shell
#!/bin/sh # Make busybox links list file. # input $1: full path to Config.h # input $2: full path to applets.h # output (stdout): list of pathnames that should be linked to busybox # Maintainer: Larry Doolittle <ldoolitt@recycle.lbl.gov> export LC_ALL=POSIX export LC_CTYPE=POSIX CONFIG_H=${1:-include/autoconf.h} AP...
Shell
#!/bin/sh export LC_ALL=POSIX export LC_CTYPE=POSIX prefix=$1 if [ -z "$prefix" ]; then echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks/--scriptwrapper]" exit 1 fi h=`sort busybox.links | uniq` linkopts="" scriptwrapper="n" cleanup="0" noclobber="0" case "$2" in --hardlinks) linkopts="-f"...
Shell
#!/bin/sh # TODO: use getopt to avoid parsing options as filenames, # and to support -- and --help for i in "$@" do sed -e '1!G;h;$!d' "$i" done
Shell
#!/bin/sh cat /etc/nologin.txt 2>/dev/null || echo "This account is not available" sleep 5 exit 1
Shell
#!/bin/sh # TODO: use getopt to avoid parsing options as filenames, # and to support -- and --help [ $# -ne 0 ] && DASH_I=-i sed $DASH_I -e 's/\r$//' "$@"
Shell
#!/bin/sh # TODO: use getopt to avoid parsing options as filenames, # and to support -- and --help [ $# -ne 0 ] && DASH_I=-i sed $DASH_I -e 's/$/\r/' "$@"
Shell
#!/bin/sh # Leak test for gunzip. Watch top for growing process size. # In this case we look for leaks in "concatenated .gz" code - # we feed gunzip with a stream of .gz files. i=$PID c=0 while true; do c=$((c + 1)) echo "Block# $c" >&2 # RANDOM is not very random on some shells. Spice it up. i=$((i * ...
Shell
#!/bin/sh # Test that concatenated gz files are unpacking correctly. # It also tests that unpacking in general is working right. # Since zip code has many corner cases, run it for a few hours # to get a decent coverage (200000 tests or more). gzip="gzip" gunzip="../busybox gunzip" # Or the other way around: #gzip="../...
Shell
#!/bin/sh # Leak test for gunzip. Watch top for growing process size. # Just using urandom will make gzip use method 0 (store) - # not good for test coverage! cat /dev/urandom \ | while true; do read junk; echo "junk $RANDOM $junk"; done \ | ../busybox gzip \ | ../busybox gunzip -c >/dev/null
Shell
if [ -z "$ANDROID_NDK_R3" ] ; then echo '$ANDROID_NDK_R3' must point to an android-ndk-r3 installation echo 'Get it at: http://dl.google.com/android/ndk/android-ndk-r3-linux-x86.zip' exit -1 fi cd vanilla make mrproper cd .. egrep -v 'CONFIG_CROSS_COMPILER_PREFIX|CONFIG_SYSROOT|CONFIG_EXTRA_CFLAGS' config > vanil...
Shell
#!/bin/sh ### BEGIN INIT INFO # Provides: openvpn # Required-Start: $network # Required-Stop: $network # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: This shell script takes care of starting and stopping OpenVP...
Shell
#!/bin/bash #################################### # Tear Down Ethernet bridge on Linux #################################### # Define Bridge Interface br="br0" # Define list of TAP interfaces to be bridged together tap="tap0" ifconfig $br down brctl delbr $br for t in $tap; do openvpn --rmtun --dev $t done
Shell
#!/bin/sh # # openvpn This shell script takes care of starting and stopping # openvpn on RedHat or other chkconfig-based system. # # chkconfig: 345 24 76 # # description: OpenVPN is a robust and highly flexible tunneling application that # uses all of the encryption, authentication, and...
Shell
#!/bin/bash ################################# # Set up Ethernet bridge on Linux # Requires: bridge-utils ################################# # Define Bridge Interface br="br0" # Define list of TAP interfaces to be bridged, # for example tap="tap0 tap1 tap2". tap="tap0" # Define physical ethernet interface to be bridg...
Shell
#!/bin/bash ################################# # Set up Ethernet bridge on Linux # Requires: bridge-utils ################################# # Define Bridge Interface br="br0" # Define list of TAP interfaces to be bridged, # for example tap="tap0 tap1 tap2". tap="tap7" # Define physical ethernet interface to be bridg...
Shell
#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2007-03-29.01 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software # Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public ...
Shell
#!/bin/sh # This is the master OpenVPN build script for Windows. # This script will build OpenVPN, the TAP driver, and # the installer from source, targeting x86 on Windows # 2000 and higher, and x64 on Windows 2003 and higher. # For quick start options, see pre-built notes below. # # Note that if you are only looking...
Shell
#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2006-05-10.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redi...
Shell
#!/bin/sh route add -net 10.0.0.0 netmask 255.255.255.0 gw $5
Shell
#!/bin/sh # stop all openvpn processes killall -TERM openvpn
Shell
#!/bin/bash # A Sample OpenVPN-aware firewall. # eth0 is connected to the internet. # eth1 is connected to a private subnet. # Change this subnet to correspond to your private # ethernet subnet. Home will use HOME_NET/24 and # Office will use OFFICE_NET/24. PRIVATE=10.0.0.0/24 # Loopback address LOOP=127.0.0.1 # ...
Shell
#!/bin/sh # A sample OpenVPN startup script # for Linux. # openvpn config file directory dir=/etc/openvpn # load the firewall $dir/firewall.sh # load TUN/TAP kernel module modprobe tun # enable IP forwarding echo 1 > /proc/sys/net/ipv4/ip_forward # Invoke openvpn for each VPN tunnel # in daemon mode. Alternative...
Shell
#!/bin/sh route add -net 10.0.1.0 netmask 255.255.255.0 gw $5
Shell
#! /bin/sh # # t_lpback.sh - script to test OpenVPN's crypto loopback # Copyright (C) 2005 Matthias Andree # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, o...
Shell
#!/bin/sh # install - install a program, script, or datafile scriptversion=2006-12-25.00 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby ...
Shell
#!/bin/sh # # Bring up vpn routing. # calculate the network address remote_network=`ipcalc -n "$remote"/"$remote_netmask_bits"` remote_network="${remote_network#*=}" # add the stuff that doesn't change if it's not already there grep -q '^202 ' /etc/iproute2/rt_tables if [ "$?" -ne 0 ] then echo 202 vpn.out >> /e...
Shell
#!/bin/sh # # Bring down vpn routing. # calculate the network address remote_network=`ipcalc -n "$remote"/"$remote_netmask_bits"` remote_network="${remote_network#*=}" # clear routing via VPN ip route del "$remote_network"/"$remote_netmask_bits" via "$5" table vpn.out ip route del table vpnonly.out via "$5" iptabl...
Shell
#!/bin/bash # Copyright (c) 2005-2009 OpenVPN Technologies, Inc. # Licensed under the GPL version 2 # First version by Jesse Adelman # someone at boldandbusted dink com # http://www.boldandbusted.com/ # PURPOSE: This script automatically sets the proper /etc/resolv.conf entries # as pulled down from an OpenVPN serve...
Shell
#!/bin/bash # Copyright (c) 2005-2009 OpenVPN Technologies, Inc. # Licensed under the GPL version 2 # First version by Jesse Adelman # someone at boldandbusted dink com # http://www.boldandbusted.com/ # PURPOSE: This script automatically removes the /etc/resolv.conf entries previously # set by the companion script "...
Shell
#!/bin/sh # # Build a root certificate # if test $KEY_DIR; then cd $KEY_DIR && \ openssl req -days 3650 -nodes -new -x509 -keyout ca.key -out ca.crt -config $KEY_CONFIG && \ chmod 0600 ca.key else echo you must define KEY_DIR fi
Shell
#!/bin/sh # # Make a certificate/private key pair using a locally generated # root certificate. # # Explicitly set nsCertType to server using the "server" # extension in the openssl.cnf file. if test $# -ne 1; then echo "usage: build-key-server <name>"; exit 1 fi ...
Shell
#!/bin/sh # # Sign a certificate signing request (a .csr file) # with a local root certificate and key. # if test $# -ne 1; then echo "usage: sign-req <name>"; exit 1 fi if test $KEY_DIR; then cd $KEY_DIR && \ openssl ca -...
Shell
#!/bin/sh # # Make a certificate/private key pair using a locally generated # root certificate and convert it to a PKCS #12 file including the # the CA certificate as well. if test $# -ne 1; then echo "usage: build-key-pkcs12 <name>"; exit 1 fi ...
Shell
#!/bin/sh # # revoke a certificate # # if test $# -ne 1; then echo "usage: revoke-crt <file.crt>"; exit 1 fi if test $KEY_DIR; then cd $KEY_DIR && \ openssl ca -revoke $1 -config $KEY_CONFIG else echo you must define KEY_DIR fi
Shell
#!/bin/sh # # Make an intermediate CA certificate/private key pair using a locally generated # root certificate. # if test $# -ne 1; then echo "usage: build-inter <name>"; exit 1 fi if test $KEY_DIR; then cd $KEY_DIR && \ ...
Shell
#!/bin/sh # # Similar to build-key, but protect the private key # with a password. # if test $# -ne 1; then echo "usage: build-key-pass <name>"; exit 1 fi if test $KEY_DIR; then cd $KEY_DIR && \ openssl req -days 3650 -new -keyout $1.key -out $1.csr -config $KEY_CONFIG && \ openssl ca -days 3650 -...
Shell
#!/bin/sh # # generate a CRL # # if test $# -ne 1; then echo "usage: make-crl <crlfile.pem>"; exit 1 fi if test $KEY_DIR; then cd $KEY_DIR && \ openssl ca -gencrl -out $1 -config $KEY_CONFIG else echo you must define KEY_DIR fi
Shell
#!/bin/sh # # Build Diffie-Hellman parameters for the server side # of an SSL/TLS connection. # if test $KEY_DIR; then openssl dhparam -out ${KEY_DIR}/dh${KEY_SIZE}.pem ${KEY_SIZE} else echo you must define KEY_DIR fi
Shell
#!/bin/sh # revoke a certificate, regenerate CRL, # and verify revocation CRL=crl.pem RT=revoke-test.pem if test $# -ne 1; then echo "usage: revoke-full <name>"; exit 1 fi if test $KEY_DIR; then cd $KEY_DIR rm -f $RT # revoke key and generate a new CRL openssl ca -revoke...
Shell
#!/bin/sh # # Initialize the $KEY_DIR directory. # Note that this script does a # rm -rf on $KEY_DIR so be careful! # d=$KEY_DIR if test $d; then rm -rf $d mkdir $d && \ chmod go-rwx $d && \ touch $d/index.txt && \ echo 01 >$d/serial else echo you must define KEY_DIR fi
Shell
#!/bin/sh # # list revoked certificates # # if test $# -ne 1; then echo "usage: list-crl <crlfile.pem>"; exit 1 fi if test $KEY_DIR; then cd $KEY_DIR && \ openssl crl -text -noout -in $1 else echo you must define KEY_DIR fi
Shell
#!/bin/sh # # Build a certificate signing request and private key. Use this # when your root certificate and key is not available locally. # if test $# -ne 1; then echo "usage: build-req <name>"; exit 1 fi if test $KEY_DIR; then ...
Shell
#!/bin/sh # # Make a certificate/private key pair using a locally generated # root certificate. # if test $# -ne 1; then echo "usage: build-key <name>"; exit 1 fi if test $KEY_DIR; then cd $KEY_DIR && \ openssl req -days 3...
Shell
#!/bin/sh # # Like build-req, but protect your private key # with a password. # if test $# -ne 1; then echo "usage: build-req-pass <name>"; exit 1 fi if test $KEY_DIR; then cd $KEY_DIR && \ openssl req -days 3650 -new -keyou...
Shell
#!/bin/bash # # Build a root certificate # export EASY_RSA="${EASY_RSA:-.}" "$EASY_RSA/pkitool" --interact --initca $*
Shell
#!/bin/bash # Make a certificate/private key pair using a locally generated # root certificate. # # Explicitly set nsCertType to server using the "server" # extension in the openssl.cnf file. export EASY_RSA="${EASY_RSA:-.}" "$EASY_RSA/pkitool" --interact --server $*
Shell
#!/bin/bash # Sign a certificate signing request (a .csr file) # with a local root certificate and key. export EASY_RSA="${EASY_RSA:-.}" "$EASY_RSA/pkitool" --interact --sign $*
Shell
#!/bin/bash # Make a certificate/private key pair using a locally generated # root certificate and convert it to a PKCS #12 file including the # the CA certificate as well. export EASY_RSA="${EASY_RSA:-.}" "$EASY_RSA/pkitool" --interact --pkcs12 $*
Shell
#!/bin/bash # Make an intermediate CA certificate/private key pair using a locally generated # root certificate. export EASY_RSA="${EASY_RSA:-.}" "$EASY_RSA/pkitool" --interact --inter $*
Shell
#!/bin/bash # Similar to build-key, but protect the private key # with a password. export EASY_RSA="${EASY_RSA:-.}" "$EASY_RSA/pkitool" --interact --pass $*
Shell
#!/bin/sh if [ "$OPENSSL" ]; then if $OPENSSL version | grep 0.9.6 > /dev/null; then echo "$1/openssl-0.9.6.cnf" else echo "$1/openssl.cnf" fi else echo "$1/openssl.cnf" fi exit 0
Shell
#!/bin/bash # Build Diffie-Hellman parameters for the server side # of an SSL/TLS connection. if [ -d $KEY_DIR ] && [ $KEY_SIZE ]; then $OPENSSL dhparam -out ${KEY_DIR}/dh${KEY_SIZE}.pem ${KEY_SIZE} else echo 'Please source the vars script first (i.e. "source ./vars")' echo 'Make sure you have edited it t...
Shell
#!/bin/bash # revoke a certificate, regenerate CRL, # and verify revocation CRL="crl.pem" RT="revoke-test.pem" if [ $# -ne 1 ]; then echo "usage: revoke-full <cert-name-base>"; exit 1 fi if [ "$KEY_DIR" ]; then cd "$KEY_DIR" rm -f "$RT" # set defaults export KEY_CN="" export KEY_OU="" ...
Shell
#!/bin/bash # Initialize the $KEY_DIR directory. # Note that this script does a # rm -rf on $KEY_DIR so be careful! if [ "$KEY_DIR" ]; then rm -rf "$KEY_DIR" mkdir "$KEY_DIR" && \ chmod go-rwx "$KEY_DIR" && \ touch "$KEY_DIR/index.txt" && \ echo 01 >"$KEY_DIR/serial" else echo 'Please source the vars s...
Shell
#!/bin/bash # Build a new PKI which is rooted on an intermediate certificate generated # by ./build-inter or ./pkitool --inter from a parent PKI. The new PKI should # have independent vars settings, and must use a different KEY_DIR directory # from the parent. This tool can be used to generate arbitrary depth # cert...
Shell
#!/bin/bash # list revoked certificates CRL="${1:-crl.pem}" if [ "$KEY_DIR" ]; then cd "$KEY_DIR" && \ $OPENSSL crl -text -noout -in "$CRL" else echo 'Please source the vars script first (i.e. "source ./vars")' echo 'Make sure you have edited it to reflect your configuration.' fi
Shell
#!/bin/bash # Build a certificate signing request and private key. Use this # when your root certificate and key is not available locally. export EASY_RSA="${EASY_RSA:-.}" "$EASY_RSA/pkitool" --interact --csr $*
Shell