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.
- Add a msf user with normal privileges
- Clone metasploit-framework
- Libraries requirements
- Ruby env
- Database setup
- 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
References
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。