File: make-cadir

package info (click to toggle)
easy-rsa 2.2.2-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 276 kB
  • ctags: 7
  • sloc: sh: 758; makefile: 2
file content (30 lines) | stat: -rwxr-xr-x 842 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

# This script creates a new directory in order to be used
# with the tools from the easy-rsa project.
#
# Copyright (C) 2012 Alberto Gonzalez Iniesta
#
# 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, or
# (at your option) any later version.

set -e

usage() {
	echo "Usage: $0 DIRECTORY"
	echo "Creates a *new* directory and prepares it to be used as a (CA) key management directory (to create and store keys and certificates)."
	exit 1
}

[ "$#" -ne 1 ] && usage
[ -e "$1" ] && { echo "$1 exists. Aborting." ; usage ; }

mkdir -p "$1"
chmod 700 "$1"
ln -s /usr/share/easy-rsa/* "$1"
rm -f "$1"/vars "$1"/*.cnf
cp /usr/share/easy-rsa/vars /usr/share/easy-rsa/*.cnf "$1"