mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2026-03-29 07:06:34 +00:00
Set max session storage to 8kb
If using the filesystem storage provider for session store it can be set than a larger value than 4kb as it is not tied to the restriction of a cookie anymore.
This commit is contained in:
@@ -9,9 +9,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
rdpGwSession = "RDPGWSESSION"
|
rdpGwSession = "RDPGWSESSION"
|
||||||
MaxAge = 120
|
MaxAge = 120
|
||||||
identityKey = "RDPGWID"
|
identityKey = "RDPGWID"
|
||||||
|
maxSessionLength = 8192
|
||||||
)
|
)
|
||||||
|
|
||||||
var sessionStore sessions.Store
|
var sessionStore sessions.Store
|
||||||
@@ -26,7 +27,13 @@ func InitStore(sessionKey []byte, encryptionKey []byte, storeType string) {
|
|||||||
|
|
||||||
if storeType == "file" {
|
if storeType == "file" {
|
||||||
log.Println("Filesystem is used as session storage")
|
log.Println("Filesystem is used as session storage")
|
||||||
sessionStore = sessions.NewFilesystemStore(os.TempDir(), sessionKey, encryptionKey)
|
fs := sessions.NewFilesystemStore(os.TempDir(), sessionKey, encryptionKey)
|
||||||
|
|
||||||
|
// set max length
|
||||||
|
log.Printf("Setting maximum session storage to %d bytes", maxSessionLength)
|
||||||
|
fs.MaxLength(maxSessionLength)
|
||||||
|
|
||||||
|
sessionStore = fs
|
||||||
} else {
|
} else {
|
||||||
log.Println("Cookies are used as session storage")
|
log.Println("Cookies are used as session storage")
|
||||||
sessionStore = sessions.NewCookieStore(sessionKey, encryptionKey)
|
sessionStore = sessions.NewCookieStore(sessionKey, encryptionKey)
|
||||||
|
|||||||
Reference in New Issue
Block a user