-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Database password authentication #862
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
Comments
It supports authentication via the userauth extension. https://www.sqlite.org/src/doc/trunk/ext/userauth/user-auth.txt However, by default there is no authentication at all.
This is because you tried to call the method on the db, err := sql.Open(...)
if err != nil { ... }
...
conn, err := db.Conn(context.Background())
if err != nil { ... }
defer conn.Close()
err := conn.Raw(func(driverConn interface{}) error {
enabled := driverConn.(*sqlite3.Conn).AuthEnabled()
...
})
... Can you expand upon your specific use case? Are you truly intending to authenticate the connection to the database itself? Or are you just trying to authenticate the users of your application? |
I will be storing the database file in the Webserver. Even though this DB file is not in the nginx www path, I don't want to keep the database file without password protection to read the contents or to edit. Currently I don't have plan to give edit access other users. So user authentication is not needed |
If your concern is someone being able to access the database file directly, you are going to want to encrypt it. Otherwise, a malicious attacker can bypass the SQLite API and directly read the file contents anyway. If the database file is encrypted, I'm not sure if adding user authentication on top of that actually provides any value. Unfortunately, at this time, this library doesn't support encryption. See #487 If you still wish to use authentication despite the aforementioned caveat, you can configure it via your connection string. https://github.com/mattn/go-sqlite3#user-authentication |
This means better than activating user authentication, as a first step implement proper file permissions(read) inside the server. Still if someone gets access to the database file, then encryption is the next option |
Why do you want password authentication? Which problem do you think it would solve? What is your threat model? |
Simply to say even if someone gets access to the database file, I want to prevent read access. |
Maybe |
I think rqlite is using this library but somehow the database file is encrypted with password. |
rqlite does not encrypt the SQLite database. Why did you think it did? |
@otoolep I tried to open raft.db file with sqlite browser and it said this isn't a database file which is the usual answer when the file is encrypted with password, I tried opening it with sqlite cypher and it asked me for a password. |
|
@otoolep Thank you for clarifying 👌. |
I am a beginner to SQLite. I have few questions regarding password authentication.
How can I access "AuthEnabled" ?
The text was updated successfully, but these errors were encountered: