#! /bin/bash # Usage: $iron ssh-user # 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 " exit -1 fi echo "Usage: iron ssh-user " 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 .