Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    How to pass usernm/psswd to pfsense - Generating Sarg reports from Shell script

    Scheduled Pinned Locked Moved General pfSense Questions
    11 Posts 5 Posters 2.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      gderf
      last edited by

      Have you tried passing the username and password via the wget?

      –http-user=your-username --http-password=your-password

      1 Reply Last reply Reply Quote 0
      • A
        abarakat
        last edited by

        Yes, that didn't work either  :(

        1 Reply Last reply Reply Quote 0
        • A
          abarakat
          last edited by

          For those who are interested, I found the solution

          The first wget should call the main login page of pfsense not the required link, the second wget will call the required link.

          wget -q -O /dev/null –keep-session-cookies --save-cookies cookies.txt
          --post-data "login=Login&usernamefld=admin&passwordfld=mypassword"
          --no-check-certificate http://10.0.1.5

          wget --keep-session-cookies --load-cookies cookies.txt
          http://10.0.1.5/sarg_reports.php --no-check-certificate

          1 Reply Last reply Reply Quote 0
          • A
            abarakat
            last edited by

            I'm re-opening this topic  :(

            After I upgraded to pfsense 2.1 the above solution is not working anymore. has anything changed ???

            Now, I'm getting the following

            wget –keep-session-cookies --save-cookies cookies.txt
            --post-data 'login=Login&usernamefld=admin&passwordfld=pfsense' "http://10.0.0.5/sarg_reports.php"
            -O User_Acess_Report.dmp --no-check-certificate  --2013-10-10 14:46:49--  http://10.0.0.5

            Connecting to 10.0.0.5:80... connected.
            HTTP request sent, awaiting response... 403 Forbidden
            2013-10-10 14:46:49 ERROR 403: Forbidden.

            HELP

            1 Reply Last reply Reply Quote 0
            • X
              X.Z.
              last edited by

              I have the same error

              
              wget --keep-session-cookies --save-cookies cookies.txt  --post-data 'login=Login&usernamefld=admin&passwordfld=#abc@123@'  --no-check-certificate http://172.30.34.254/status_dhcp_leases.php
              --2013-10-17 23:53:39--  http://172.30.34.254/status_dhcp_leases.php
              正在連接 172.30.34.254:80... 連上了。
              已送出 HTTP 要求,正在等候回應... 403 Forbidden
              2013-10-17 23:53:39 錯誤 403: Forbidden。
              
              
              1 Reply Last reply Reply Quote 0
              • A
                abarakat
                last edited by

                Anybody. HELP

                1 Reply Last reply Reply Quote 0
                • A
                  abarakat
                  last edited by

                  X.Z. Did you find a solution???

                  1 Reply Last reply Reply Quote 0
                  • M
                    maverick_slo
                    last edited by

                    Hi guys!

                    Why not use plink if youre doing it from windows machine?

                    Plink here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
                    Example config:

                    @echo off
                    echo yes | C:\Tools\Putty\plink.exe -ssh -P SSH_PORTNUMBER -pw MYPASSWORD root@MYPFSENSEIPADDRESS "exit"
                    C:\Tools\Putty\plink.exe -ssh -P SSH_PORTNUMBER -pw MYPASSWORD root@MYPFSENSEIPADDRESS "/usr/local/bin/php /usr/local/www/sarg.php 0"
                    

                    second line will auto accept host certificate, second line will execure sarg report…

                    1 Reply Last reply Reply Quote 0
                    • A
                      abarakat
                      last edited by

                      Thanks Maverick

                      But I'm using Linux not windows.

                      1 Reply Last reply Reply Quote 0
                      • L
                        lazypete
                        last edited by

                        Hello, everyone.

                        I too have noticed that version 2.1 has broken my old reconnection scripts. The login method shown in the documentation page for the config backup script apparently no longer works, and while using plink may still be a valid solution I'm not using Windows either (and if at all possible I'd like to stick to bash and wget/curl).

                        So I'd like to have some help here, and it would be nice if the documentation got fixed as well.

                        Thanks.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.