Skip to content
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

feat(enterprise): audit logs for alpha and zero #7295

Merged
merged 33 commits into from
Jan 26, 2021
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6c8d67d
starting work on audit logs
aman-bansal Jan 13, 2021
c77f3d0
making audit logs to work with alpha
aman-bansal Jan 14, 2021
6ba4f3b
making audit logs to work with zero too
aman-bansal Jan 14, 2021
8f4b3bc
go mod tidy
aman-bansal Jan 14, 2021
33aff9c
fixing minor things to clean
aman-bansal Jan 14, 2021
d78651f
adding endpoint to grpc audit
aman-bansal Jan 14, 2021
8f33f61
fixing alpha and zero default directories
aman-bansal Jan 14, 2021
eb2b7c7
fixing alpha and zero default directories
aman-bansal Jan 15, 2021
7515a1b
adding skip method for grpc audits
aman-bansal Jan 15, 2021
6e3d770
renaming rw
aman-bansal Jan 15, 2021
6706ac5
refactoring basic things
aman-bansal Jan 15, 2021
72db976
audit fix
aman-bansal Jan 15, 2021
97729e5
making zero and alpha logs from the start itself.
aman-bansal Jan 15, 2021
9b5c43e
fixing zero init audit process
aman-bansal Jan 15, 2021
d7adbf8
adding licence file + build tags
aman-bansal Jan 18, 2021
0710595
adding dgraph audit tool and logs encryption
aman-bansal Jan 19, 2021
40e0194
adding logwriter to handle encryption and everything
aman-bansal Jan 19, 2021
cdd76e8
adding test cases to check requests are getting logged into the audit…
aman-bansal Jan 19, 2021
87bea22
adding interceptor ee version
aman-bansal Jan 19, 2021
3248e2a
basic refactoring and log message truncate functionality
aman-bansal Jan 19, 2021
2ffcbfe
fixing auditing request handler
aman-bansal Jan 19, 2021
512f291
refactoring alpha and audit_ee
aman-bansal Jan 20, 2021
6336d09
refactoring some error handling
aman-bansal Jan 20, 2021
5b7c9f4
making audit conf more reliable
aman-bansal Jan 20, 2021
7cd693d
fixing goimports
aman-bansal Jan 20, 2021
6373287
Merge branch 'master' into aman/audit_logs
aman-bansal Jan 20, 2021
642c296
fixing merge conflicts
aman-bansal Jan 20, 2021
d97d78d
making log writer performant using buffered writer
aman-bansal Jan 24, 2021
05ea358
fixing zero test case and comments
aman-bansal Jan 24, 2021
d01d743
gracefully closing all the go routines
aman-bansal Jan 26, 2021
2fa132d
Merge branch 'master' into aman/audit_logs
aman-bansal Jan 26, 2021
2498f6d
fixing oss build
aman-bansal Jan 26, 2021
e35918c
fixing failed test case
aman-bansal Jan 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixing merge conflicts
aman-bansal committed Jan 20, 2021
commit 642c296a8f1956cab87042672005144a1af348b4
1 change: 0 additions & 1 deletion dgraph/cmd/alpha/run.go
Original file line number Diff line number Diff line change
@@ -604,7 +604,6 @@ func run() {

ctype, clevel := x.ParseCompression(Alpha.Conf.GetString("badger.compression"))

x.CheckFlag(Alpha.Conf.GetString("audit"), "dir", "compress", "encrypt-file")
conf, err := audit.GetAuditConf(Alpha.Conf.GetString("audit"))
x.Check(err)
opts := worker.Options{
2 changes: 0 additions & 2 deletions dgraph/cmd/zero/run.go
Original file line number Diff line number Diff line change
@@ -200,8 +200,6 @@ func run() {
x.Check(err)

raft := x.NewSuperFlag(Zero.Conf.GetString("raft")).MergeAndCheckDefault(raftDefault)

x.CheckFlag(Zero.Conf.GetString("audit"), "dir", "compress", "encrypt-file")
conf, err := audit.GetAuditConf(Zero.Conf.GetString("audit"))
x.Check(err)
opts = options{
18 changes: 10 additions & 8 deletions ee/audit/audit_ee.go
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ import (
)

const (
defaultAuditConf = "dir=;compress=false;encrypt-file="
defaultAuditFilename = "dgraph_audit.log"
)

@@ -65,23 +66,24 @@ func GetAuditConf(conf string) (*AuditConf, error) {
if conf == "" {
return nil, nil
}
encBytes, err := readAuditEncKey(conf)
if err != nil {
return nil, err
}
dir := x.GetFlagString(conf, "dir")
auditFlag := x.NewSuperFlag(conf).MergeAndCheckDefault(defaultAuditConf)
dir := auditFlag.GetString("dir")
if dir == "" {
return nil, fmt.Errorf("dir flag is not provided for the audit logs")
}
encBytes, err := readAuditEncKey(auditFlag)
if err != nil {
return nil, err
}
return &AuditConf{
Compress: x.GetFlagBool(conf, "compress"),
Compress: auditFlag.GetBool("compress"),
Dir: dir,
EncryptBytes: encBytes,
}, nil
}

func readAuditEncKey(conf string) ([]byte, error) {
encFile := x.GetFlagString(conf, "encrypt-file")
func readAuditEncKey(conf *x.SuperFlag) ([]byte, error) {
encFile := conf.GetString("encrypt-file")
if encFile == "" {
return nil, nil
}
5 changes: 2 additions & 3 deletions x/flags.go
Original file line number Diff line number Diff line change
@@ -146,7 +146,6 @@ func (sf *SuperFlag) GetUint32(opt string) uint32 {
Checkf(err, "Unable to parse %s as uint32 for key: %s. Options: %s\n", val, opt, sf)
return uint32(u)
}
func GetFlagString(opt, key string) string {
val := GetFlag(opt, key)
return val
func (sf *SuperFlag) GetString(opt string) string {
return sf.Get(opt)
}