#!/bin/bash # Atomic Secured Linux # Copyright Atomicorp, 2016 # License: Commercial # Summary: AUM Instller # Name: aum # License: Commercial. Unauthorized redistribution prohibited. INSTALLER_VER=1.1 export LANG=C SERVER=www.atomicorp.com ARCH=`uname -i` GET=/usr/bin/wget ROOT_UID="0" LOG=/tmp/tortix-install.log DATE=$(date +%Y%m%d-%H:%M) #Check if run as root # For environments that do not use bash. if [ ! "$UID" ]; then UID=`id -u` fi if [ "$UID" -ne "$ROOT_UID" ] ; then echo "ERROR: You must be root to run this program." exit 1 fi AUTO=1 if [ -f asl.cfg ]; then AUTO=1 . ./asl.cfg fi # Logging echo "Tortix install begin: $DATE" >> $LOG if [ ! $SSH_TTY ]; then INSTALL_TTY="/dev/$(ps -p$$ --no-heading | awk '{print $2}')" else INSTALL_TTY=$SSH_TTY fi echo "Environment" >> $LOG env >>$LOG # Check input function # 3 vars, the message to prompt, valid responses, and default response # Example: check_input "Some question (yes/no) " "yes|no" "yes" check_input () { message=$1 validate=$2 default=$3 while [ $? -ne 1 ]; do echo -n "$message " read INPUTTEXT < $INSTALL_TTY if [ "$INPUTTEXT" = "" -a "$default" != "" ]; then INPUTTEXT=$default return 1 fi echo $INPUTTEXT | egrep -q "$validate" && return 1 echo "Invalid input" done } clear echo echo "Atomic Updater Modified (AUM) Installer (v$INSTALLER_VER)" echo "Further Documentation is available at: " echo "http://www.atomicorp.com/wiki/index.php/Aum" echo echo "Support: support@atomicorp.com" if [ ! $AUTO ]; then echo echo "Hit any key to view the License agreement, or Ctrl-C to exit" echo read break < $INSTALL_TTY cat << EOF | less -e -M -Ps"Press any key to view the next page" ATOMICORP MASTER END USER LICENSE AGREEMENT NOTICE: BY DOWNLOADING AND INSTALLING, COPYING OR OTHERWISE USING THE SOFTWARE, YOU AGREE TO BE BOUND BY THE TERMS OF THIS EULA. IF YOU DO NOT AGREE TO THE TERMS OF THIS EULA, YOU MAY NOT DOWNLOAD, INSTALL, COPY OR USE THE SOFTWARE, AND YOU MAY RETURN THE UNUSED SOFTWARE TO THE VENDOR FROM WHICH YOU ACQUIRED IT WITHIN THIRTY (30) DAYS AND REQUEST A REFUND OF THE LICENSE FEE, IF ANY, ALREADY PAID UPON SHOWING PROOF OF PAYMENT. "YOU" MEANS THE NATURAL PERSON OR THE ENTITY THAT IS AGREEING TO BE BOUND BY THIS EULA, THEIR EMPLOYEES AND THIRD PARTY CONTRACTORS THAT PROVIDE SERVICES TO YOU. YOU SHALL BE LIABLE FOR ANY FAILURE BY SUCH EMPLOYEES AND THIRD PARTY CONTRACTORS TO COMPLY WITH THE TERMS OF THIS AGREEMENT. 1.0 GRANT AND USE RIGHTS FOR SOFTWARE. 1.1 License. The Software is licensed, not sold. Subject to the terms of this EULA, Atomicorp hereby grants you a non-exclusive, non-transferable license, without rights to sublicense, to use the object code of the Software for the purpose as set forth in the applicable documentation for the Software and to the extent permitted by your payment of applicable license fees under an Atomicorp approved licensing model and/or your Software License Key subject to the software product specific terms specified in this EULA. Depending upon the model utilized to compute the applicable license fees paid by you to use the Software (whether per physical server, per Virtual server, per user, or any other Atomicorp approved licensing model), an applicable Software License subscription may limit your usage of the Software accordingly. You may use the documentation accompanying the Software in connection with permitted uses of the Software. 1.2 License Limitations. You may not copy the Software except for a reasonable number of machine-readable copies of the Software for backup or archival purposes and except as expressly permitted in this EULA. You may not remove any titles, trademarks or trade names, copyright notices, legends, or other proprietary markings on the Software. You are not granted any rights to any trademarks or service marks of Atomicorp. Atomicorp retains all rights not expressly granted to you. 1.3 Restrictions. You may not (i) sell, lease, license, sublicense, distribute or otherwise transfer in whole or in part the Software or the Software License subscription to another party; (ii) provide, disclose, divulge or make available to, or permit use of the Software in whole or in part by, any third party (except Designated Administrative Access) without Atomicorp's prior written consent; or (iii) modify or create derivative works based upon the Software. Except to the extent expressly permitted by applicable law, and to the extent that Atomicorp is not permitted by that applicable law to exclude or limit the following rights, you may not decompile, disassemble, reverse engineer, or otherwise attempt to derive source code from the Software, in whole or in part. You may not use Software to create products, technologies, software applications, web services in whole or in part, that directly compete with any Atomicorp product or technology. Competes is defined as creating or distributing software or services that provide similar or same functionality as any Software or technology developed by Atomicorp. Atomicorp reserves the right to revoke all rights and license privileges of Licensee immediately upon any such infringement. Upon notice of infringement, Licensee agrees to immediately destroy all copies of Software and remove Software and references to Software from all products, technologies and software applications. You may use the Software to conduct internal performance testing and benchmarking studies, the results of which you (and not unauthorized third parties) may publish or publicly disseminate; provided that Atomicorp has reviewed and approved of the methodology, assumptions and other parameters of the study in advance. Please contact Atomicorp at support@atomicorp.com to request such review. 1.4 GPL Software. You can redistribute and/or modify the GPL Software under the terms of the GPL. You may obtain a copy of the source code corresponding to the binaries for the GPL Software (the "GPL Source Files") by downloading the GPL Source Files from Atomicorp's Web site at http://www.atomicorp.com/download/, or by sending a request, with your name and address, to Atomicorp at the address specified under the heading "Contact Information" below, in which case Atomicorp will mail a copy of the GPL Source Files to you on a CD or equivalent physical medium. This offer to obtain a copy of the GPL Source Files is valid for one year from the date you acquired this Software product. 1.5 Audit Rights. You will maintain accurate records as to your use of the Software as authorized by this Agreement, for at least two (2) years from the last day on which support and subscription services ("Services") expired for the applicable Software. Atomicorp, or persons designated by Atomicorp, will, at any time during the period when you are obliged to maintain such records, be entitled to inspect such records and your computing devices, in order to verify that the Software is used by you in accordance with the terms of this Agreement and that you have paid the applicable license fees and Services fees for the Software; provided that Atomicorp may conduct no more than one (1) audit in any twelve (12) month period. You shall promptly pay to Atomicorp any underpayments revealed by any such audit. Any such audit will be performed at Atomicorp's expense during normal business hours, provided that you shall promptly reimburse Atomicorp for the cost of such audit and any applicable fees if such audit reveals an underpayment by you of more than five percent (5%) of the amounts payable by you to Atomicorp for the period audited. 2.0 TITLE Atomicorp retains all right, title, and interest in and to the Software and the Software License Key and in all related copyrights, trade secrets, patents, trademarks, and any other intellectual and industrial property and proprietary rights, including registrations, applications, renewals, and extensions of such rights. 3.0 SUPPORT AND SUBSCRIPTION SERVICES Atomicorp will provide email support services under this EULA. Extended support services may be negotiated with Atomicorp directly. Email support is available between the hours of 9am and 5pm EST. If you use spam filtering, please ensure that you allow support@atomicorp.com to enable us to respond to your support requests. It is your responsibility to ensure that this is allowed. By agreeing to this EULA you are accepting full risk and responsibility for communication from our support organization, and lose any any all rights of rebuke therein. This EULA does not give you any rights to any updates or upgrades to the Software or to any extensions or enhancements to the Software developed by Atomicorp outside of the Atomic Secured Linux subscription period. in the future. If you have purchased Atomicorp support and subscription services with the Software, these services are provided to you under the Support Contract Terms and Conditions posted on Atomicorp's Web site at http://www.atomicorp.com/support/ and by accepting the terms of this EULA you are accepting these Support Contract Terms and Conditions. Any supplemental software code or related materials that Atomicorp provides to you as part of any support and subscription services are to be considered part of the Software and are subject to the terms and conditions of this EULA. Atomicorp may use any technical information you provide to Atomicorp for any Atomicorp business purposes without restriction, including for product support and development. Atomicorp will not use information in a form that personally identifies you. 4.0 TERMINATION 4.1 Termination. Atomicorp may terminate this EULA immediately and without notice if you fail to comply with any term of this EULA. 4.2 Effect of Termination. In the event of termination, you must destroy all copies of the Software. In addition you must remove all copies of the Software, including all backup copies, from all computers and terminals on which it is installed. From time to time, Atomicorp may change the terms of this EULA. Atomicorp will notify you of such change. Your continued use of the Software will indicate your agreement to the change. 5. LIMITED WARRANTY AND LIMITATION OF LIABILITY 5.1 Limited Warranty. Atomicorp warrants that the media, if any, on which the Software is delivered will be free of defects and that the Software will substantially conform to the description contained in the applicable end user documentation in each case for a period of 90 days after the date of activation of the Software subscription. EXCEPT FOR THE PRECEDING EXPRESS LIMITED WARRANTY, TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, ATOMICORP AND ITS LICENSORS PROVIDE THE SOFTWARE WITHOUT ANY WARRANTIES OF ANY KIND, EXPRESS, IMPLIED, STATUTORY, OR IN ANY OTHER PROVISION OF THIS EULA OR COMMUNICATION WITH YOU, AND ATOMICORP AND ITS LICENSORS SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON- INFRINGEMENT. 5.2 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL ATOMICORP AND ITS LICENSORS BE LIABLE FOR ANY LOST PROFITS OR BUSINESS OPPORTUNITIES, LOSS OF USE, BUSINESS INTERRUPTION, LOSS OF DATA, OR ANY OTHER INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES UNDER ANY THEORY OF LIABILITY, WHETHER BASED IN CONTRACT, TORT, NEGLIGENCE, PRODUCT LIABILITY, OR OTHERWISE. BECAUSE SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE PRECEDING LIMITATION MAY NOT APPLY TO YOU. ATOMICORP AND ITS LICENSORS' LIABILITY UNDER THIS EULA WILL NOT, IN ANY EVENT, EXCEED THE LICENSE FEES, IF ANY, PAID BY YOU FOR THE SOFTWARE LICENSED TO YOU UNDER THIS EULA. THE FOREGOING LIMITATIONS SHALL APPLY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, REGARDLESS OF WHETHER ATOMICORP OR ITS LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF WHETHER ANY REMEDY FAILS OF ITS ESSENTIAL PURPOSE. 6.0 GENERAL 6.1 Entire Agreement. This Agreement sets forth Atomicorp's entire liability and your exclusive remedy with respect to the Software and supersedes the terms of any purchase orders and any other communications or advertising with respect to the Software. You acknowledge that this Agreement is a complete statement of the agreement between you and Atomicorp with respect to the Software, and that there are no other prior or contemporaneous understandings, promises, representations, or descriptions with respect to the Software. 6.2 Headings. Headings under this EULA are intended only for convenience and shall not affect the interpretation of this EULA. 6.3 Waiver and Modification. No failure of either party to exercise or enforce any of its rights under this EULA will act as a waiver of those rights. This EULA may only be modified, or any rights under it waived, by a written document executed by the party against which it is asserted. 6.4 Severability. If any provision of this EULA is found illegal or unenforceable, it will be enforced to the maximum extent permissible, and the legality and enforceability of the other provisions of this EULA will not be affected. 6.5 Governing Law. This EULA will be governed by Virginia law and the United States of America, without regard to its choice of law principles. The United Nations Convention for the International Sale of Goods shall not apply. Jurisdiction shall exclusively reside in the courts within Fairfax County, Virginia. 6.6 Government Restrictions. You may not export or re- export the Software except in compliance with the United States Export Administration Act and the related rules and regulations and similar non-U.S. government restrictions, if applicable. The Software and accompanying documentation are deemed to be "commercial computer software" and "commercial computer software documentation," respectively, pursuant to DFAR Section 227.7202 and FAR Section 12.212(b), as applicable. Any use, modification, reproduction, release, performing, displaying, or disclosing of the Software by the U.S. Government shall be governed solely by the terms of this EULA. 6.7 Contact Information. If you have any questions about this EULA, or if you want to contact Atomicorp for any reason, please direct all correspondence to: Atomicorp, Inc., 14121 Parke-long Court, Suite 220 Chantilly, Virginia 20151 or email support@atomicorp.com. 6.8 Other. Atomicorp and Atomic Secured Linux are trademarks and/or registered trademarks of Atomicorp, Inc. in the United States and/or various jurisdictions. EOF check_input "Do you agree to these terms (yes/no) [Default: yes]" "yes|no" "yes" if [ $INPUTTEXT != "yes" ]; then echo " Exiting install, License was not accepted " | tee -a $LOG exit 1 fi echo "NOTICE: User accepted License" >> $LOG fi # Main if [ ! $AUTO ]; then CONFIGURED=no fi if [ -f /etc/asl/config ] ; then . /etc/asl/config fi if [ -f /etc/redhat-release ]; then RELEASE=/etc/redhat-release elif [ -f /etc/os-release ]; then RELEASE=/etc/os-release elif [ -f /etc/openvz-release ]; then RELEASE=/etc/openvz-release elif [ -f /etc/SuSE-release ]; then RELEASE=/etc/SuSE-release elif [ -f /etc/os-release ]; then RELEASE=/etc/os-release elif [ -f /etc/lsb-release ]; then RELEASE=/etc/lsb-release elif [ -f /etc/debian_version ]; then RELEASE=/etc/debian_version else echo "Error: unable to identify operating system" exit 1 fi PKG=rpm if egrep -q "^Fedora|release 3|release 4" $RELEASE ; then cat /etc/redhat-release echo "This platform is no longer supported..." | tee -a $LOG echo "Exiting..." exit 1 elif egrep -q "release 5|release 2011" $RELEASE ; then DIST="el5" DIR=centos/5 elif egrep -q "release 6|release 2012" $RELEASE ; then DIST="el6" DIR=centos/6 elif egrep -q "release 7" $RELEASE ; then DIST="el7" DIR=centos/7 elif egrep -q "openSUSE 12" $RELEASE ; then DIST="suse12" DIR=opensuse/12 PKG=suse elif egrep -q "openSUSE 13" $RELEASE ; then DIST="suse13" DIR=opensuse/13 PKG=suse elif egrep -q "^6.0" $RELEASE ; then DIST="squeeze" DIR=debian/6 PKG=deb elif egrep -q "wheezy" $RELEASE ; then DIST="wheezy" DIR=debian/7 PKG=deb elif egrep -q "jessie" $RELEASE ; then DIST="jessie" DIR=debian/8 PKG=deb elif egrep -q "lucid" $RELEASE ; then DIST="lucid" DIR=ubuntu/10 PKG=deb elif egrep -q "precise" $RELEASE ; then DIST="precise" DIR=ubuntu/12 PKG=deb elif egrep -q "Raring Ringtail" $RELEASE ; then DIST="raring" DIR=ubuntu/13 PKG=deb elif egrep -q "Trusty Tahr" $RELEASE ; then DIST="trusty" DIR=ubuntu/14 PKG=deb elif egrep -q "Xenial" $RELEASE ; then DIST="xenial" DIR=ubuntu/16 PKG=deb else echo "Error: Unable to determine distribution type. Please send the contents of $RELEASE to support@atomicorp.com" | tee -a $LOG exit 1 fi yum_install () { if [ ! -f /usr/bin/yum ]; then echo echo "Error: Yum was not detected. Contact your provider for support." | tee -a $LOG echo exit 1 else YUM=1 fi ## yum, make sure yum is up to date echo -n "Ensuring yum is up to date: " | tee -a $LOG /usr/bin/yum -y upgrade yum >> $LOG 2>&1 echo "Done" | tee -a $LOG echo -n "Installing the Atomic GPG key: " |tee -a $LOG if [ ! -f /etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt ]; then if [ ! -d /etc/pki/rpm-gpg ]; then mkdir -p /etc/pki/rpm-gpg/ fi wget -q http://www.atomicorp.com/RPM-GPG-KEY.art.txt -O /etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt >> $LOG 2>&1 rm -f RPM-GPG-KEY.art.txt fi echo "OK" | tee -a $LOG if [ ! -f /etc/pki/rpm-gpg/RPM-GPG-KEY.atomicorp.txt ]; then if [ ! -d /etc/pki/rpm-gpg ]; then mkdir -p /etc/pki/rpm-gpg/ fi wget -q http://www.atomicorp.com/RPM-GPG-KEY.atomicorp.txt -O /etc/pki/rpm-gpg/RPM-GPG-KEY.atomicorp.txt >> $LOG 2>&1 fi if [ ! -d /etc/asl ]; then mkdir /etc/asl fi cat << EOF > /etc/yum.repos.d/tortix-common.repo [tortix-common] name=Atomicorp - \$releasever - Atomic Secured Linux mirrorlist=http://updates.atomicorp.com/channels/mirrorlist/tortix-common/centos-\$releasever-\$basearch priority=1 enabled=0 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY.atomicorp.txt file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt gpgcheck=1 $KERNEL [tortix-common-testing] name=Atomicorp - \$releasever - Atomic Secured Linux mirrorlist=http://updates.atomicorp.com/channels/mirrorlist/tortix-common-testing/centos-\$releasever-\$basearch priority=1 enabled=0 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY.atomicorp.txt file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt gpgcheck=1 $KERNEL EOF yum --enablerepo=tortix-common -y install aum | tee -a $LOG if [ ${PIPESTATUS[0]} -ge 1 ]; then echo echo "Error: Could not install Aum" |tee -a $LOG exit 1 fi #echo -n "Hit any key to continue" #read -s ENTER < $INSTALL_TTY # #if [ ! -f /etc/asl/license.key ]; then # /var/asl/bin/aum configure # # /var/asl/bin/aum -uf #fi } zypper_install () { # Add keys if [ ! -f /etc/pki/rpm-gpg/RPM-GPG-KEY.atomicorp.txt ]; then if [ ! -d /etc/pki/rpm-gpg ]; then mkdir -p /etc/pki/rpm-gpg/ fi wget -q http://www.atomicorp.com/RPM-GPG-KEY.atomicorp.txt -O /etc/pki/rpm-gpg/RPM-GPG-KEY.atomicorp.txt >> $LOG 2>&1 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY.atomicorp.txt fi # Add repo echo http://updates.atomicorp.com/channels/tortix-common/$DIR/$ARCH/ /usr/bin/zypper ar -t YUM http://updates.atomicorp.com/channels/tortix-common/$DIR/SuSE.repo # Install package /usr/bin/zypper --gpg-auto-import-keys -n install aum } if [ "$PKG" = "rpm" ]; then yum_install elif [ "$PKG" = "suse" ]; then zypper_install elif [ "$PKG" = "deb" ]; then # wget -O - https://www.atomicorp.com/RPM-GPG-KEY.atomicorp.txt | apt-key add - # if ! grep -q atomicorp /etc/apt/sources.list ; then echo "deb http://updates.atomicorp.com/channels/tortix-common/debian $DIST main" >> /etc/apt/sources.list fi /usr/bin/apt-get update && /usr/bin/apt-get -y --force-yes install aum else echo "Error: Distribution unknown" exit fi # tmp if [ ! -f /var/asl/data/updates-data ]; then touch /var/asl/data/updates-data >/dev/null 2>&1 fi echo "install finished" >> $LOG echo echo "To complete installation run:" echo " aum configure" echo echo "and to update your rules:" echo " aum upgrade" echo echo