Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for hashed passwords #876

Merged
merged 13 commits into from
Jan 11, 2023
Merged

Conversation

wanieru
Copy link
Contributor

@wanieru wanieru commented Nov 30, 2022

Based on: #873

I added support for both supplying hashed passwords into ftpserver.json, but also a config option hash_plaintext_passwords, which when loading a config will check if any passwords are plaintext, and re-encode the json-file after hashing them.

@wanieru
Copy link
Contributor Author

wanieru commented Nov 30, 2022

With the option to automatically hash plain-text passwords, running the server will neatly transform ftpserver.json like this, without breaking any formatting or changing/adding any other properties:

{
  "version": 1,
  "accesses": [
    {
      "user": "test",
      "pass": "test",
      "fs": "os",
      "params": {
        "basePath": "/tmp"
      }
    }
  ],
  "hash_plaintext_passwords": true,
  "passive_transfer_port_range": {
    "start": 2122,
    "end": 2130
  }
}

↓↓↓

{
  "version": 1,
  "accesses": [
    {
      "user": "test",
      "pass": "$2a$10$xD02IYP4PnlOV1k6wxioluwj2q9JfVxikHho0hRdDcHJCS.iCodHC",
      "fs": "os",
      "params": {
        "basePath": "/tmp"
      }
    }
  ],
  "hash_plaintext_passwords": true,
  "passive_transfer_port_range": {
    "start": 2122,
    "end": 2130
  }
}

Copy link
Owner

@fclairamb fclairamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @wanieru, I really like how you implemented it.

@wanieru
Copy link
Contributor Author

wanieru commented Dec 17, 2022

Thank you @wanieru, I really like how you implemented it.

Thank you!

@SuperQ
Copy link

SuperQ commented Dec 20, 2022

You might be interested in how we implemented a cache for bcrypt to reduce connection times for repeated access.

@fclairamb fclairamb enabled auto-merge (squash) January 11, 2023 17:12
@fclairamb fclairamb disabled auto-merge January 11, 2023 17:12
@fclairamb fclairamb merged commit 3fba0c2 into fclairamb:main Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants