
Questa cookbook di chef fornisce la configurazione di sicurezza per mysql.
Fornisce configurazioni di sicurezza per mysql. È pensato per configurare istanze mysql pronte per la produzione, configurate con una superficie minima per gli attaccanti.
Questo cookbook si concentra sulla configurazione di sicurezza di mysql e riutilizza il mysql cookbook per l'installazione. Pertanto puoi aggiungere questo livello di hardening sopra la tua configurazione mysql esistente in Chef.
Abbiamo ottimizzato questo cookbook per funzionare senza problemi con e . Funzionerà bene anche senza, ma devi assicurarti che tutte le precondizioni come o siano soddisfatte.
apt-get updateyum updateUn ruolo di esempio potrebbe essere:
{
"name": "mysql",
"default_attributes": { },
"override_attributes": { },
"json_class": "Chef::Role",
"description": "MySql Hardened Server Test Role",
"chef_type": "role",
"default_attributes" : {
"mysql": {
"server_root_password": "iloverandompasswordsbutthiswilldo",
"server_debian_password": "iloverandompasswordsbutthiswilldo"
}
},
"run_list": [
"recipe[chef-solo-search]",
"recipe[apt]",
"recipe[mysql::server]",
"recipe[mysql-hardening]"
]
}
Questa recipe è una recipe di sovrapposizione per il mysql cookbook) e applica mysql-hardening::hardening
Aggiungi quanto segue alla tua runlist e personalizza gli attributi delle opzioni di sicurezza
"recipe[mysql::server]",
"recipe[mysql-hardening]"
Questa recipe di hardening installa l'hardening ma si aspetta un'installazione esistente di Mysql, MariaDB o Percona. Se non stai usando il mysql cookbook, potresti dover adattare gli attributi:
node['mysql']['service_name'] = 'default'node['mysql']['data_dir'] = '/var/lib/mysql'node['mysql-hardening']['conf-file'] = '/etc/mysql/conf.d/hardening.cnf'node['mysql-hardening']['user'] = 'mysql'Ulteriori informazioni sono già disponibili presso Deutsche Telekom (tedesco) e Symantec
Questa configurazione imposta i seguenti parametri per impostazione predefinita
user = mysql
port = 3306
bind-address = X.Y.Z.W
# via ['mysql']['security']['local_infile']
local-infile = 0
# via ['mysql']['security']['safe_user_create']
safe-user-create = 1
# via ['mysql']['security']['secure_auth']
secure-auth = 1
# via ['mysql']['security']['skip_show_database']
skip-show-database
# via ['mysql']['security']['skip_symbolic_links']
skip-symbolic-links
# via ['mysql']['security']['automatic_sp_privileges']
automatic_sp_privileges = 0
# via ['mysql']['security']['secure-file-priv']
secure-file-priv = /tmp
Inoltre garantisce che i seguenti parametri non siano impostati
['mysql']['security']['secure_auth']node['mysql']['security']['allow-suspicious-udfs']Inoltre i permessi di /var/lib/mysql sono limitati all'utente mysql.
# Install dependencies
gem install bundler
bundle install
# Do lint checks
bundle exec rake lint
# Fetch tests
git clone https://github.com/dev-sec/tests-mysql-hardening test/integration
# fast test on one machine
bundle exec kitchen test default-ubuntu-1204
# test on all machines
bundle exec kitchen test
# for development
bundle exec kitchen create default-ubuntu-1204
bundle exec kitchen converge default-ubuntu-1204
Questo cookbook viene fornito con un file guard per facilitare lo sviluppo. Durante lo sviluppo guard controlla le cartelle ed esegue footcritic e robocop.
# list all plugins
bundle exec guard list
# run guard with foodcritic and robocop
bundle exec guard -P Foodcritic Rubocop
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.