def install_rsyslogd(args): ''' Install rsyslogd on the server. ''' app.print_verbose("Install rsyslogd.") version_obj = version.Version("InstallRsyslogd", SCRIPT_VERSION) version_obj.check_executed() # Initialize all passwords used by the script app.init_mysql_passwords() # Setup syco dependencies. if not os.path.exists('/etc/init.d/mysqld'): install_mysql(["","1","1G"]) # Installing packages x("yum install rsyslog rsyslog-gnutls rsyslog-mysql gnutls-utils -y") # Autostart rsyslog at boot x("chkconfig rsyslog on") # Generation new certs if no certs exsists if not os.path.exists('/etc/pki/rsyslog/ca.crt'): rsyslog_newcerts(args) sql_password = generate_password(20, string.letters + string.digits) _setup_database(sql_password) _setup_rsyslogd(sql_password) # Add iptables chains iptables.add_rsyslog_chain("server") iptables.save() # Restarting service x("/etc/init.d/rsyslog restart") install_purge_db() install_compress_logs() # Configure logrotate installLogrotate.install_logrotate(args) version_obj.mark_executed()
def install_rsyslogd(args): ''' Install rsyslogd on the server. ''' app.print_verbose("Install rsyslogd.") version_obj = version.Version("InstallRsyslogd", SCRIPT_VERSION) version_obj.check_executed() # Initialize all passwords used by the script app.init_mysql_passwords() # Setup syco dependencies. if not os.path.exists('/etc/init.d/mysqld'): install_mysql(["", "1", "1G"]) # Installing packages x("yum install rsyslog rsyslog-gnutls rsyslog-mysql gnutls-utils -y") # Autostart rsyslog at boot x("chkconfig rsyslog on") # Generation new certs if no certs exsists if not os.path.exists('/etc/pki/rsyslog/ca.crt'): rsyslog_newcerts(args) sql_password = generate_password(20, string.letters + string.digits) _setup_database(sql_password) _setup_rsyslogd(sql_password) # Add iptables chains iptables.add_rsyslog_chain("server") iptables.save() # Restarting service x("/etc/init.d/rsyslog restart") install_purge_db() install_compress_logs() # Configure logrotate installLogrotate.install_logrotate(args) version_obj.mark_executed()
def _setup_icinga_mysql(): ''' Set up a mysql database for icinga ''' # Create and configure. Install hardened MySQL if needed. if not os.path.exists('/etc/init.d/mysqld'): install_mysql(["","1","1G"]) sqlpassword = generate_password(40,chars=string.letters+string.digits) # Create MySQL icinga user mysqlUtils.drop_user('icinga') mysqlUtils.create_user('icinga', sqlpassword, 'icinga') # Create MySQL database schema for icinga. x("mysql --user='******' --password='******' -e 'CREATE DATABASE icinga'".format("icinga",re.escape(sqlpassword))) x("mysql icinga --user='******' --password='******' < /usr/share/doc/icinga-idoutils-libdbi-mysql-{2}/db/mysql/mysql.sql".format("icinga",re.escape(sqlpassword), _get_icinga_version())) return sqlpassword
def _setup_icinga_mysql(): ''' Set up a mysql database for icinga ''' # Create and configure. Install hardened MySQL if needed. if not os.path.exists('/etc/init.d/mysqld'): install_mysql(["", "1", "1G"]) sqlpassword = generate_password(40, chars=string.letters + string.digits) # Create MySQL icinga user mysqlUtils.drop_user('icinga') mysqlUtils.create_user('icinga', sqlpassword, 'icinga') # Create MySQL database schema for icinga. x("mysql --user='******' --password='******' -e 'CREATE DATABASE icinga'".format( "icinga", re.escape(sqlpassword))) x("mysql icinga --user='******' --password='******' < /usr/share/doc/icinga-idoutils-libdbi-mysql-{2}/db/mysql/mysql.sql" .format("icinga", re.escape(sqlpassword), _get_icinga_version())) return sqlpassword