Commit Graph

139 Commits

Author SHA1 Message Date
guoguangwu daaa53c392 chore: unnecessary use of fmt.Sprintf 2023-11-16 11:01:15 +08:00
alessandroperetti 807e8f25e3
Added jwt http timeout (#285)
* Added jwt http timeout

Co-authored-by: Alessandro Peretti <alessandro.peretti@spindox.it>
2023-06-09 09:29:01 -03:00
Ignacio Gómez 82493106ea Set gRPC backend name on initialization. Add mode to JWT backend name. 2023-05-24 01:29:14 -03:00
Ignacio Gómez 6924985b5b Bump dependencies and fix mysql test. 2023-05-23 20:41:35 -03:00
maab fb6a5b89e5
Postgres tls/sslmode "verify-full" as default (#248)
* Make `verify-full` to default postgres sslmode instead of `disable`.

* Adding documentation about postgres sslmode changes to readme

* Change default of sslmode in postgres auth opt table

* Add sslmode to auth opts to fix tests.
2022-11-11 08:27:55 -03:00
Nick Ufer 92a9e105cc
feat: makes mutual TLS optional for postgres, mysql/mariadb and grpc (#244)
* feat: makes mutual TLS optional for postgres and mysql

* feat: makes mutual TLS optional for gRPC

* refactor: replaces deprecated grpc.WithInsecure()

* docs: changes meaning of grpc tls option to client cert

* chore: updates test go version to same as project version (1.18)

* test: adds TLS and mutual TLS support to db and grpc test environments

* chore: adds generated test certificates to .gitignore

* chore: reduces test certificates to minimum key usage

* chore: adds second client certificate which acts as unauthorized

* test: adds mysql tls and mutual tls tests

* refactor: postgres ssl config check

* refactor: change connectTries to 0 for postgres to only have 1 retry by default like mysql

* refactor: postgres sslmode and sslrootcert code

* test: adds postgres tls and mutual tls tests

* fix: treat grpc authOpts grpc_ca_cert, grpc_tls_cert, grpc_tls_key as file paths instead of actual file contents

refactor: improves error logging

* test: adds grpc tls and mutual tls tests

* Fix postgres ssl modes `require`, ``verify-ca` and `verify-full` to work without explicit root certificate.

* refactor: adds warning for unknown pg_sslmode

style: removes empty lines

* style: compress switch case

Co-authored-by: Martin Abbrent <martin.abbrent@ufz.de>
2022-10-05 16:32:36 -03:00
Pavel Tolstov 55321df94e Remove unused parameter from jwtRequest() 2022-06-15 11:28:28 +03:00
Pavel Tolstov 4e1c35b4c9 Add posibility to get hostname of authorizing backend from "iss" claim of JWT token 2022-06-12 12:28:15 +03:00
Pavel Tolstov 788ee917e4 Add option for sending decrypted claims to JWT Javascript backend 2022-06-11 15:03:37 +03:00
Ignacio Gómez d904546ac6
Merge pull request #233 from iegomez/feat/http-method-option
HTTP/JWT request method
2022-06-10 18:20:35 -04:00
Ignacio Gómez 065ec97ee3
Use predefined http constants. Add tests to http backend. 2022-06-05 18:39:10 -04:00
Franz Auernigg 963a5ccb85
Add http method option. 2022-06-05 18:19:59 -04:00
Ignacio Gómez 05b64b5567
Update go and dependencies. Adjust Redis interface. 2022-06-05 16:33:27 -04:00
Ignacio Gómez 98d8b4a6aa
Postgresql fix (#224)
* Add option to set DB connection max life time in seconds and document it.

Co-authored-by: Thomas Tvedt <thomas@gulost.net>
2022-04-04 19:31:59 -04:00
Ignacio Gómez fa99ba6583 Add option to strip prefixes upon checking user or acl. 2021-09-23 20:40:32 -03:00
Ignacio Gómez 91e77551a7 Bump mongo driver version and migrate jwt module. 2021-09-15 15:16:49 -03:00
Ignacio Gómez 290c1c516a
Add gRPC options to set timeout and skip dial errors (#193)
* Don't bubble up grpc client error, just keep it nil and derive it again on checking.

Add option to check if we should faild on gRCP dial error or not.

Add timeout option.

* Instead of attempting on each check, remove with block when fail on dial error is not set to true so gRPC takes care of the connection itself.
Add tests to check that auth fails with dial errors, but works once the service is back up.

* Fix docker files missing libwebsockets8 by building from source, fix docker test run by starting maridb service instead of mysql one.

Co-authored-by: Ignacio Gómez <ignacio_gomez@apple.com>
2021-09-15 13:46:44 -03:00
Paul Traylor 5dc063f104
Add user-agent to requests (#176)
* Add default 'mosquitto' user-agent to http/jwt requests

* Add libmosquitto version ofr http and jwt remote user agent.

Add more room for extended versions.

Co-authored-by: Ignacio Gómez <iegomez@uc.cl>
2021-07-11 21:52:22 -04:00
Joachim Danmayr 45b8a85f02
Added monogdb TLS option (#170)
* Added monogdb TLS option

* Syntax fix

* Made TLS configurable

* Update README.md

Chnaged tls option name

Co-authored-by: Ignacio Gómez <iegomez@uc.cl>

* Update README.md

Chnaged tls option name.

Co-authored-by: Ignacio Gómez <iegomez@uc.cl>

* Update backends/mongo.go

Chnaged tls option name

Co-authored-by: Ignacio Gómez <iegomez@uc.cl>

* Update backends/mongo.go

Better style for setting TLS option

Co-authored-by: Ignacio Gómez <iegomez@uc.cl>

* Better style for setting TLS config

* Fixed variable name in struct

* Chnaged tab in Readme

* Added option to dkip TLS verify

Co-authored-by: Joachim Danmayr <danmayr.joachim@fronius.com>
Co-authored-by: Ignacio Gómez <iegomez@uc.cl>
2021-04-30 09:43:31 -04:00
Ignacio Gómez ee6e68db3a
Add JWT files mode. Now both JWT and Files may use the generally available strict files checker.
Files should be able to check ACLs only.
Clen setPrefixes method.
Fix test-backends by building custom plugin too, fix files only acls by checking if a user was seen before creating a general record.
2021-04-27 19:58:54 -04:00
Ignacio Gómez 16db4e244f
With a prefixed user, skip superuser check when disabled or not registered. 2021-03-10 22:57:52 -03:00
Ignacio Gómez e4d655557e
Fix README custom plugin returns, fix prefix/registered order for auth check, don return an error on enabled but unregistered superuser on valid prefix. 2021-03-09 23:13:06 -03:00
Ignacio Gómez 5cc687351e
Add backends tests and fix a couple of issues in Redis. 2021-03-09 23:13:03 -03:00
Ignacio Gómez ca22c6f9fa
Refactor backends to take all the init and checking logic out of the main package, add options to enable registering specific checks per backend. 2021-03-09 23:11:57 -03:00
Ignacio Gómez e7c2aec65f
Add tests for files fixes... not yet ready, patterns are failing. 2021-03-05 18:15:53 -03:00
Ignacio Gómez d2fc01e2f7
Add support for deny ACL and whitespaces in topics.
Support whitespaces in Files username
2021-02-26 20:33:18 -03:00
Pierre Fersing c0667a4c6e
Merge pull request #120 from PierreF/backend-error
Improve handling of backend failure
2021-02-17 16:37:45 +01:00
Pierre Fersing 90a24b52c6 Fix leaking existence of username from error 2021-02-13 15:00:35 +01:00
Pierre Fersing f1a3fef9ee
Improve log messages
Apply suggestions from code review

Co-authored-by: Ignacio Gómez <iegomez@uc.cl>
2021-02-13 14:04:13 +01:00
Pierre Fersing 28db4c0362 Avoid using 100% when using file backend 2021-02-13 13:35:16 +01:00
Pierre Fersing 250485f2bd Merge branch 'master' into backend-error 2021-02-13 12:14:28 +01:00
Ignacio Gómez 4bb8dcc34b
Reload static files on SIGHUP. 2021-02-12 13:20:05 -03:00
Pierre Fersing 4be4a085d8 Merge branch 'master' into backend-error 2021-02-11 16:04:00 +01:00
Ignacio Gómez 7a844596a0
Add javascript backend. 2021-02-11 11:02:53 -03:00
Ignacio Gómez fc44c811d2
Refactor JWT backend, add JS mode, allow pre parsing of token for JS and local mode, allow local mode specific DB options instead of sharing with regular DB backends. 2021-02-11 09:48:54 -03:00
Ignacio Gómez 1efdaab4c4
Return last ping error. 2021-02-11 09:35:28 -03:00
Ignacio Gómez 2e0c63b383
Add connect_tries option for DB backends. 2021-02-10 13:14:26 -03:00
Ignacio Gómez 2799395701
Fix postgres sslmode require typo. 2020-12-01 23:20:44 -03:00
Pierre Fersing dc1edd8963 Improve handling of backend failure
* No longer cache response from backend when the backend fail.
* Reply to Mosquitto using "MOSQ_ERR_UNKNOWN" which will disconnect
  client and avoid silent data loss when the error occure for ACL
  checks.
2020-11-13 17:04:34 +01:00
Ignacio Gómez 283a2801e0
Allow to skip expiration per user or acl check in JWT. 2020-10-30 20:56:05 -03:00
Ignacio Gómez 33ab13401b
Merge pull request #109 from iegomez/feat/jwt-skip-expiration
JWT skip expiration.
2020-10-29 20:50:08 -03:00
Ignacio Gómez 0c36103b19
When skip expiration set, check errors is a validation and expiration one. 2020-10-29 20:47:05 -03:00
Ignacio Gómez 1fb8e9ae49
Merge pull request #108 from iegomez/fix/skip-acl-read-when-user-not-present
Skip reading acls for not present users, add test cases.
2020-10-29 19:45:44 -03:00
Ignacio Gómez b6fd9d3d14
Skip reading acls for not present users, add test cases. 2020-10-29 19:44:34 -03:00
Ignacio Gómez a97818e724 Bump docker version in compose. 2020-10-23 20:55:36 -03:00
Dan Ξ 606b9557bc
Update mysql.go 2020-10-01 11:16:00 +03:00
Dan Ξ dd90a94c71
should be sslrootcert
since you're setting up mysql_sslrootcert.....
2020-09-30 14:33:03 +03:00
Ignacio Gómez aa487a9a05
Refactor hashing: add support for bcrypt and argond2id hashers.
Fix cache security issue.
2020-07-13 23:21:26 -04:00
Ignacio Gómez f5a5cec554 Don't require http superuser uri. 2020-07-13 22:35:07 -04:00
Ignacio Gómez 705515630d
Fix cache expiration time, add tests for go-store. 2020-06-27 19:36:49 -04:00