Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: metasploit and postgresql help

  1. #11
    Member
    Join Date
    Apr 2013
    Posts
    32
    Quote Originally Posted by Lordx19 View Post
    I've done this................

    I'm not an idiot.. I'm just saying, it says I have a password auth fail, yet it still loads msfconsole fine I guess; it takes like a minute or so to load it though after I stare at "password auth failed for user msf3" for a minute. I run service postgresql start and the same for metasploit. those run fine. Everything in the yml file is fine. It just makes no sense why I'm still getting this fatal error.
    Behave fella im trying to help!

    You say you have installed postgresql yourself multiple times!!! Could be your problem if you have installed it as its own instance and you havent issued a password and user.

    Kali comes with postgresql in metaploit bundled.


    BTW Metasploit and postgres work fine without the need to install separate instance of posgreqsl.

    HOW ABT POST SOME COMMAND OUTPUT!!!


    KindRegards
    Dee
    Last edited by pentest09; 2013-05-10 at 04:47 PM.

  2. #12
    Member
    Join Date
    Apr 2013
    Posts
    32
    I have just run the following after clean install:

    METASPLOIT:

    root@kali:~# service postgresql start
    root@kali:~# service metasploit start (the first time this is run before msfconsole it creates the database)
    Configuring Metasploit...
    Creating metasploit database user 'msf3'...
    Creating metasploit database 'msf3'...
    insserv: warning: current start runlevel(s) (empty) of script `metasploit' overrides LSB defaults (2 3 4 5).
    insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `metasploit' overrides LSB defaults (0 1 6).
    [ ok ] Starting Metasploit rpc server: prosvc.
    [ ok ] Starting Metasploit web server: thin

    check services:[/I]

    service postgresql status

    service metasploit status


    root@kali:~# msfconsole

    AUTO-START SERVICES:
    update-rc.d postgresql enable && update-rc.d metasploit enable

    RANDOM PASSWORD FOR POSTGRES DATABASE:
    kate /opt/metasploit/apps/pro/ui/config/database.yml (copy password)


    db_connect msf3:zIYTU8yvQ7aUUTQbXJt5MsQZxo3tD0ew@127.0.0.1/msf3


    Hope this helps,

    Kind Regards Dee

  3. #13
    Member
    Join Date
    Mar 2013
    Posts
    71
    None of that worked ): so i did a fresh quick kali install (had nothing to lose) and everything is working perfect now. Thanks for your help though!

  4. #14
    Member
    Join Date
    Apr 2013
    Posts
    32
    No Problem
    I know how frustrating it can be....believe me!

    Kind Regards DEE

    please note: running the msf update before creating the database for the first time corrupted mine.

  5. #15
    Junior Member
    Join Date
    Mar 2013
    Posts
    9
    Hello,

    look inside the file located at /etc/postgresql/9.1/main/pg_hba.conf

    and modify those lines where METHOD can be indicated as "password","trust","md5"

    I changed mine from password to trust and were able to login at db with that parameters

    # TYPE DATABASE USER ADDRESS METHOD
    # "local" is for Unix domain socket connections only
    local all all trust
    # IPv4 local connections:
    host all all 127.0.0.1/32 trust
    # IPv6 local connections:
    host all all ::1/128 trust
    # Allow replication connections from localhost, by a user with the
    # replication privilege.
    local replication postgres trust
    host replication postgres 127.0.0.1/32 trust
    host replication postgres ::1/128 trust

    Should work with that, or at least it worked for me
    Last edited by johnjohnsp1; 2013-05-27 at 12:51 PM. Reason: correction text

  6. #16
    Member
    Join Date
    Jul 2013
    Posts
    44
    Quote Originally Posted by pentest09 View Post
    Have you installed postgres yourself at all?

    I know its been stated before but again ....

    service postgreql status
    service metasploit status
    msfconsole

    cat /opt/metasploit/apps/pro/ui/config/database.yml

    check your database name=msf3
    check your user name=msf3
    #########################################
    development:
    adapter: "postgresql"
    database: "msf3"
    username: "msf3"
    password: "9hMj2yrZ62r3cynWh***************"
    port: 5432
    host: "localhost"
    pool: 256
    timeout: 5

    production:
    adapter: "postgresql"
    database: "msf3"
    username: "msf3"
    password: "9hMj2yrZ62r3cynWh***************"
    port: 5432
    host: "localhost"
    pool: 256
    timeout: 5

    =========================================

    Make sure its just like that. I had errors before with armitage connecting due to this being changed somehow to below:

    development:
    adapter: "postgresql"
    database: "msf3"
    username: "msf3"
    password: "9hMj2yrZ62r3cynWh***************"
    port: 5432
    host: "localhost"
    pool: 256
    timeout: 5


    # Warning: The database defined as "test" will be erased and
    # re-generated from your development database when you run "rake".
    # Do not set this db to the same as development or production.
    #
    # Note also, sqlite3 is totally unsupported by Metasploit now.
    test:
    adapter: sqlite3
    database: "msf3"
    pool: 5
    timeout: 5


    Also try using your ip instead of localhost or 127.0.0.1

    db_connect msf:msf@192.168.0.5/msf3

    Thanks I had connect_db error and after reading this rhread it's solved now.By the way what kind of hashing is being used for this password ?

    Best,

    Ok I got my response:MD5

    Thank you All.
    Last edited by xerxes; 2013-08-02 at 07:55 AM.

  7. #17
    Junior Member
    Join Date
    Feb 2014
    Posts
    4
    After searching solution, that's my solution to this problem :

    Facts :
    Launched kali properly and without upadtes
    Starting service postgresql
    No msf3 user in database ...
    No msf3 database exist ...
    Starting metasploit -> database.yml created and the password is visible in this file but didn't work when trying to connect (db_connect msf3:*****@127.0.0.1/msf3)
    Normal ... no user and no database ....

    So,

    I created the user and the database :

    sudo -i -u postgresql

    then go to psql application by typing "psql"

    and now see that you don't have user "msf3" and databse to connect by these commands (you can have these commands typing \?) :

    \du

    \l

    Let's create the user :

    CREATE USER msf3 WITH PASSWORD 'yourpassword';

    and create the database

    CREATE DATABASE yourdatabse OWNER msf3;

    Now you have your database and your user for metasploit.

    Then modify the database.yml file about the user and password to the future connection with metasploit ...

    Hope this can help you !

    Have a nice day !

  8. #18
    Junior Member
    Join Date
    Mar 2014
    Posts
    1
    Quote Originally Posted by FUSHIA View Post
    After searching solution, that's my solution to this problem :

    Facts :
    Launched kali properly and without upadtes
    Starting service postgresql
    No msf3 user in database ...
    No msf3 database exist ...
    Starting metasploit -> database.yml created and the password is visible in this file but didn't work when trying to connect (db_connect msf3:*****@127.0.0.1/msf3)
    Normal ... no user and no database ....

    So,

    I created the user and the database :

    sudo -i -u postgresql

    then go to psql application by typing "psql"

    and now see that you don't have user "msf3" and databse to connect by these commands (you can have these commands typing \?) :

    \du

    \l

    Let's create the user :

    CREATE USER msf3 WITH PASSWORD 'yourpassword';

    and create the database

    CREATE DATABASE yourdatabse OWNER msf3;

    Now you have your database and your user for metasploit.

    Then modify the database.yml file about the user and password to the future connection with metasploit ...

    Hope this can help you !

    Have a nice day !
    Hello,
    Same issue for me, but even with the previous explanation it was not working. Maybe be because my fat fingers.
    But If you edit the file postgresql.conf somewhere in /etc/postgresql/ you can change the port to 5432. The port was set to 5433. Strange because you can find a sample of the "conf" file somewhere in /usr/share with the port set to 5432.
    Anyway, problem solved.

  9. #19
    Junior Member
    Join Date
    Mar 2014
    Posts
    1
    The best solution to this problem is to edit /etc/postgresql/9.1/main/postgresql.conf BEFORE you start the postgresql and metasploit services to change the port from 5433 to 5432
    If when you start the postgresql service and see that it is listening on port 5433 (using "ss -ant") then you should stop the service and edit /etc/postgresql/9.1/main/postgresql.conf to change the port. Then start postgresql again and then start metasploit.
    metasploit will configure itself on the first run and create the users and datbases it needs and populate database.yml with the passwords for the accounts it created.

    But it would seem if you have already started metasploit while postgresql was listening on the wrong port it will fail to configure itself properly the second time after you have changed the listening point. My solution for this was to restore a virtual machine snapshot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •