Linux - Install metasploit on CentOS

For a security research, we need to put metasploit-framework on the remote machine.

OS Details:

[centos@localhost centos]$  uname -a
Linux localhost.localdomain 2.6.32-042stab104.1 #1 SMP Thu Jan 29 12:58:41 MSK 2015 i686 i686 i386 GNU/Linux

[centos@localhost centos]$  cat /etc/issue
CentOS release 6.6 (Final)
Kernel \r on an \m

We’ll show you how to install metasploit-framework step by step.

  1. Add a msf user with normal privileges
  2. Clone metasploit-framework
  3. Libraries requirements
  4. Ruby env
  5. Database setup
  6. Start metasploit-framework

Add a msf user with normal privileges

Add a normal user for metasploit called centos by root.

# useradd -b /home/ -c 'normal user' -m -u 1000 centos

clone metasploit-framework

Let’s get a lastest metasploit copy from github.

# cd /opt
# git clone git://github.com:rapid7/metasploit-framework.git

Libraries requirements

# yum update
# yum upgrade
# yum install -y patch libyaml-devel glibc-headers autoconf gcc-c++ glibc-devel patch readline-devel libffi-devel automake libtool bison sqlite-devel postgresql-devel libpcap-devel

Ruby env

# su centos 
$ cd ~
$ curl -L https://get.rvm.io | bash -s stable --autolibs=enabled --ruby=2.1.5
$ source ~/.rvm/scripts/rvm
$ ruby --version
$ cd /opt/metasploit-framework/

$ bundle install 

Database setup

# service postgresql initdb
# service postgresql start
# su postgres
$ createuser msfuser -P   # set password: [msfpass]
$ createdb -O msfuser msfdb
$ exit
$ cd /opt/metasploit-framework
$ sudo mv config/database.yml.example config/database.yml
$ cat config/database.yml
production: &pgsql
  adapter: postgresql
  database: msfdb
  username: msfuser
  password: msfpass
  host: localhost
  port: 5432
  pool: 5
  timeout: 5

When we start metasploit, it make an error.

$  ./msfconsole
[*] Starting the Metasploit Framework console...[-] Failed to connect to the database: FATAL:  Ident authentication failed for user "msfuser"

What we need is to modify /var/lib/pgsql/data/pg_hba.conf file as follow:

local   all         all                               trust
host    all         all         127.0.0.1/32          trust
host    all         all         ::1/128               trust

Start metasploit-framework

$ cd /opt/metasploit-framework
$ ./msfconsole

centos-metasploit


References

  1. https://github.com/rapid7/metasploit-framework/wiki
  2. Install Metasploit on Arch
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值