]> sourceware.org Git - systemtap.git/blame - stap-authorize-cert
Add user_{int8,int16,uint16,int32,uint32,int64}.
[systemtap.git] / stap-authorize-cert
CommitLineData
46a8c85f
DB
1#!/bin/bash
2
98f552c2 3# Add an existing server certificate to a
46a8c85f
DB
4# database of trusted servers for the client.
5#
64aa100f 6# Copyright (C) 2008, 2009 Red Hat Inc.
46a8c85f
DB
7#
8# This file is part of systemtap, and is free software. You can
9# redistribute it and/or modify it under the terms of the GNU General
10# Public License (GPL); either version 2, or (at your option) any
11# later version.
12
98f552c2
DB
13certfile=$1
14certdb=$2
15
46a8c85f 16# Obtain the filename of the certificate
98f552c2 17if test "X$certfile" = "X"; then
46a8c85f
DB
18 echo "Certificate file must be specified" >&2
19 exit 1
20fi
98f552c2
DB
21if ! test -f $certfile; then
22 echo "Cannot find certificate file $certfile" >&2
46a8c85f
DB
23 exit 1
24fi
25
26# Obtain the certificate database directory name.
98f552c2 27if test "X$certdb" = "X"; then
46a8c85f
DB
28 echo "Certificate database directory must be specified" >&2
29 exit 1
30fi
98f552c2
DB
31if ! test -d $certdb; then
32 if ! mkdir -p -m 755 $certdb; then
33 echo "Unable to find or create the client certificate database directory: $certdb" >&2
64aa100f
DB
34 exit 1
35 fi
46a8c85f
DB
36fi
37
64aa100f 38# Add the certificate
98f552c2
DB
39if ! certutil -A -n stap-server -d $certdb -i $certfile -t "P,P,P" > /dev/null; then
40 echo "Unable to add $certfile to the client certificate database $certdb" >&2
46a8c85f
DB
41 exit 1
42fi
43
64aa100f 44# Ensure that the database is readable by others
98f552c2
DB
45if ! chmod +r $certdb/*.db; then
46 echo "Warning: unable to make the client certificate database $certdb readable by others" >&2
64aa100f 47fi
64aa100f 48
2ba4c606
DB
49echo "Certificate $certfile added to database $certdb"
50
46a8c85f 51exit 0
This page took 0.051888 seconds and 5 git commands to generate.