emberstack / docker-sftp

SFTP Server for Docker
MIT License
196 stars 51 forks source link

Fix for #140 #141

Closed 1ARdotNO closed 1 year ago

1ARdotNO commented 1 year ago

I fixed it myself, This PR contains code to add an option to require both PKI and password auth on a global level. By setting PKIandPassword to true in the global scope, it will embed AuthenticationMethods "publickey,password" to sshd_config to enforce both methods.

example:

{
  "Global": {
    "Chroot": {
      "Directory": "%h",
      "StartPath": "sftp"
    },
    "Directories": ["sftp"],
    "PKIandPassword": "true",
    "Logging": {
      "IgnoreNoIdentificationString": true
    },
    "Hooks": {
      "OnServerStartup": [],
      "OnSessionChange": []
    }
  },
  "Users": [
    {
      "Username": "demo",
      "Password": "demo"
    }
  ],
  "Groups": [
    {
      "Name": "demogroup",
      "Users": ["demo"],
      "GID": 5000
    }
  ]
}
niteshamin commented 1 year ago

Any chance we can get this approved and merged into a new build. Got a use case which can benefit from it.

niteshamin commented 1 year ago

Confirming that the new build did support 2 factor authentication as intended. Thanks!