diff --git a/distro b/distro new file mode 100644 index 0000000..61ad248 --- /dev/null +++ b/distro @@ -0,0 +1,114 @@ +#!/usr/bin/env bash +# Detects which OS and if it is Linux then it will detect which Linux Distribution. + +OS=`uname -s` +REV=`uname -r` +MACH=`uname -m` + +if [ "${OS}" = "SunOS" ] ; then + OS=Solaris + ARCH=`uname -p` + OSSTR="${OS} ${REV}(${ARCH} `uname -v`)" + +elif [ "${OS}" = "AIX" ] ; then + OSSTR="${OS} `oslevel` (`oslevel -r`)" + +elif [ "${OS}" = "Linux" ] ; then + KERNEL=`uname -r` + + if [ -f /etc/fedora-release ]; then + DIST=$(cat /etc/fedora-release | awk '{print $1}') + REV=`cat /etc/fedora-release | sed s/.*release\ // | sed s/\ .*//` + + elif [ -f /etc/redhat-release ] ; then + DIST=$(cat /etc/redhat-release | awk '{print $1}') + if [ "${DIST}" = "CentOS" ]; then + DIST="CentOS" + elif [ "${DIST}" = "Mandriva" ]; then + DIST="Mandriva" + PSEUDONAME=`cat /etc/mandriva-release | sed s/.*\(// | sed s/\)//` + REV=`cat /etc/mandriva-release | sed s/.*release\ // | sed s/\ .*//` + elif [ -f /etc/oracle-release ]; then + DIST="Oracle" + else + DIST="RedHat" + fi + + PSEUDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` + REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//` + + elif [ -f /etc/mandrake-release ] ; then + DIST='Mandrake' + PSEUDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//` + REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//` + + elif [ -f /etc/devuan_version ] ; then + DIST="Devuan `cat /etc/devuan_version`" + REV="" + + elif [ -f /etc/debian_version ] ; then + DIST="Debian `cat /etc/debian_version`" + REV="" + ID=`lsb_release -i | awk -F ':' '{print $2}' | sed 's/ //g'` + if [ "${ID}" = "Raspbian" ] ; then + DIST="Raspbian `cat /etc/debian_version`" + fi + + elif [ -f /etc/gentoo-release ] ; then + DIST="Gentoo" + REV=$(tr -d '[[:alpha:]]' /etc/hosts <> /etc/hosts << HOSTFILESTATIC +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 +HOSTFILESTATIC + +####################################################################################################################################################### +#Step 3: determine distro +####################################################################################################################################################### +DISTRO_TYPE="$(distro |awk '{print $1}'|tr '[:upper:]' '[:lower:]')" +DISTRO_VERSION=$(distro |awk '{print $2}'|awk -F '.' '{print $1}') + + +####################################################################################################################################################### +#Step 4: Register system with librenms +####################################################################################################################################################### +CURL_STRING="{\"hostname\":\"$(hostname -f)\",\"version\":\"v2c\",\"community\":\"$SNMP_COMMUNITY\"}" + +curl \ + --insecure \ + -X POST \ + -d $CURL_STRING \ + -H 'X-Auth-Token: $TOKEN' \ + $LIBRENMS_ENDPOPINT/api/v0/devices + +####################################################################################################################################################### +#Step 5: Call a rundeck job +####################################################################################################################################################### +curl \ + --insecure \ + -X POST \ + -H 'X-Rundeck-Auth-Token: $RUNDECK_TOKEN' \ + $RDECK_BASE_URL/job/$JOB_ID/run + +####################################################################################################################################################### +#Step 6: Do stuff based on distribution type and version +####################################################################################################################################################### + + +if [ $DISTRO_TYPE == "centos" ] && [ $DISTRO_VERSION == 6 ] ; +then + c6stuff +fi + +if [ $DISTRO_TYPE == "centos" ] && [ $DISTRO_VERSION == 7 ] ; +then + c7stuff +fi + +if [ $DISTRO_TYPE == "ubuntu" ] && [ $DISTRO_VERSION == 14 ] ; +then + ub14stuff +fi + diff --git a/newSrv.sh b/newSrv.sh new file mode 100644 index 0000000..577dfb0 --- /dev/null +++ b/newSrv.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +#curl -s http://dl.turnsys.net/newSrv.sh|/bin/bash + +apt-get -y --purge remove nano +apt-get -y install ntp ntpdate +systemctl stop ntp +ntpdate 10.251.37.5 +apt-get update +apt-get -y full-upgrade +apt-get -y install glances htop dstat snmpd screen lldpd lsb-release libpcre2-dev libevent-dev + + +rm -rf /usr/local/librenms-agent + +curl -s http://dl.turnsys.net/librenms-agent/distro > /usr/local/bin/distro +chmod +x /usr/local/bin/distro + +curl -s http://dl.turnsys.net/librenms.tar.gz > /usr/local/librenms.tar.gz +cd /usr/local ; tar xfs librenms.tar.gz + +systemctl stop snmpd ; curl -s http://dl.turnsys.net/snmpd.conf > /etc/snmp/snmpd.conf + +sed -i "s|-Lsd|-LS6d|" /lib/systemd/system/snmpd.service +systemctl daemon-reload +systemctl restart snmpd + +/etc/init.d/rsyslog stop + +cat < /etc/rsyslog.conf +# /etc/rsyslog.conf configuration file for rsyslog +# +# For more information install rsyslog-doc and see +# /usr/share/doc/rsyslog-doc/html/configuration/index.html + + +################# +#### MODULES #### +################# + +module(load="imuxsock") # provides support for local system logging +module(load="imklog") # provides kernel logging support +#module(load="immark") # provides --MARK-- message capability + +*.* @10.251.30.1:514 +EOF + +/etc/init.d/rsyslog start +logger "hi hi from $(hostname)" + + +bash <(curl -Ss https://my-netdata.io/kickstart.sh) --dont-wait + + diff --git a/omsa.sh b/omsa.sh new file mode 100644 index 0000000..2410e6a --- /dev/null +++ b/omsa.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +#curl -s http://dl.turnsys.net/omsa.sh|/bin/bash + +gpg --keyserver hkp://pool.sks-keyservers.net:80 --recv-key 1285491434D8786F +gpg -a --export 1285491434D8786F | apt-key add - +echo "deb http://linux.dell.com/repo/community/openmanage/930/bionic bionic main" > /etc/apt/sources.list.d/linux.dell.com.sources.list +wget http://archive.ubuntu.com/ubuntu/pool/universe/o/openwsman/libwsman-curl-client-transport1_2.6.5-0ubuntu3_amd64.deb +wget http://archive.ubuntu.com/ubuntu/pool/universe/o/openwsman/libwsman-client4_2.6.5-0ubuntu3_amd64.deb +wget http://archive.ubuntu.com/ubuntu/pool/universe/o/openwsman/libwsman1_2.6.5-0ubuntu3_amd64.deb +wget http://archive.ubuntu.com/ubuntu/pool/universe/o/openwsman/libwsman-server1_2.6.5-0ubuntu3_amd64.deb +wget http://archive.ubuntu.com/ubuntu/pool/universe/s/sblim-sfcc/libcimcclient0_2.2.8-0ubuntu2_amd64.deb +wget http://archive.ubuntu.com/ubuntu/pool/universe/o/openwsman/openwsman_2.6.5-0ubuntu3_amd64.deb +wget http://archive.ubuntu.com/ubuntu/pool/multiverse/c/cim-schema/cim-schema_2.48.0-0ubuntu1_all.deb +wget http://archive.ubuntu.com/ubuntu/pool/universe/s/sblim-sfc-common/libsfcutil0_1.0.1-0ubuntu4_amd64.deb +wget http://archive.ubuntu.com/ubuntu/pool/multiverse/s/sblim-sfcb/sfcb_1.4.9-0ubuntu5_amd64.deb +wget http://archive.ubuntu.com/ubuntu/pool/universe/s/sblim-cmpi-devel/libcmpicppimpl0_2.0.3-0ubuntu2_amd64.deb +dpkg -i libwsman-curl-client-transport1_2.6.5-0ubuntu3_amd64.deb +dpkg -i libwsman-client4_2.6.5-0ubuntu3_amd64.deb +dpkg -i libwsman1_2.6.5-0ubuntu3_amd64.deb +dpkg -i libwsman-server1_2.6.5-0ubuntu3_amd64.deb +dpkg -i libcimcclient0_2.2.8-0ubuntu2_amd64.deb +dpkg -i openwsman_2.6.5-0ubuntu3_amd64.deb +dpkg -i cim-schema_2.48.0-0ubuntu1_all.deb +dpkg -i libsfcutil0_1.0.1-0ubuntu4_amd64.deb +dpkg -i sfcb_1.4.9-0ubuntu5_amd64.deb +dpkg -i libcmpicppimpl0_2.0.3-0ubuntu2_amd64.deb + +apt update +apt -y install srvadmin-all +touch /opt/dell/srvadmin/lib64/openmanage/IGNORE_GENERATION + +#logout,login, then run +# srvadmin-services.sh enable && srvadmin-services.sh start diff --git a/sslStackFromSource.sh b/sslStackFromSource.sh new file mode 100644 index 0000000..4fa6377 --- /dev/null +++ b/sslStackFromSource.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +#Made from instructions at https://www.tunetheweb.com/performance/http2/ + +OPENSSL_URL_BASE="https://www.openssl.org/source/" +OPENSSL_FILE="openssl-1.1.0h.tar.gz" + +NGHTTP_URL_BASE="https://github.com/nghttp2/nghttp2/releases/download/v1.31.0/" +NGHTTP_FILE="nghttp2-1.31.0.tar.gz" + +APR_URL_BASE="http://mirrors.whoishostingthis.com/apache/apr/" +APR_FILE="apr-1.6.3.tar.gz" + +APR_UTIL_URL_BASE="http://mirrors.whoishostingthis.com/apache/apr/" +APR_UTIL_FILE="apr-util-1.6.1.tar.gz" + +APACHE_URL_BASE="http://mirrors.whoishostingthis.com/apache/httpd/" +APACHE_FILE="httpd-2.4.33.tar.gz" + +CURL_URL_BASE="https://curl.haxx.se/download/" +CURL_FILE="curl-7.60.0.tar.gz" + + +#Download and install latest version of openssl +wget $OPENSSL_URL_BASE/$OPENSSL_FILE +tar xzf $OPENSSL_FILE +cd openssl-1.1.0h +./config enable-weak-ssl-ciphers shared zlib-dynamic -DOPENSSL_TLS_SECURITY_LEVEL=0 --prefix=/usr/local/custom-ssl/openssl-1.1.0h ; make ; make install +ln -s /usr/local/custom-ssl/openssl-1.1.0h /usr/local/openssl +cd - + +#Download and install nghttp2 (needed for mod_http2). +wget $NGHTTP_URL_BASE/$NGHTTP_FILE +tar xzf $NGHTTP_FILE +cd nghttp2-1.31.0 +./configure --prefix=/usr/local/custom-ssl/nghttp ; make ; make install +cd - + +#Updated ldconfig so curl build + +cat < /etc/ld.so.conf.d/custom-ssl.conf +/usr/local/custom-ssl/openssl-1.1.0h/lib +/usr/local/custom-ssl/nghttp/lib +custom-ssl + +ldconfig + +#Download and install curl +wget $CURL_URL_BASE/$CURL_FILE +tar xzf curl-7.60.0.tar.gz +cd curl-7.60.0 +./configure --prefix=/usr/local/custom-ssl/curl --with-nghttp2=/usr/local/custom-ssl/nghttp/ --with-ssl=/usr/local/custom-ssl/openssl-1.1.0h/ ; make ; make install +cd - + + +#Download and install latest apr +wget $APR_URL_BASE/$APR_FILE +tar xzf $APR_FILE +cd apr-1.6.3 +./configure --prefix=/usr/local/custom-ssl/apr ; make ; make install +cd - + +#Download and install latest apr-util +wget $APR_UTIL_URL_BASE/$APR_UTIL_FILE +tar xzf apr-util-1.6.1.tar.gz +cd apr-util-1.6.1 +./configure --prefix=/usr/local/custom-ssl/apr-util --with-apr=/usr/local/custom-ssl/apr ; make; make install +cd - + +#Download and install apache +wget $APACHE_URL_BASE/$APACHE_FILE +tar xzf httpd-2.4.33.tar.gz +cd httpd-2.4.33 +cp -r ../apr-1.6.3 srclib/apr +cp -r ../apr-util-1.6.1 srclib/apr-util +./configure --prefix=/usr/local/custom-ssl/apache --with-ssl=/usr/local/custom-ssl/openssl-1.1.0h/ --with-pcre=/usr/bin/pcre-config --enable-unique-id --enable-ssl --enable-so --with-included-apr --enable-http2 --with-nghttp2=/usr/local/custom-ssl/nghttp/ +make +make install +ln -s /usr/local/custom-ssl/apache /usr/local/apache +cd - +