Skip to content

Instantly share code, notes, and snippets.

@crmaxx
Last active January 19, 2017 14:36
Show Gist options
  • Save crmaxx/ed65cd8b67fa82292205 to your computer and use it in GitHub Desktop.
Save crmaxx/ed65cd8b67fa82292205 to your computer and use it in GitHub Desktop.
NetScanner Installation Log

On remote host

As root

If you have error in console

-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

Regenerate locales:

locale-gen en_US.UTF-8
dpkg-reconfigure -fnoninteractive locales
update-locale LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US"

Update packeges list and install dialog

apt-get update
apt-get install sudo dialog

Add new deploy user and add it to sudo group

sudo adduser deploy
sudo adduser deploy sudo

For modify /etc/sudoers:

sudo visudo

And put this in /etc/sudoers:

deploy ALL = NOPASSWD: /sbin/poweroff, /sbin/start, /sbin/stop, /sbin/restart, /bin/mv, /bin/ln, /bin/chmod, /usr/sbin/update-rc.d, /etc/init.d/nginx, /etc/init.d/unicorn_netscanner_production

Change user to deploy

su deploy

If you have error

add-apt-repository: command not found

install it:

sudo apt-get install software-properties-common

Add repositories for nginx and java

sudo add-apt-repository ppa:nginx/stable
sudo add-apt-repository ppa:webupd8team/java

Add repository for pg9.4-client Create the file /etc/apt/sources.list.d/pgdg.list, and add a line for the repository

deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main

Import the repository signing key, and update the package lists

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

Update packeges list

sudo apt-get update

Install required software and libs

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev \
  libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev \
  libcurl4-openssl-dev python-software-properties libffi-dev libpq-dev libgdbm-dev \
  libncurses5-dev automake libtool bison nginx mc oracle-java8-installer links2 \
  postgresql-client-9.4 nodejs

Install rvm

curl -L https://get.rvm.io | bash -s head
source ~/.rvm/scripts/rvm
rvm install 2.2.2
rvm use 2.2.2 --default
ruby -v

Install bundler

echo "gem: --no-ri --no-rdoc" > ~/.gemrc
gem install bundler

Install Metasploit PRO

wget http://downloads.metasploit.com/data/releases/metasploit-latest-linux-x64-installer.run
chmod +x metasploit-latest-linux-x64-installer.run
sudo ./metasploit-latest-linux-x64-installer.run

Add new metasploit user, use links2 on server

links2 https://localhost:3790

Prepare configs for netscanner

chmod +rx /opt/metasploit/apps/pro/engine/tmp
mkdir -p /home/deploy/netscanner/shared/config
sudo cp /opt/metasploit/apps/pro/ui/config/database.yml ~/netscanner/shared/config/database.yml
sudo chown deploy:deploy ~/netscanner/shared/config/database.yml
chmod -x ~/netscanner/shared/config/database.yml
vim ~/netscanner/shared/config/secrets.yml

Put this into secrets.yml:

production:
  secret_key_base: any_big_random_string_like_this_97c0aca783560fa9c6ad9c57430f46cd3e4e4f0b6228758ecc5fd3e3f10f770603026c569d235dbdf1f40f54b00962ce59c8d3127bb6aa32c615c8024999569a

In local development

Add keys from remote host to local

ssh-copy-id [email protected]

Clone latest version

git clone [email protected]:crmaxx/netscanner.git

Check server installation

cap production rvm:check
cap production deploy:check
bundle exec cap production setup

Deploy netscanner

cap production deploy
@eddiefisher
Copy link

and now you need install nodejs

apt-get install nodejs

@crmaxx
Copy link
Author

crmaxx commented Jan 19, 2017

download new msf pro

wget -c http://downloads.metasploit.com/data/releases/metasploit-latest-linux-x64-installer.run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment