Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (44 sloc) 2.02 KB
#-------------------------------------------------------------------------------
# conf: makefile.credentials
#
# Credential make file recipes.
#-------------------------------------------------------------------------------
# Copyright (C) 2016 Brian Minard
#
# 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.
#
# 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#-------------------------------------------------------------------------------
WHOAMI=$(shell whoami)
GROUP=$(shell groups $(whoami) | cut -d' ' -f1)
CREDENTIALS_DIR=credentials
${CREDENTIALS_DIR}:
mkdir -pm u+rwx,og-rwx $@ && chown ${WHOAMI}:${GROUP} $@
ROOT_PASSWORD?=${CREDENTIALS_DIR}/root_password
${ROOT_PASSWORD}: | ${CREDENTIALS_DIR}
openssl rand -hex 13 > $@ && chmod u+rw-x,og-rwx $@
VAGRANT_PRIVATE_KEY?=${CREDENTIALS_DIR}/vagrant_ssh_key
VAGRANT_PUBLIC_KEY?=${VAGRANT_PRIVATE_KEY}.pub
${VAGRANT_PRIVATE_KEY} ${VAGRANT_PUBLIC_KEY}: | ${CREDENTIALS_DIR}
ssh-keygen -C vagrant@`hostname` -N '' -f ${VAGRANT_PRIVATE_KEY}
# Remove all files (including Packer caches).
.PHONY: credentials-realclean
credentials-realclean: credentials-clean
# Remove files that take a long time to create (including Vagrant boxes,
# Vagrant box prerequisites and user credentials).
.PHONY: credentials-clean
credentials-clean: credentials-mostlyclean
-rm -fr ${CREDENTIALS_DIR}
# Remove files that are created quickly.
.PHONY: credentials-mostlyclean
credentials-mostlyclean: