-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance configuration management and reporting features
- Added handling to run each features using flags - Added handling for create ssl report for postgres - Added handling New Labels in PII scanner - Improved logic for custom time range for logparser - custom config path support added - json output format for output file for all features - improved HTML structure for all reports - Added support for JSON output in various report generation functions. - Updated .gitignore to include new report formats and configuration files. - Improved error handling and logging in database connection functions. - Updated dependencies in go.mod for better compatibility. These changes aim to improve the overall functionality and usability of the configuration management and reporting tools.
- Loading branch information
1 parent
de1fbca
commit 61d34cd
Showing
81 changed files
with
3,849 additions
and
572 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/klouddb/klouddbshield/htmlreport" | ||
"github.com/klouddb/klouddbshield/postgresconfig" | ||
) | ||
|
||
type compareConfigRunner struct { | ||
baseServer string | ||
connectionStrings []string | ||
htmlReportHelper *htmlreport.HtmlReportHelper | ||
} | ||
|
||
func newCompareConfigRunner(baseServer string, connectionStrings []string, htmlReportHelper *htmlreport.HtmlReportHelper) *compareConfigRunner { | ||
return &compareConfigRunner{ | ||
baseServer: baseServer, | ||
connectionStrings: connectionStrings, | ||
htmlReportHelper: htmlReportHelper, | ||
} | ||
} | ||
|
||
func (c *compareConfigRunner) cronProcess(ctx context.Context) error { | ||
return c.run(ctx) | ||
} | ||
|
||
func (c *compareConfigRunner) run(_ context.Context) error { | ||
|
||
connectionStrings := c.connectionStrings | ||
if c.baseServer != "" { | ||
connectionStrings = append([]string{c.baseServer}, c.connectionStrings...) | ||
} | ||
|
||
result, err := postgresconfig.GetAllConfigValues(connectionStrings) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
var one2oneComparison *postgresconfig.ConfigCompareOne2OneResult | ||
if c.baseServer != "" { | ||
one2oneComparison = postgresconfig.CompareAllServersWithBase(result) | ||
} | ||
|
||
configCompareResult := &postgresconfig.ConfigCompareResult{ | ||
One2OneComparison: one2oneComparison, | ||
} | ||
|
||
c.htmlReportHelper.RegisterCompareConfig(configCompareResult) | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/klouddb/klouddbshield/htmlreport" | ||
"github.com/klouddb/klouddbshield/pkg/postgresdb" | ||
"github.com/klouddb/klouddbshield/postgres" | ||
"github.com/klouddb/klouddbshield/postgres/configaudit" | ||
) | ||
|
||
type configAuditor struct { | ||
postgresConfig *postgresdb.Postgres | ||
htmlReportHelper *htmlreport.HtmlReportHelper | ||
} | ||
|
||
func newConfigAuditor(postgresConfig *postgresdb.Postgres, htmlReportHelper *htmlreport.HtmlReportHelper) *configAuditor { | ||
return &configAuditor{ | ||
postgresConfig: postgresConfig, | ||
htmlReportHelper: htmlReportHelper, | ||
} | ||
} | ||
|
||
func (h *configAuditor) cronProcess(ctx context.Context) error { | ||
return h.run(ctx) | ||
} | ||
|
||
func (h *configAuditor) run(ctx context.Context) error { | ||
postgresStore, _, err := postgresdb.Open(*h.postgresConfig) | ||
if err != nil { | ||
return err | ||
} | ||
defer postgresStore.Close() | ||
|
||
result, err := configaudit.AuditConfig(ctx, postgresStore) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
h.htmlReportHelper.RegisterConfigAudit(result) | ||
|
||
postgres.PrintConfigAuditSummary(result) | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.