diff options
author | Bifferos <bifferos@gmail.com> | 2020-03-01 09:13:38 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-03-01 09:13:38 +0700 |
commit | 65ec57fe5820449810f623d93af9468b47300a34 (patch) | |
tree | 2124f91884b088a23b414d48e310fec680734de7 /system | |
parent | 2ae53c489998e61fcab07ed014c51cb8eaaaf96d (diff) | |
download | slackbuilds-65ec57fe5820449810f623d93af9468b47300a34.tar.gz |
system/vagrant-public-key: Added (Vagrant Public Key).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system')
-rw-r--r-- | system/vagrant-public-key/README | 11 | ||||
-rw-r--r-- | system/vagrant-public-key/slack-desc | 19 | ||||
-rw-r--r-- | system/vagrant-public-key/vagrant-basebox | 48 | ||||
-rw-r--r-- | system/vagrant-public-key/vagrant-public-key.SlackBuild | 60 | ||||
-rw-r--r-- | system/vagrant-public-key/vagrant-public-key.info | 10 |
5 files changed, 148 insertions, 0 deletions
diff --git a/system/vagrant-public-key/README b/system/vagrant-public-key/README new file mode 100644 index 0000000000..f3e7692d57 --- /dev/null +++ b/system/vagrant-public-key/README @@ -0,0 +1,11 @@ +Vagrant Public Key + +Preparing a Vagrant virtual machine to be used as a base box +requires the installation of a ssh public key. This package provides +the key and a script called vagrant-basebox to both install the key +and perform some setup of the system. + +THIS PACKAGE WILL MAKE THE MACHINE IT'S INSTALLED ON INSECURE, USE ONLY +WHEN CREATING A VAGRANT BASE BOX FOR SHARING ON VAGRANT CLOUD. + +See: https://www.vagrantup.com/docs/boxes/base.html for further info. diff --git a/system/vagrant-public-key/slack-desc b/system/vagrant-public-key/slack-desc new file mode 100644 index 0000000000..919659c723 --- /dev/null +++ b/system/vagrant-public-key/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +vagrant-public-key: vagrant-public-key (Vagrant Public Key) +vagrant-public-key: +vagrant-public-key: Preparing a Vagrant virtual machine to be used as a base box +vagrant-public-key: requires the installation of an ssh public key. This package provides +vagrant-public-key: the key and a script called vagrant-basebox to both install it and +vagrant-public-key: setup the system. +vagrant-public-key: +vagrant-public-key: ONLY FOR USE ON VIRTUAL MACHINES YOU INTEND TO SHARE, DO NOT INSTALL +vagrant-public-key: ON A PRODUCTION SYSTEM AS THIS WILL MAKE IT INSECURE. +vagrant-public-key: +vagrant-public-key: See: https://www.vagrantup.com/docs/boxes/base.html for further info. diff --git a/system/vagrant-public-key/vagrant-basebox b/system/vagrant-public-key/vagrant-basebox new file mode 100644 index 0000000000..4211766c38 --- /dev/null +++ b/system/vagrant-public-key/vagrant-basebox @@ -0,0 +1,48 @@ +#!/bin/sh -e + +# vagrant base box preparation script. + + +# Some safeguards +if grep -q "^avagrant:" /etc/passwd ; then + echo "vagrant user has already been created." + exit +fi + +if test -f /root/.ssh/authorized_keys; then + echo "root already has /root/.ssh/authorized_keys, refusing to overwrite it." + exit +fi + + +# Create vagrant user and give them the key. +echo "Creating user vagrant" +useradd -m vagrant +mkdir -p /home/vagrant/.ssh +echo "Adding Vagrant authorized key for user vagrant" +cp /etc/vagrant/vagrant.pub /home/vagrant/.ssh/authorized_keys +chown -R vagrant:users /home/vagrant +chmod 0700 /home/vagrant/.ssh +chmod 0600 /home/vagrant/.ssh/authorized_keys + + +# Add the key to root as well. +echo "Adding vagrant authorized key for user root" +mkdir -p /root/.ssh +cp /etc/vagrant/vagrant.pub /root/.ssh/authorized_keys +chmod 0700 /root/.ssh +chmod 0600 /root/.ssh/authorized_keys + + +echo "Adding vagrant to /etc/sudoers" +echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +echo "Adding 'UseDNS no' to /etc/ssh/sshd_config" +echo "UseDNS no" >> /etc/ssh/sshd_config +echo "PermitRootLogin yes" >> /etc/ssh/sshd_config + + +echo +echo "THIS SYSTEM IS NOW INSECURE, AND ACCESSIBLE TO ANYONE WITH THE VAGRANT PRIVATE KEY" +echo "FROM https://github.com/hashicorp/vagrant/blob/master/keys/vagrant" + + diff --git a/system/vagrant-public-key/vagrant-public-key.SlackBuild b/system/vagrant-public-key/vagrant-public-key.SlackBuild new file mode 100644 index 0000000000..88d40182ad --- /dev/null +++ b/system/vagrant-public-key/vagrant-public-key.SlackBuild @@ -0,0 +1,60 @@ +#!/bin/sh + +# Slackware build script to package the Vagrant insecure public key. + +# Copyright 2020 bifferos@gmail.com UK +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=vagrant-public-key +VERSION=${VERSION:-1.0.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +ARCH=noarch + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +mkdir -p $PRGNAM-$VERSION +cd $PRGNAM-$VERSION + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a $CWD/README $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +mkdir -p $PKG/usr/sbin +cp $CWD/vagrant-basebox $PKG/usr/sbin/vagrant-basebox +chmod 744 $PKG/usr/sbin/vagrant-basebox + +mkdir -p $PKG/etc/vagrant +cp $CWD/vagrant.pub $PKG/etc/vagrant +chmod 644 $PKG/etc/vagrant + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/vagrant-public-key/vagrant-public-key.info b/system/vagrant-public-key/vagrant-public-key.info new file mode 100644 index 0000000000..cad8b26950 --- /dev/null +++ b/system/vagrant-public-key/vagrant-public-key.info @@ -0,0 +1,10 @@ +PRGNAM="vagrant-public-key" +VERSION="1.0.0" +HOMEPAGE="https://www.vagrantup.com/docs/boxes/base.html" +DOWNLOAD="https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub" +MD5SUM="b440b5086dd12c3fd8abb762476b9f40" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Bifferos" +EMAIL="bifferos@gmail.com" |