Server IP : 127.0.0.2 / Your IP : 18.222.84.251 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/apport/package-hooks/ |
Upload File : |
'''apport package hook for mysql-5.7 (c) 2009 Canonical Ltd. Author: Mathias Gug <mathias.gug@canonical.com> ''' from __future__ import print_function, unicode_literals import os, os.path from apport.hookutils import * def _add_my_conf_files(report, filename): key = 'MySQLConf' + path_to_key(filename) report[key] = "" for line in read_file(filename).split('\n'): try: if 'password' in line.split('=')[0]: line = "%s = @@APPORTREPLACED@@" % (line.split('=')[0]) report[key] += line + '\n' except IndexError: continue ''' Mitigation for upstream bug that can lead to statements containing passwords being written to error log We strip out any lines containing terms listed on http://dev.mysql.com/doc/refman/5.7/en/password-logging.html (LP: #1574458) ''' def strip_protected(line): protected_terms = ['grant', 'alter user', 'create user', 'set password', 'create server', 'alter server'] for term in protected_terms: if term in line: return '--- Line containing protected term %s stripped from log by apport hook. Ref. Launchpad bug #1574458' % term return line def add_info(report): attach_conffiles(report, 'mysql-server-5.7', conffiles=None) key = 'Logs' + path_to_key('/var/log/daemon.log') report[key] = "" for line in read_file('/var/log/daemon.log').split('\n'): try: if 'mysqld' in line.split()[4]: report[key] += line + '\n' except IndexError: continue if os.path.exists('/var/log/mysql/error.log'): key = 'Logs' + path_to_key('/var/log/mysql/error.log') report[key] = "" for line in read_file('/var/log/mysql/error.log').split('\n'): line = strip_protected(line) report[key] += line + '\n' attach_mac_events(report, '/usr/sbin/mysqld') attach_file(report,'/etc/apparmor.d/usr.sbin.mysqld') _add_my_conf_files(report, '/etc/mysql/my.cnf') _add_my_conf_files(report, '/etc/mysql/mysql.cnf') for d in ['/etc/mysql/conf.d', '/etc/mysql/mysql.conf.d']: for f in os.listdir(d): _add_my_conf_files(report, os.path.join(d, f)) try: report['MySQLVarLibDirListing'] = str(os.listdir('/var/lib/mysql')) except OSError: report['MySQLVarLibDirListing'] = str(False) if __name__ == '__main__': report = {} add_info(report) for key in report: print('%s: %s' % (key, report[key].split('\n', 1)[0]))