mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-10 13:34:16 +00:00
* chore(db providers): db providers first version * chore(db provider): added db provider setup into Readme * fix(csv_line): csv_line out of conditional * fix(README): text instead of varchar in table * fix(help): help message extended Co-authored-by: Sergio Garcia <38561120+sergargar@users.noreply.github.com> * fix(typo): Update README.md Co-authored-by: Pepe Fagoaga <pepe@verica.io> * fix(table): add if not exists Co-authored-by: Pepe Fagoaga <pepe@verica.io> * fix(typo): Readme postgreSQL Co-authored-by: Pepe Fagoaga <pepe@verica.io> * fix(db_connector): details to add a new provider * fix(typo): Uppercase Prowler Co-authored-by: Toni de la Fuente <toni@blyx.com> * fix(prowler): deleted unused variable * chore(checks): test db connector previous to send data * chore(input tests): input tests moved to main * fix(typo): Readme typos * chore(table): table name from pgpass file * fix(grep test): Added missing -E flag * chore(table): check of table name and Readme * chore(error colors): Added error colors * chore(inputcheck): checks about mode and output inputs into main * fix(inputs) custom output file name * fix(outputs): comment profile * chore(textXXX): both 3 textfunctions using general * fix(allowlist): allowlist check included as function * fix(headers): Add headers to certain output files * fix(reformulate): change structure and delete comments * fix(testing): Input test after load includes * fix(variables): Added named vars * fix(colors): Deleted unused colors * fix(outputs): fine tuning * fix(outputs): allowlist parameters read * fix(allowlist): allowlist logic reformulated * fix(REPREGION): REPREGION change by REGION_FROM_CHECK Co-authored-by: Sergio Garcia <38561120+sergargar@users.noreply.github.com> Co-authored-by: Pepe Fagoaga <pepe@verica.io> Co-authored-by: Toni de la Fuente <toni@blyx.com>
40 lines
1.4 KiB
Bash
Executable File
40 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Prowler - the handy cloud security tool (copyright 2018) by Toni de la Fuente
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
# use this file except in compliance with the License. You may obtain a copy
|
|
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software distributed
|
|
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations under the License.
|
|
|
|
# DB connectors
|
|
# Supported connectors list is stored in SUPPORTED_DB_PROVIDERS
|
|
# Once the logic of the connector is added it is needed to add it to the list also
|
|
# Example: adding oracle to the list
|
|
# SUPPORTED_DB_PROVIDERS="postgresql|oracle"
|
|
# oracle_connector() { ... }
|
|
|
|
SUPPORTED_DB_PROVIDERS="postgresql"
|
|
export SUPPORTED_DB_PROVIDERS
|
|
|
|
# Connectors for different databases
|
|
|
|
#POSTGRESQL connector
|
|
postgresql_connector () {
|
|
|
|
CSV_REGISTRY="${1}"
|
|
psql -q -U "${PSQL_USER}" -h "${PSQL_HOSTNAME}" -c "copy ${PSQL_TABLE} from stdin with null as E'\'\'' delimiter ','" <<< "${CSV_REGISTRY}"
|
|
}
|
|
|
|
db_exit_abnormally() {
|
|
DB_PROVIDER="${1}"
|
|
MESSAGE=${2}
|
|
|
|
echo "${OPTRED}ERROR!$OPTNORMAL Database connector for '${DB_PROVIDER}' failed. ${MESSAGE}"
|
|
exit 2
|
|
}
|