22 February 2013

how to install glastopf on centos 6 in a couple of minutes, no hassle

Edited on 04'th of March 2013 to reflect latest glastopf changes.
 
If you're wondering WTF is glastopf, well -> that's the bugger !
Some words before we begin:
Installing glastopf on Centos 6.3 32bit/64bit can be a pain especially if you break your already in place python setup. That's because glastopf needs 2.7 :) cute :>
First python version 2.7 needs to be installed without breaking the default 2.6 install (this would mess up yum and other tools that depend on python 2.6) *you want to stay away from that.

Ok, so how you set your OS up is up to you. you can get iso's, burn em and install in a physical machine, or virtualise using virtualbox/openvz/xen/vmware whatever you wish, the point is, you must have a fresh install(preferably) and a login prompt. 
Also, this was adapted from this ubuntu guide:the marvelous ubuntu guide. Once you're at a login prompt or at the shell, read on: 


All commands issued by root. If you must use sudo then do. I encourage it.
Setup the 'mess'(build) dir if you prefer but you can install python from anywhere.

Prepare the environment:
Prequisites from rpms

# yum groupinstall "Development Tools"
# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel php-devel libxml2-devel libxslt-devel atlas atlas-devel gcc-gfortran g++ git php php-devel wget screen mysql mysql-server mysql-devel libevent-headers
- accept all deps. 
- You need some of those things to have a not-only-barely-functional python interpreter. 
- from this point on it is recommended to perform all your work in screen. if you're not familiar with screen here's a good tutorial: the mighty screen. Basically it's a virtual terminal that keeps whatever stuff you do in it running even if your ssh session fails due to leet-isp-skills or alien crashes severing your fiber channels. Then when you reconnect you can re-attach to it and voila. it's as if you never left.
# mkdir -p /usr/local/build/
Python installation: cd to previously created dir, then:
# wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
# tar xjf Python-2.7.3.tar.bz2
# cd Python-2.7.3
# ./configure --prefix=/usr/local
# make && make altinstall
(the red word is very important)
Prequisites for pip (if you don't like distribute feel free to use your favourite):
# cd /usr/local/build/ 
# curl -O http://python-distribute.org/distribute_setup.py
# python2.7 distribute_setup.py
Pip installation:
# cd /usr/local/build/  
# curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
# python2.7 get-pip.py
Proceed to prequisites for glastopf:
  • pymongo:
# pip-2.7 install --upgrade pymongo
  • numpy and other deps:
# pip-2.7 install numpy
# pip-2.7 install chardet sqlalchemy lxml beautifulsoup pyOpenSSL requests MySQL-python
# pip-2.7 install scipy
(be warned: pip installs software from alpha centauri so expect *some* delays. also compiling can take a while.)
  • antlr:
# cd /usr/local/build/
# wget http://www.antlr3.org/download/antlr-3.1.3.tar.gz
# tar xzf antlr-3.1.3.tar.gz
# cd antlr-3.1.3/runtime/Python
# python2.7 setup.py install
  • SKLearn:
# cd /usr/local/build/
# git clone git://github.com/scikit-learn/scikit-learn.git
# cd scikit-learn
# python2.7 setup.py install
  • evnet:
# cd /usr/local/build/
# git clone git://github.com/rep/evnet.git
# cd evnet
# python2.7 setup.py install
Install and configure the php sandbox
# cd /usr/local/build/
# git clone git://github.com/glastopf/BFR.git
# cd BFR
# phpize
# ./configure --enable-bfr
# make && make install
take a look at your architecture and add this line to php.ini accordingly:
zend_extension = /usr/lib/php/modules/bfr.so
or
zend_extension = /usr/lib64/php/modules/bfr.so

Proceed with glastopf 
# cd /usr/local/build
# git clone https://github.com/glastopf/glastopf.git
# cd glastopf
# python2.7 setup.py install
if for some weird reason this doesnt work retry last command - i had issues due to some weird network problems or mirror issues. 

Create a directory that will serve as your glastopf honeypot root. anywhere you want. For example /usr/local:
# mkdir /usr/local/honeypot 
# cd /usr/local/honeypot
AND THEN : 
# glastopf-runner.py
but wait. it fails. that's because in the glastopf.cfg file that it sets up in this directory the group id doesn't exist. it may on debiant/ubuntu but not on centos. so change it to nobody and adjust other settings and you're set.

# screen glastopf-runner.py
It should look like something similar to this with the last line being Glastopf started and privileges dropped:


:D enjoy

4 comments:

  1. Dude you rock! This was exactly what I needed. Whatever reason, it would not create the config. Manually started mysql and had to run glastopf-runner.py --prepare. It created the cfg and after the group change it FINALLY started up.

    ReplyDelete
  2. im not sure but they may have changed the code yet again. back then it created the config automagically :)

    ReplyDelete
  3. thank you so much!

    ReplyDelete
    Replies
    1. i'm glad it was helpful.
      I haven't done any work with it since i posted the update and im a bit surprised the guide still works as intended :D

      Delete

careful what you wish for :)) cause someone else might wish the opposite