Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Rdpgw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirror
Rdpgw
Commits
27f2220a
Commit
27f2220a
authored
4 years ago
by
Bolke de Bruin
Browse files
Options
Downloads
Patches
Plain Diff
Make the use of a user token configurable
parent
2f27bd9e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+4
-2
4 additions, 2 deletions
README.md
api/web.go
+8
-4
8 additions, 4 deletions
api/web.go
config/configuration.go
+1
-0
1 addition, 0 deletions
config/configuration.go
main.go
+1
-0
1 addition, 0 deletions
main.go
with
14 additions
and
6 deletions
README.md
+
4
−
2
View file @
27f2220a
...
...
@@ -86,8 +86,11 @@ security:
# a random string of at least 32 characters to secure cookies on the client
# make sure to share this amongst different pods
PAATokenSigningKey
:
thisisasessionkeyreplacethisjetzt
PAATokenEncryptionKey
:
thisisasessionkeyreplacethisjetzt
#
PAATokenEncryptionKey: thisisasessionkeyreplacethisjetzt
UserTokenEncryptionKey
:
thisisasessionkeyreplacethisjetzt
# if you want to enable token generation for the user
# if true the username will be set to a jwt with the username embedded into it
EnableUserToken
:
true
```
## Testing locally
A convenience docker-compose allows you to test the RDPGW locally. It uses
[
Keycloak
](
http://www.keycloak.org
)
...
...
@@ -119,7 +122,6 @@ In this way you can integrate, for example, it with [pam-jwt](https://github.com
*
Integrate Open Policy Agent
*
Integrate GOKRB5
*
Integrate uber-go/zap
*
Integrate prometheus
*
Research: TLS defragmentation
*
Improve Web Interface
...
...
This diff is collapsed.
Click to expand it.
api/web.go
+
8
−
4
View file @
27f2220a
...
...
@@ -30,6 +30,7 @@ type Config struct {
SessionEncryptionKey
[]
byte
PAATokenGenerator
TokenGeneratorFunc
UserTokenGenerator
UserTokenGeneratorFunc
EnableUserToken
bool
OAuth2Config
*
oauth2
.
Config
store
*
sessions
.
CookieStore
OIDCTokenVerifier
*
oidc
.
IDTokenVerifier
...
...
@@ -170,10 +171,13 @@ func (c *Config) HandleDownload(w http.ResponseWriter, r *http.Request) {
http
.
Error
(
w
,
errors
.
New
(
"unable to generate gateway credentials"
)
.
Error
(),
http
.
StatusInternalServerError
)
}
userToken
,
err
:=
c
.
UserTokenGenerator
(
ctx
,
user
)
if
err
!=
nil
{
log
.
Printf
(
"Cannot generate token for user %s due to %s"
,
user
,
err
)
http
.
Error
(
w
,
errors
.
New
(
"unable to generate gateway credentials"
)
.
Error
(),
http
.
StatusInternalServerError
)
userToken
:=
user
if
c
.
EnableUserToken
{
userToken
,
err
=
c
.
UserTokenGenerator
(
ctx
,
user
)
if
err
!=
nil
{
log
.
Printf
(
"Cannot generate token for user %s due to %s"
,
user
,
err
)
http
.
Error
(
w
,
errors
.
New
(
"unable to generate gateway credentials"
)
.
Error
(),
http
.
StatusInternalServerError
)
}
}
// authenticated
...
...
This diff is collapsed.
Click to expand it.
config/configuration.go
+
1
−
0
View file @
27f2220a
...
...
@@ -49,6 +49,7 @@ type SecurityConfig struct {
UserTokenEncryptionKey
string
UserTokenSigningKey
string
VerifyClientIp
bool
EnableUserToken
bool
}
type
ClientConfig
struct
{
...
...
This diff is collapsed.
Click to expand it.
main.go
+
1
−
0
View file @
27f2220a
...
...
@@ -68,6 +68,7 @@ func main() {
OIDCTokenVerifier
:
verifier
,
PAATokenGenerator
:
security
.
GeneratePAAToken
,
UserTokenGenerator
:
security
.
GenerateUserToken
,
EnableUserToken
:
conf
.
Security
.
EnableUserToken
,
SessionKey
:
[]
byte
(
conf
.
Server
.
SessionKey
),
SessionEncryptionKey
:
[]
byte
(
conf
.
Server
.
SessionEncryptionKey
),
Hosts
:
conf
.
Server
.
Hosts
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment