Skip to content

Commit

Permalink
RDS changes.
Browse files Browse the repository at this point in the history
    - print sourcetype is report
    - fix checking for sourcetype
    - print output as table
    - add and fix 4.4.0
    - fix all test cases
    - fix test cases
    - fix 4.3.0 failures for empty category list
    - fix 4.2.0
    - fix parsing sourceIDlist
    - fix test cases as manual
    - make manual as fail
  • Loading branch information
klouddbdev committed Aug 28, 2023
1 parent e3d3a8d commit 90f256a
Show file tree
Hide file tree
Showing 22 changed files with 2,581 additions and 325 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dist
### Go Patch ###
/vendor/
/Godeps/
/linux/
config.toml
/ciscollector
# End of https://www.toptal.com/developers/gitignore/api/go
Expand Down
37 changes: 19 additions & 18 deletions cmd/ciscollector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func main() {
ctx := context.Background()
if cnf.App.VerbosePostgres {
runPostgresByControl(ctx, cnf)

return
}
if cnf.App.RunMySql {
runMySql(ctx, cnf)
Expand Down Expand Up @@ -166,14 +166,7 @@ func runPostgres(ctx context.Context, cnf *config.Config) []*model.Result {
fmt.Println("**********listOfResults*************\n", data)
}
fmt.Println("postgressecreport.html file generated")
// data = htmlreport.GenerateMarkdown(listOfResults)
// htmldata = []byte(data)
// err = os.WriteFile("postgressecreport.md", htmldata, 0600)
// if err != nil {
// log.Error().Err(err).Msg("Unable to generate postgressecreport.md file: " + err.Error())
// fmt.Println("**********listOfResults*************\n", data)
// }
// fmt.Println("postgressecreport.md file generated")

return listOfResults

}
Expand All @@ -183,21 +176,29 @@ func runRDS(ctx context.Context, cnf *config.Config) {
rds.Validate()
listOfResults := rds.PerformAllChecks(ctx)

jsonData, err := json.MarshalIndent(listOfResults, "", " ")
if err != nil {
fmt.Println("error marshaling list of results", err)
return
}
tableData := rds.ConvertToMainTable(listOfResults)
output := strings.ReplaceAll(string(tableData), `\n`, "\n")

fmt.Println("\n\n\nfor detailed information check the generated output file rdssecreport.json\n")
fmt.Println(output)

output := strings.ReplaceAll(string(jsonData), `\n`, "\n")
tableData = rds.ConvertToTable(listOfResults)

// jsonData, err := json.MarshalIndent(listOfResults, "", " ")
// if err != nil {
// fmt.Println("error marshaling list of results", err)
// return
// }

output = strings.ReplaceAll(string(tableData), `\n`, "\n")

// write output data to file
err = os.WriteFile("rdssecreport.json", []byte(output), 0600)
err := os.WriteFile("rdssecreport.json", []byte(output), 0600)
if err != nil {
log.Error().Err(err).Msg("Unable to generate rdssecreport.json file: " + err.Error())
fmt.Println("**********listOfResults*************\n", string(jsonData))
fmt.Println("**********listOfResults*************\n", string(tableData))
}
fmt.Println("rdssecreport.json file generated")
fmt.Println("rdssecreport.json file generated\n\n")
}
func runHBAScanner(ctx context.Context, cnf *config.Config) []*model.HBAScannerResult {
postgresDatabase := cnf.Postgres
Expand Down
15 changes: 7 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@ go 1.18

require (
github.com/go-sql-driver/mysql v1.7.0
github.com/hashicorp/go-version v1.6.0
github.com/jedib0t/go-pretty v4.3.0+incompatible
github.com/rs/zerolog v1.29.0
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.8.1
go.uber.org/mock v0.2.0
golang.org/x/net v0.8.0
)

require (
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-openapi/errors v0.20.2 // indirect
github.com/go-openapi/strfmt v0.21.3 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/go-openapi/errors v0.20.3 // indirect
github.com/go-openapi/strfmt v0.21.7 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
go.mongodb.org/mongo-driver v1.10.0 // indirect
go.mongodb.org/mongo-driver v1.11.3 // indirect
)

require (
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jedib0t/go-pretty v4.3.0+incompatible
github.com/jedib0t/go-pretty/v6 v6.4.6
github.com/lib/pq v1.10.7
github.com/magiconair/properties v1.8.7 // indirect
Expand Down
27 changes: 14 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg=
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
Expand All @@ -65,10 +65,10 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-openapi/errors v0.20.2 h1:dxy7PGTqEh94zj2E3h1cUmQQWiM1+aeCROfAr02EmK8=
github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M=
github.com/go-openapi/strfmt v0.21.3 h1:xwhj5X6CjXEZZHMWy1zKJxvW9AfHC9pkyUjLvHtKG7o=
github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg=
github.com/go-openapi/errors v0.20.3 h1:rz6kiC84sqNQoqrtulzaL/VERgkoCyB6WdEkc2ujzUc=
github.com/go-openapi/errors v0.20.3/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk=
github.com/go-openapi/strfmt v0.21.7 h1:rspiXgNWgeUzhjo1YU01do6qsahtJNByjLVbPLNHb8k=
github.com/go-openapi/strfmt v0.21.7/go.mod h1:adeGTkxE44sPyLk0JV235VQAO/ZXUr8KAzYjclFs3ew=
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
Expand Down Expand Up @@ -124,12 +124,13 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
Expand Down Expand Up @@ -161,7 +162,6 @@ github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
Expand Down Expand Up @@ -205,8 +205,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.4/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
Expand All @@ -219,14 +219,16 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.mongodb.org/mongo-driver v1.10.0 h1:UtV6N5k14upNp4LTduX0QCufG124fSu25Wz9tu94GLg=
go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8=
go.mongodb.org/mongo-driver v1.11.3 h1:Ql6K6qYHEzB6xvu4+AU0BoRoqf9vFPcc4o7MUIdPW8Y=
go.mongodb.org/mongo-driver v1.11.3/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU=
go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down Expand Up @@ -525,7 +527,6 @@ gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
Binary file removed linux/ciscollector
Binary file not shown.
36 changes: 27 additions & 9 deletions model/result.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
package model

import "database/sql"
import (
"database/sql"
"fmt"
)

type CaseResult struct {
Name string
Reason string
Status string
}

func NewCaseResult(name string) *CaseResult {
return &CaseResult{
Name: name,
Status: "Fail",
Reason: fmt.Sprintf("no subscription found for %s", name),
}
}

type Result struct {
FailReason interface{} `json:"FailReason,omitempty"`
Status string
Description string `json:"-"`
Control string
Title string
Rationale string `json:"-"`
References string `json:"-"`
Procedure string `json:"-"`
FailReason interface{} `json:"FailReason,omitempty"`
Status string
Description string `json:"-"`
Control string
Title string
Rationale string `json:"-"`
References string `json:"-"`
Procedure string `json:"-"`
CaseFailReason map[string]*CaseResult
}
type Config struct {
store *sql.DB
Expand Down
12 changes: 7 additions & 5 deletions rds/2.3.1.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

const Pass = "Pass"
const Fail = "Fail"
const Manual = "Manual"

func ExecutePerDB(ctx context.Context, args ...interface{}) error {

Expand All @@ -25,7 +26,7 @@ func ExecutePerDB(ctx context.Context, args ...interface{}) error {
return nil
}

dbFunc, ok := args[0].(func(context.Context, string, *tablePrinter) *model.Result)
dbFunc, ok := args[0].(func(context.Context, string, *rdsInstancePrinter) *model.Result)
if !ok {
log.Println("first argument cant be parsed to dbStatus func")
return nil
Expand All @@ -36,7 +37,7 @@ func ExecutePerDB(ctx context.Context, args ...interface{}) error {
log.Println("second argument cant be parsed to string")
return nil
}
printer, ok := args[2].(*tablePrinter)
printer, ok := args[2].(*rdsInstancePrinter)
if !ok {
log.Println("third argument cant be parsed to table printer")
return nil
Expand Down Expand Up @@ -69,15 +70,16 @@ func Execute231(ctx context.Context) (result *model.Result) {
result = &model.Result{}
}
result.Control = "2.3.1"
result.Description = "Ensure that encryption is enabled for RDS instances"
result.Title = "Ensure that encryption is enabled for RDS instances"

result = fixFailReason(result)
}()

result, dbMap, err := GetDBMap(ctx)
if err != nil {
return result
}
printer := NewTablePrinter()
printer := NewRDSInstancePrinter()
mutex := &sync.Mutex{}
gp := NewGoPool(ctx)

Expand Down Expand Up @@ -110,7 +112,7 @@ func GetEncryptionStatusOfDB2(ctx context.Context) *model.Result {
return nil
}

func GetEncryptionStatusOfDB(ctx context.Context, dbName string, printer *tablePrinter) *model.Result {
func GetEncryptionStatusOfDB(ctx context.Context, dbName string, printer *rdsInstancePrinter) *model.Result {
result, cmdOutput, err := ExecRdsCommand(ctx, fmt.Sprintf(`aws rds describe-db-instances --db-instance-identifier "%s" --query 'DBInstances[*].StorageEncrypted'`, dbName))
if err != nil {
result.Status = Fail
Expand Down
6 changes: 3 additions & 3 deletions rds/2.3.2.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ func Execute232(ctx context.Context) (result *model.Result) {
result = &model.Result{}
}
result.Control = "2.3.2"
result.Description = "Ensure that auto minor version upgrade is enabled for RDS instances"
result.Title = "Ensure that auto minor version upgrade is enabled for RDS instances"
result = fixFailReason(result)
}()

result, dbMap, err := GetDBMap(ctx)
if err != nil {
return result
}
printer := NewTablePrinter()
printer := NewRDSInstancePrinter()
mutex := &sync.Mutex{}
gp := NewGoPool(ctx)

Expand All @@ -51,7 +51,7 @@ func Execute232(ctx context.Context) (result *model.Result) {

}

func GetAutoMinorVersionOfDB(ctx context.Context, dbName string, printer *tablePrinter) *model.Result {
func GetAutoMinorVersionOfDB(ctx context.Context, dbName string, printer *rdsInstancePrinter) *model.Result {
result, cmdOutput, err := ExecRdsCommand(ctx, fmt.Sprintf(`aws rds describe-db-instances --db-instance-identifier "%s" --query 'DBInstances[*].AutoMinorVersionUpgrade'`, dbName))
if err != nil {
result.Status = Fail
Expand Down
6 changes: 3 additions & 3 deletions rds/2.3.3.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ func Execute233(ctx context.Context) (result *model.Result) {
result = &model.Result{}
}
result.Control = "2.3.3"
result.Description = "Ensure that public address is not given to RDS instance"
result.Title = "Ensure that public address is not given to RDS instance"
result = fixFailReason(result)
}()

result, dbMap, err := GetDBMap(ctx)
if err != nil {
return result
}
printer := NewTablePrinter()
printer := NewRDSInstancePrinter()
mutex := &sync.Mutex{}
gp := NewGoPool(ctx)

Expand All @@ -51,7 +51,7 @@ func Execute233(ctx context.Context) (result *model.Result) {

}

func GetPublicAccessStatusOfDB(ctx context.Context, dbName string, printer *tablePrinter) *model.Result {
func GetPublicAccessStatusOfDB(ctx context.Context, dbName string, printer *rdsInstancePrinter) *model.Result {
result, cmdOutput, err := ExecRdsCommand(ctx, fmt.Sprintf(`aws rds describe-db-instances --db-instance-identifier "%s" --query 'DBInstances[*].PubliclyAccessible'`, dbName))
if err != nil {
result.Status = Fail
Expand Down
4 changes: 2 additions & 2 deletions rds/3.5.0.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Execute350(ctx context.Context) (result *model.Result) {
result = &model.Result{}
}
result.Control = "3.5.0"
result.Description = "Multi-AZ check"
result.Title = "Multi-AZ check"
result = fixFailReason(result)
}()

Expand All @@ -38,7 +38,7 @@ func Execute350(ctx context.Context) (result *model.Result) {
result.FailReason = fmt.Errorf("error un marshalling %s", err)
return
}
printer := NewTablePrinter()
printer := NewRDSInstancePrinter()

for _, multiAZDB := range arrayOfDataBases {

Expand Down
4 changes: 2 additions & 2 deletions rds/3.8.0.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Execute380(ctx context.Context) (result *model.Result) {
result = &model.Result{}
}
result.Control = "3.8.0"
result.Description = "Ensure Relational Database Service backup retention policy is set"
result.Title = "Ensure Relational Database Service backup retention policy is set"
result = fixFailReason(result)
}()

Expand All @@ -38,7 +38,7 @@ func Execute380(ctx context.Context) (result *model.Result) {
result.FailReason = fmt.Errorf("error un marshalling cmdOutput.StdOut: %s, error :%s", cmdOutput.StdOut, err)
return
}
printer := NewTablePrinter()
printer := NewRDSInstancePrinter()
for _, multiAZDB := range backupRetentionValues {

if multiAZDB.BackupRetentionPeriod < 7 {
Expand Down
Loading

0 comments on commit 90f256a

Please sign in to comment.