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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#! /bin/bash
# Usage: $iron ssh-user <username> <hostname> <accounts_list>
# Summary: create ssh CAs for hosts and users
# Help: This command groups commands used to setup config create an ssh CA
APPNAME="iron"
CURRDIR=$(pwd)
RCDIR=$HOME/.$APPNAME/ssh
test -d $RCDIR || mkdir -p $RCDIR
CURRENT_TSTAMP=$(date '+%Y%m%d%H%M')
if [ "$#" = 3 ];then
username=$1
hostname=$2
accounts_list=$3
#hostname_dir=$RCDIR/hosts/${hostname}
#test -d ${hostname_dir} || mkdir -p ${hostname_dir}
user_dir=$RCDIR/users/${username}
test -d ${user_dir} || mkdir -p ${user_dir}
email="${username}@${hostname}"
keyname="${username}"
keyname_public="${username}.pub"
user_ca="${username}-user-ca"
ssh-keygen -f ${user_dir}/${keyname} -b 4096 -t rsa
ssh-keygen -s ${user_dir}/$user_ca -I ${email} -n "${accounts_list}" -V +1d ${user_dir}/${keyname_public}
exit 0
echo "Usage: iron ssh-user <username> <hostname> <accounts_list>"
exit -1
fi
echo "Usage: iron ssh-user <username> <hostname> <accounts_list>"
exit -1
# This file is part of Iron
# Copyright (c) 2016-2024 Paolo Lulli.
#
# 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, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|