Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
keystore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
id
keystore
Commits
485a2b6c
Commit
485a2b6c
authored
6 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Return mail_crypt_save_version=2 on responses
parent
0f7cdc55
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+7
-0
7 additions, 0 deletions
README.md
dovecot/keyproxy.go
+28
-6
28 additions, 6 deletions
dovecot/keyproxy.go
with
35 additions
and
6 deletions
README.md
+
7
−
0
View file @
485a2b6c
...
...
@@ -61,6 +61,13 @@ private keys from LDAP, and serve the *unencrypted* keys to Dovecot
using its
[
dict proxy
protocol
](
https://wiki2.dovecot.org/AuthDatabase/Dict
)
.
*NOTE*
that passdb lookups using
*dovecot-keylookupd*
contain the
cleartext password as part of the key, which may be logged in case of
error! This is currently a huge limitation of this solution, but there
seems to be no workaround that does not involve switching to a
fork()-based solution (like the checkpassword script). That might be a
better solution long-term.
TODO: explain the lookup protocol.
# Configuration
...
...
This diff is collapsed.
Click to expand it.
dovecot/keyproxy.go
+
28
−
6
View file @
485a2b6c
...
...
@@ -42,19 +42,41 @@ func (c *Config) check() error {
return
c
.
LDAPConfig
.
Valid
()
}
// The response returned to userdb lookups. It contains the user's
// public key as a global key for the mail_crypt plugin, and it sets
// mail_crypt_save_version to 2. The idea is that you would then set
// mail_crypt_save_version = 0 in the global Dovecot configuration,
// which would then disable encryption for users without encryption
// keys. For details on what this means, see
// https://wiki2.dovecot.org/Plugins/MailCrypt.
type
userdbResponse
struct
{
PublicKey
string
`json:"mail_crypt_global_public_key"`
PublicKey
string
`json:"mail_crypt_global_public_key"`
SaveVersion
int
`json:"mail_crypt_save_version"`
}
func
newUserDBResponse
(
publicKey
string
)
*
userdbResponse
{
return
&
userdbResponse
{
PublicKey
:
publicKey
,
SaveVersion
:
2
,
}
}
// The response returned to passdb lookups. We return the user's
// private key and the mail_crypt_save_version attribute as userdb
// parameters (hence the 'userdb_' prefix), and set the noauthenticate
// bit to inform Dovecot that this lookup is only meant to provide
// additional data, not authentication.
type
passdbResponse
struct
{
PrivateKey
string
`json:"userdb_mail_crypt_global_private_key"`
NoAuth
bool
`json:"noauthenticate"`
PrivateKey
string
`json:"userdb_mail_crypt_global_private_key"`
SaveVersion
int
`json:"userdb_mail_crypt_save_version"`
NoAuth
bool
`json:"noauthenticate"`
}
func
newPassDBResponse
(
privateKey
string
)
*
passdbResponse
{
return
&
passdbResponse
{
PrivateKey
:
privateKey
,
NoAuth
:
true
,
PrivateKey
:
privateKey
,
SaveVersion
:
2
,
NoAuth
:
true
,
}
}
...
...
@@ -123,7 +145,7 @@ func (s *KeyLookupProxy) lookupUserdb(ctx context.Context, username string) (int
return
nil
,
false
,
nil
}
log
.
Printf
(
"userdb lookup for %s"
,
username
)
return
&
u
ser
db
Response
{
PublicKey
:
s
.
b64encode
(
pub
)
}
,
true
,
nil
return
newU
ser
DB
Response
(
s
.
b64encode
(
pub
)
)
,
true
,
nil
}
func
(
s
*
KeyLookupProxy
)
lookupPassdb
(
ctx
context
.
Context
,
username
,
password
string
)
(
interface
{},
bool
,
error
)
{
...
...
This diff is collapsed.
Click to expand it.
ale
@ale
mentioned in issue
#1 (closed)
·
6 years ago
mentioned in issue
#1 (closed)
mentioned in issue #1
Toggle commit list
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