Created
March 15, 2019 06:07
-
-
Save TheRinger/7b4dcb8f4a4a5b96056a1e5b4863ead3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#encoding=utf8 | |
CPPFLAGS="-I/usr/local/include" | |
LDFLAGS="-L/usr/local/lib" | |
BUILD_DIR="/opt" | |
build_dir="/opt" | |
#prefix_dir="/usr/local" | |
#ssl_dir="/usr/local/ssl" | |
#lib_dir="/usr/local/ssl/lib" | |
##------------------- | |
function get_ssl() { | |
echo 'Building OpenSSL from source.. ' | |
apt install libxml2 libxml2-dev libncurses5-dev libncursesw5-dev libtool autoconf automake \ | |
doxygen dh-autoreconf libssl-dev zlibc zlib1g zlib1g-dev lua-zlib lua-zlib-dev zlib1g-dev valgrind \ | |
check libpng-dev libbz2-dev libpcre3-dev ncurses-dev build-essential git wget curl pkg-config make | |
#mkdir -p $ssl_dir | |
cd $build_dir && git clone https://github.com/openssl/openssl.git | |
##-------------------------------------- | |
cd $build_dir/openssl | |
echo 'Starting Build Process' | |
#./config shared no-weak-ssl-ciphers no-idea no-mdc2 no-rc5 zlib --prefix=$ssl_dir --openssldir=$ssl_dir | |
env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./config shared no-weak-ssl-ciphers no-idea no-mdc2 zlib enable-egd zlib-dynamic --with-rand-seed=devrandom,getrandom,egd | |
#--prefix=$prefix_dir --openssldir=$ssl_dir | |
make depend | |
make | |
make test | |
make install_sw | |
ldd /usr/local/ssl/lib/libssl.so | |
ldd /usr/local/ssl/bin/openssl | |
ldconfig | |
echo 'Finished with openssl' | |
} | |
## ----------------------------------- | |
function get_dependencies() { | |
apt clean; apt autoclean; apt update; apt install -y apt-transport-https aptitude | |
aptitude update; aptitude install -y zlib1g-dev valgrind check libpng-dev libbz2-dev libpcre3-dev ncurses-dev build-essential git wget curl pkg-config make libssl-dev libxml2 libxml2-dev libncurses5-dev libncursesw5-dev libtool autoconf automake doxygen dh-autoreconf zlibc zlib1g zlib1g-dev lua-zlib lua-zlib-dev | |
gem install gist # commandline gister | |
echo 'Finished with dependencies' | |
} | |
function get_zlib() { | |
cd $BUILD_DIR | |
wget http://www.zlib.net/zlib1211.zip | |
unzip zlib1211.zip | |
cd zlib-1.2.11 | |
./configure --libdir=/usr/local/lib --prefix=/usr/local --64 | |
make | |
make install | |
ldconfig | |
} | |
function get_json_c() { | |
echo 'Fetching & Compiling Dependencies' | |
## --------------------------------- JSON-C ------------------------------ | |
cd $BUILD_DIR | |
git clone https://github.com/json-c/json-c.git | |
cd $BUILD_DIR/json-c | |
sh autogen.sh | |
./configure | |
make && make check && make install | |
ldconfig | |
echo ' | |
CFLAGS += $(shell pkg-config --cflags json-c) | |
LDFLAGS += $(shell pkg-config --libs json-c) | |
' | |
echo 'Finished with JSON-C' | |
} | |
function get_curl() { | |
## -------------------------------- CURL ------------------------------ | |
cd $BUILD_DIR | |
git clone https://github.com/curl/curl.git | |
cd $BUILD_DIR/curl | |
./buildconf | |
env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure --with-ssl --disable-thread --disable-manual --disable-verbose | |
make | |
make install | |
echo 'Finished with Curl' | |
} | |
#wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz | |
#wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz.md5 | |
#md5sum openssl-1.0.1g.tar.gz | |
#cat openssl-1.0.1g.tar.gz.md5 | |
#tar -xvzf openssl-1.0.1g.tar.gz | |
#cd openssl-1.0.1g | |
#./config –prefix=/usr/local/openssl –openssldir=/usr/local/openssl | |
#make | |
#sudo make install | |
#cd ~/apps/ | |
### | |
#sudo ldconfig | |
function get_clamav() { | |
cd $BUILD_DIR | |
groupadd clamav | |
useradd -g clamav -s /bin/false -c "Clam Antivirus" clamav | |
git clone git://github.com/vrtadmin/clamav-bytecode-compiler | |
git clone https://github.com/vrtadmin/clamav-devel && cd $BUILD_DIR/clamav-devel | |
#wget https://www.clamav.net/downloads/production/clamav-0.101.1.tar.gz.sig | |
#wget https://www.clamav.net/downloads/production/clamav-0.101.1.tar.gz | |
LDFLAGS="-L/usr/local/lib -L/usr/local/lib -L/usr/local/lib" | |
./configure --enable-check --with-pcre --with-libjson --with-openssl=/usr/local --enable-libfreshclam --with-xml --with-user=clamav --with-group=clamav --enable-experimental --with-libcurl --sysconfdir=/etc --prefix=/usr/local --program-transform-name=coin-wallet --enable-dns-fix --enable-no-cache --disable-fanotify | |
make -j2 | |
make check | |
make install | |
cp /usr/local/etc/freshclam.conf.sample /etc/freshclam.conf | |
nano /etc/freshclam.conf | |
chown clamav:clamav /etc/freshclam.conf | |
mkdir /usr/local/share/clamav | |
cp /usr/local/etc/clamd.conf.sample /usr/local/etc/clamd.conf | |
nano /usr/local/etc/clamd.conf | |
chown clamav:clamav /usr/local/etc/clamd.conf | |
/usr/local/bin/freshclam | |
chown -R clamav:clamav /usr/local/share/clamav | |
ldconfig | |
/usr/local/bin/freshclam | |
echo 'Finished with Clamav' | |
echo 'http://database.clamav.net/main.cvd' | |
echo 'http://database.clamav.net/daily.cvd' | |
echo 'http://database.clamav.net/bytecode.cvd' | |
} | |
function get_scripts() { | |
mkdir ~/bin && cd ~/bin | |
wget https://raw.githubusercontent.com/chadmayfield/scriptlets/master/chkrootkit.sh | |
chmod +x chrootkit.sh | |
} | |
function get_chkrootkit() { | |
cd $BUILD_DIR | |
wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz | |
wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.md5 | |
md5sum -c chkrootkit.md5 | |
tar -xvzf chkrootkit.tar.gz | |
cd chkrootkit-0.53 | |
make sense | |
chmod +x chkrootkit | |
cp chkrootkit /usr/sbin | |
} | |
function install() { | |
################################# | |
get_dependencies | |
get_ssl | |
get_json_c | |
get_curl | |
get_zlib | |
get_clamav | |
exit 0 | |
} | |
function help() { | |
echo "usage:" | |
echo " -i,--install Install everything." | |
echo " -c,--clamav Build ClamAV." | |
echo " -s,--openssl Build OpenSSL." | |
echo " -j,--jsonc Build Json-C." | |
echo " -C,--curl Build Curl." | |
echo " -d,--depends Download required packages for builds." | |
} | |
case $* in | |
--install|-i) | |
install | |
;; | |
--clamav|-c) | |
get_clamav | |
;; | |
--openssl|-s) | |
get_ssl | |
;; | |
--jsonc|-j) | |
get_json_c | |
;; | |
--curl|-C) | |
get_curl | |
;; | |
--chkrootkit|-r) | |
get_chkrootkit | |
;; | |
--depends|-d) | |
get_dependencies | |
;; | |
*) | |
help | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment