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

    Wich encrypting method ?

    Scheduled Pinned Locked Moved pfSense Packages
    4 Posts 3 Posters 925 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
      grinderfurax
      last edited by

      Hello.
      Because Squid is unable to use my Active Directory for authentification (my tree is too complex and the search is unable to find the users), I' think the more simple is to use a local base of users.

      Pfsense purposes a page to create user per user but I have 1300+ users to create each year. I'd like to write a tool to convert my clear users list into an encrypted one, like pfsense do.

      After a lot of search, I could find the file where usernames and passwords are saved : /var/etc/squid.passwd

      Inside squid.inc php code I could find this : $contents .= $user['username'] . ':' . crypt($user['password'], base64_encode($user['password'])) . "\n";

      My ask is wich encryption method is used behind the "crypt" function ?

      Thanks a lot.

      1 Reply Last reply Reply Quote 0
      • BBcan177B
        BBcan177 Moderator
        last edited by

        From this line in the code -

        base64_encode($user['password'])) . "\n";

        Seems to be base64 encoded

        http://www.php.net//manual/en/function.base64-encode.php

        "Experience is something you don't get until just after you need it."

        Website: http://pfBlockerNG.com
        Twitter: @BBcan177  #pfBlockerNG
        Reddit: https://www.reddit.com/r/pfBlockerNG/new/

        1 Reply Last reply Reply Quote 0
        • G
          grinderfurax
          last edited by

          Thanks a lot.

          I made custom php page to encrypt a file of users. Didn't tried it with a lot of users but worked perfectly with my tries.

          This thread can be closed.

          1 Reply Last reply Reply Quote 0
          • C
            charliem
            last edited by

            Glad you got it working, but for future reference: the base64_encode of the password is used as the salt parameter for crypt().  More details on php crypt are here:
            http://us1.php.net/manual/en/function.crypt.php

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