ã³ã³ãœãŒã«ç®¡çãŠãŒã¶ãŒmcshadow
mcshadowïŒã$ mysql --user = mcshadow --password = mike mysql> select current_userïŒïŒ; + ---------------- + | current_userïŒïŒ| + ---------------- + | mike @ localhost | + ---------------- + mcshadowïŒã$ mysql --user = mcshadow --password = root mysql> select current_userïŒïŒ; + ---------------- + | current_userïŒïŒ| + ---------------- + | root @ localhost | + ---------------- +
ã¢ã¯ã»ã¹ã¯ãrootæš©éãšäžè¬ãŠãŒã¶ãŒmikeã®æš©éã®äž¡æ¹ã§å¯èœã§ãã
ãã€ã¯ã¢ãŒã¿ã«ã³ã³ãœãŒã«
ãã€ã¯ïŒã$ mysql --user = mcshadow --password = mike ãšã©ãŒ1698ïŒ28000ïŒïŒãŠãŒã¶ãŒ 'mcshadow' @ 'localhost'ã®ã¢ã¯ã»ã¹ãæåŠãããŸãã
管çè ã®äžã§ããŒã¿ããŒã¹ã«ã¢ã¯ã»ã¹ããããšã¯ã§ããŸããã
äžæ¹ãsyslogã§
mysqldïŒãŠãŒã¶ãŒïŒmcshadow TRYã¢ã¯ã»ã¹ïŒlocalhostæš©éïŒmike
mysqldïŒãŠãŒã¶ãŒïŒmcshadow SUCCESSã¢ã¯ã»ã¹ïŒlocalhostæš©éïŒmike
mysqlïŒSYSTEM_USERïŒ 'mcshadow'ãMYSQL_USERïŒ 'mcshadow'ãCONNECTION_IDïŒ5ãDB_SERVERïŒ '-'ãDBïŒ '-'ãCOMMAND_RESULTïŒSUCCESSãQUERYïŒ 'select current_userïŒïŒ;'
mysqldïŒãŠãŒã¶ãŒïŒmcshadow TRYã¢ã¯ã»ã¹ïŒlocalhostïŒç¹æš©ïŒroot
mysqldïŒãŠãŒã¶ãŒïŒmcshadow SUCCESSã¢ã¯ã»ã¹ïŒlocalhostæš©éïŒroot
mysqlïŒSYSTEM_USERïŒ 'mcshadow'ãMYSQL_USERïŒ 'mcshadow'ãCONNECTION_IDïŒ6ãDB_SERVERïŒ '-'ãDBïŒ '-'ãCOMMAND_RESULTïŒSUCCESSãQUERYïŒ 'select current_userïŒïŒ;'
mysqldïŒãŠãŒã¶ãŒïŒmcshadow TRYã¢ã¯ã»ã¹ïŒlocalhostæš©éïŒmike
mysqldïŒãŠãŒã¶ãŒïŒmcshadowããã®ã¢ã¯ã»ã¹ã«å€±æããŸããïŒlocalhost withæš©éïŒmike
ã¯ããã«
ãã®æçš¿ã¯æ¬åœã«å¿ èŠãªäººã«ãå§ãã§ãããä»æ¥ã¯ç°¡åã«ãªããŸãããšãããã¬ãŒãºããããŸããããèšäºã®å·çã®çµããã«ãããŸããããªãã£ãããšã«æ°ä»ããŸããã
MySQLã倧äŒæ¥ã§DBMSãšããŠäœ¿çšããå Žåã次ã®ãããªåé¡ãçºçããŸããMySQLã«ã¯ãŠãŒã¶ãŒå®çŸ©ã®ãã¹ã¯ãŒãããªã·ãŒããããŸããã 䜿çšãããã¹ã¯ãŒãã®æå¹æéåãã®ããªãããŒãªã¹ããŒã ãèšå®ããããçµç¹ã§æ¡çšãããŠããæšæºãæºããããã«æ°ãããã¹ã¯ãŒããå¶åŸ¡ããããSSOã·ã¹ãã ã䜿çšããŠããŒã¿ããŒã¹ã«æ¥ç¶ãããããããšã¯ã§ããŸããã ãŸããããŒã¿ããŒã¹ãžã®æ¥ç¶ã®æåããã³å€±æã®ãã¹ãŠã®è©Šè¡ãšãã»ãã¥ãªãã£æ åœè ã®ã³ã³ãœãŒã«ã«å¯ŸããDBAæš©éãæã€ãŠãŒã¶ãŒã®ã¢ã¯ã·ã§ã³ãèšé²ãããšéåžžã«äŸ¿å©ã§ãã ããã«å ããŠããã°ã€ã³ã®äžã§ããŒã¿ããŒã¹ã«ã¢ã¯ã»ã¹ãããããšããããããŸãããããšãã°ãã€ã³ã¹ããŒã«ãå®è¡ãããããšã©ãŒãååŸããç¹å®ã®ã¢ã¯ã·ã§ã³ãå®è¡ãããããããã«ãå¥ã®ãŠãŒã¶ãŒã®æš©éãå¿ èŠã§ãã ããã«ããã®ãŠãŒã¶ãŒã®ãã¹ã¯ãŒããç¥ããªãããšãããã³ãã¹ãŠã®ã¢ã¯ã·ã§ã³ãã»ãã¥ãªãã£ãã°ã«æ£ããåæ ãããããšã確èªããããšããå§ãããŸãã ä»ã®ããŒã¿ããŒã¹ã§ã¯ããã¡ãããã¹ãŠã§ã¯ãªãããããã®ã¢ã€ãã ã®äžéšãäœæã§ããŸãã ããŒãžã§ã³5.5.7以éã®MySQLã§ã¯ãããŒã¿ããŒã¹ã«äžèŠãªè² è·ããããããšãªãããããã®ãããããå®è¡ã§ããŸãã
ãã®èšäºã¯æ¬è³ªçã«æè²çãªãã®ã§ããã説æãããã®ãå«ããããããç®çã§ãããã®ãœãªã¥ãŒã·ã§ã³ã䜿çšããããšã¯ãããªãã®è¯å¿ã®ã¿ã«åºã¥ããŠããŸãã
çè«
次ã«ãäœãã©ãã§å ¥æãããã«ã€ããŠè©±ããŸãããã ãåç¥ã®ããã«ããããæ©èœããããã«ã¯ãå€éšã©ã€ãã©ãªãæ§ç¯ããå¿ èŠããããŸãã ããŠããçµéšã®ãããå¿åè ãšããŠãç§ãã¡ã¯èªåã§äœãæžãããšã¯ãããŸãããå®æãããã®ãåãããããœãŒã¹ããå¥ã®ãœãŒã¹ã«åçŽã«è»¢éããŸãã
ãŸããperkonaããMySQLã¯ã©ã€ã¢ã³ãã®ãã®ã³ã°ãååŸããŸãã MySQL 5.5.XãšPercona 5.5.Xã®ãœãŒã¹ãæ¯èŒãããšãPerkonã¯ã©ã€ã¢ã³ãããã¹ãŠãsyslogã«èšé²ã§ãããšããäºå®ã ããéããŸããããªãã·ã§ã³ã§ãããè¡ããŸãã å®éããããã®ãœãŒã¹ã³ãŒãã®äžéšããã©ãã°ããã ãã§ãã ãããããã©ã«ãèšå®ã«ããŸãã ã³ããŒãšè²Œãä»ããå°ç¡ãã«ããã®ãæãå Žåã¯ãperkonaã®ãœãŒã¹MySQLã¯ã©ã€ã¢ã³ãã䜿çšã§ããŸãã
2çªç®ïŒç解ããŠããããã«ãããŒã¿ããŒã¹ãžã®å ¥åè©Šè¡ã®ãã°ã¯ãµãŒããŒã§å®è¡ããå¿ èŠããããŸãã ããã§ã¯éžæè¢ãã»ãšãã©ãããŸããã äœããã°ã«èšé²ããå¿ èŠãããããç解ããã«ã¯ã©ãããã°ããã§ããïŒ MySQLãœãŒã¹ã§ã¯ãã¹ãŠãåçŽã§ããlog.ccãã¡ã€ã«ããããŸããããã¯general_logãæ åœããŸã ã ãã®ãã°ã¯ãæåããæ¥ç¶è©Šè¡ãšå€±æããæ¥ç¶è©Šè¡ãå«ããããŒã¿ããŒã¹ã§çºçãããã¹ãŠãæ£åžžã«èšé²ããŸãã ãã¹ãŠããŸããããŸãããåäœã¯éåžžã«é ããªããŸããç£æ¥çšããŒã¿ããŒã¹ã«å«ããªãããšã匷ããå§ãããŸãã ãã®ãã°ã¯ãäœãã©ãã§æ¢ãã¹ãããç解ããããã«å¿ èŠã§ãã çŸæç¹ã§ãã®ãã¡ã€ã«ã«ãããšã general_log_printããã³general_log_writeãã°ãžã®èšé²ãèš±å¯ããå®è£ ã¯2ã€ã ãã§ãã ããã§æ±ããããäœãã©ãã§å€ãããã泚ææ·±ãèŠãªããã°ãªããŸããã
3çªç®ïŒããããç§ãã¡ã«ãšã£ãŠæãèå³æ·±ãã®ã¯ãMySQL 5.5.7 GRANT PROXYã®æ°æ©èœã§ãã
GRANT PROXY ON 'priv_user' @ 'localhost' TO 'real_user' @ 'localhost';
ãããæ©èœããã«ã¯ããŠãŒã¶ãŒreal_userãç¹å¥ãªæ¹æ³ã§äœæããå¿ èŠããããŸã
CREATE USER 'real_user' @ 'localhost' 'auth_plugin_xxx' AS 'auth_string'ã§èå¥ãããŸãã;
ããã§ãreal_userãŠãŒã¶ãŒã«æ¥ç¶ãããšãããã¹ã¯ãŒãã¯ããã¹ã«èªäœã ãã§ãªãããµãŒãããŒãã£ã®ãã©ã°ã€ã³auth_plugin_xxxã«çœ®ãããšãã§ããŸãã ãã®ãã©ã°ã€ã³ãèªåã§äœæã§ããŸããtynt ãéçºè åãã§ãããã¹ããè¡ãç®çã§ãäŸãšããŠãMySQLã¯å®éšçšã®ãã©ã°ã€ã³ããã§ã«ããã€ãäœæããŠããŸãã ç§ãã¡ã¯ããããéã³ã®åºç€ãšããŠåããŸãã ãã®ãã©ã°ã€ã³ãå¿ èŠãªæãéèŠãªããšã¯ãå éšããžãã¯ã«åºã¥ããŠãã»ãã·ã§ã³ã«ç¹æš©ãé©çšããããŠãŒã¶ãŒåãã£ãŒã«ãã眮ãæããããšãã§ããããšã§ãã real_userããªãããŸããŠãŒã¶ãŒãšããŠãããã·æš©éãæã£ãŠããå ŽåãMySQLã¯ãã¹ãŠã®priv_userãŠãŒã¶ãŒæš©éãæ£åžžã«ä»äžããŸãã ãã®ãã©ã°ã€ã³ã§ã¯ãå éšãããã³ã«ãŸãã¯ldapãµãŒããŒã«åŸã£ãŠSSOã«åŒã³åºããããã·ã¥ããä»ã®ããžãã¯ãäœæã§ããŸãã
ä»ã®ãšãããååãªçè«-ãœãŒã¹ã³ãŒãã§MySQL 5.5.15ãããŠã³ããŒãããŸãã
ç·Žç¿ãã
1ã€ç®ã¯ãããŒã«ã«ãã·ã³ãã管çè ã®ã¢ã¯ã·ã§ã³ãèšé²ããããšã§ãã ããŒã¿ããŒã¹ç®¡çè ã¯ãµãŒããŒç®¡çè ã§ã¯ãªãããœã±ãããŸãã¯TCPçµç±ã®ã³ã³ãœãŒã«ããã®ã¿ããŒã¿ããŒã¹ã«ã¢ã¯ã»ã¹ã§ãããšèããŠããŸããããã¯éèŠã§ã¯ãããŸããã ãµãŒããŒã管çããã«ã¯ãããã§ååã§ãã mysql.ccã§ã¯ ã次ã®è¡ãè¿œå ããå¿ èŠããããŸãã
#include <violite.h> // Linux syslog #ifndef __WIN__ #include "syslog.h" #endif ... void tee_putc(int c, FILE *file); // void write_syslog(String *buffer); ... // Percona . : mysql_error(&mysql)[0] void write_syslog(String *line){ #ifndef __WIN__ uint length= line->length(); uint chunk_len= min(MAX_SYSLOG_MESSAGE, length); char *ptr= line->c_ptr_safe(); char buff[MAX_SYSLOG_MESSAGE + 1]; for (; length; length-= chunk_len, ptr+= chunk_len, chunk_len= min(MAX_SYSLOG_MESSAGE, length)) { char *str; if (length == chunk_len) str= ptr; // last chunk => skip copy else { memcpy(buff, ptr, chunk_len); buff[chunk_len]= '\0'; str= buff; } syslog(LOG_INFO, "SYSTEM_USER:'%s', MYSQL_USER:'%s', CONNECTION_ID:%lu, " "DB_SERVER:'%s', DB:'%s', COMMAND_RESULT:%s, QUERY:'%s'", getenv("SUDO_USER") ? getenv("SUDO_USER") : getenv("USER") ? getenv("USER") : "--", current_user ? current_user : "--", mysql_thread_id(&mysql), current_host ? current_host : "--", current_db ? current_db : "--", mysql_error(&mysql)[0]?"FAILED":"SUCCESS", str); } #endif } ... #endif /*HAVE_READLINE*/ // #ifndef __WIN__ if (buffer->length() && connect_flag == CLIENT_INTERACTIVE){ write_syslog(buffer); } #endif
äºçªç®ã ãµãŒããŒåŽã®ãã°ã€ã³è©Šè¡ãåŠçããã¡ã€ã³ã¢ãžã¥ãŒã«ã¯sql_acl.ccã§ãã general_log_printããã¹ãŠåŒã³åºããåŸãç¬èªã®ãã®ãè¿œå ããå¿ èŠããããŸãã ããããã®ããã«ã general_logã¯ç¡å¹ã«ãªã£ãŠããŸããããã³ãã¯éåžžã«åªããŠããŸãã çŸåšã2çªç®ã®ã³ãã³ãïŒ general_log_write ïŒã¯ããŠãŒã¶ãŒãããŒã¿ããŒã¹ã«æ¥ç¶ããããšãããšãã«åŒã³åºãããŸããã 次ã®ããã«ãªããŸããïŒæ°ãããããã¯ã¯PCI DSSãããã«ãã£ãŠå²ãåœãŠãããŸãïŒïŒ
// PCI DSS patch #ifndef __WIN__ #include "syslog.h" #endif // end PCI DSS patch ... // login_failed_error - general_log_print(thd, COM_CONNECT, ER(ER_ACCESS_DENIED_NO_PASSWORD_ERROR), mpvio->auth_info.user_name, mpvio->auth_info.host_or_ip); // PCI DSS patch syslog(LOG_WARNING, "User:%s FAILED access from:%s with privileges:%s", mpvio->auth_info.user_name, mpvio->auth_info.host_or_ip, mpvio->auth_info.authenticated_as); // end PCI DSS patch ... general_log_print(thd, COM_CONNECT, ER(ER_ACCESS_DENIED_ERROR), mpvio->auth_info.user_name, mpvio->auth_info.host_or_ip, passwd_used ? ER(ER_YES) : ER(ER_NO)); // PCI DSS patch syslog(LOG_WARNING, "User:%s FAILED access from:%s with privileges:%s", mpvio->auth_info.user_name, mpvio->auth_info.host_or_ip, mpvio->auth_info.authenticated_as); // end PCI DSS patch ... // secure_auth - if (mpvio->client_capabilities & CLIENT_PROTOCOL_41) { my_error(ER_SERVER_IS_IN_SECURE_AUTH_MODE, MYF(0), mpvio->auth_info.user_name, mpvio->auth_info.host_or_ip); general_log_print(thd, COM_CONNECT, ER(ER_SERVER_IS_IN_SECURE_AUTH_MODE), mpvio->auth_info.user_name, mpvio->auth_info.host_or_ip); // PCI DSS patch syslog(LOG_WARNING, "User:%s FAILED access from:%s with privileges:%s", mpvio->auth_info.user_name, mpvio->auth_info.host_or_ip, mpvio->auth_info.authenticated_as); // end PCI DSS patch } else { my_error(ER_NOT_SUPPORTED_AUTH_MODE, MYF(0)); general_log_print(thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE)); // PCI DSS patch syslog(LOG_WARNING, "Auth mode not supported"); // end PCI DSS patch } ... // send_plugin_request_packet - general_log_print(current_thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE)); // PCI DSS patch syslog(LOG_WARNING, "Auth mode not supported"); // end PCI DSS patch ... // find_mpvio_user general_log_print(current_thd, COM_CONNECT, ER(ER_NOT_SUPPORTED_AUTH_MODE)); // PCI DSS patch syslog(LOG_WARNING, "Auth mode not supported"); // end PCI DSS patch ... // acl_authenticate - main if (strcmp(mpvio.auth_info.authenticated_as, mpvio.auth_info.user_name)) { general_log_print(thd, command, "%s@%s as %s on %s", mpvio.auth_info.user_name, mpvio.auth_info.host_or_ip, mpvio.auth_info.authenticated_as ? mpvio.auth_info.authenticated_as : "anonymous", mpvio.db.str ? mpvio.db.str : (char*) ""); // PCI DSS patch syslog(LOG_WARNING, "User:%s TRY access from:%s with privileges:%s", mpvio.auth_info.user_name, mpvio.auth_info.host_or_ip, mpvio.auth_info.authenticated_as); // end PCI DSS patch } else { general_log_print(thd, command, (char*) "%s@%s on %s", mpvio.auth_info.user_name, mpvio.auth_info.host_or_ip, mpvio.db.str ? mpvio.db.str : (char*) ""); // PCI DSS patch syslog(LOG_WARNING, "User:%s TRY access from:%s with privileges:%s", mpvio.auth_info.user_name, mpvio.auth_info.host_or_ip, mpvio.auth_info.authenticated_as); // end PCI DSS patch } ... if (res > CR_OK && mpvio.status != MPVIO_EXT::SUCCESS) { DBUG_ASSERT(mpvio.status == MPVIO_EXT::FAILURE); if (!thd->is_error()) login_failed_error(&mpvio, mpvio.auth_info.password_used); DBUG_RETURN (1); } // PCI DSS patch else syslog(LOG_WARNING, "User:%s SUCCESS access from:%s with privileges:%s", mpvio.auth_info.user_name, mpvio.auth_info.host_or_ip, mpvio.auth_info.authenticated_as); // end PCI DSS patch
æ®å¿µãªãããããã ãã§ã¯ãããŸããã èªèšŒã¯ããã«2ã€ã®å Žæã§å®è¡ãããããšãããããŸãã 1ã€ç®ã¯ã use databaseã³ãã³ããå®è¡ããããšãããšãã§ãã sql_db.ccã¢ãžã¥ãŒã«ããããæ åœããäžè¬ãã°ãåŒã³åºããåŸãmysql_change_dbé¢æ°ããã®äžã«ããã 幞ããªããšã«ãè¡ãè¿œå ããŸãã
general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR), sctx->priv_user, sctx->priv_host, new_db_file_name.str); // PCI DSS patch syslog(LOG_WARNING, "User:%s FAILED access from:%s with privileges:%s", sctx->proxy_user, sctx->priv_host, sctx->priv_user); // end PCI DSS patch
æåŸã«ããŠãŒã¶ãŒãå©çšã§ããªãããŒã¿ããŒã¹æ å ±ããŠãŒã¶ãŒã衚瀺ããç¬éã«ãã°ã€ã³ããå¿ èŠããããŸãã sql_show.ccã¢ãžã¥ãŒã«ããããæ åœããŸãã ååãéåŒmysqld_show_create_dbã®ããã·ãŒãžã£ã è¿œå ïŒ
general_log_print(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR), sctx->priv_user, sctx->host_or_ip, dbname); // PCI DSS patch syslog(LOG_WARNING, "User:%s FAILED access from:%s with privileges:%s", sctx->proxy_user, sctx->priv_host, sctx->priv_user); // end PCI DSS patch
POSIXã«ãããšã syslogé¢æ°ã¯ãã«ãã¹ã¬ããããµããŒãããŠããŸãããèœã¡ãããšã¯ãããŸããã ã¯ãªãã£ã«ã«ã»ã¯ã·ã§ã³ã«ã¯å ¥ããŸããã§ããããããã»ã©é ããªãããšã¯ãããŸããã
ãããïŒ ããã§ãç§ãã¡ã®æš©å©ãã©ã®ããã«ãã©ãã§å€åããŠãããããã°ã§èªãããšãã§ããŸãã å°èŠæš¡ã®å Žåã¯ãã®ãŸãŸã§ãã Zayuzatã®æ°æ©èœã ãœãŒã¹ã³ãŒãã®ãã©ã°ã€ã³ãã£ã¬ã¯ããªã«ç§»åãããšã æ倧 2ã€ã®èªèšŒãã©ã°ã€ã³ã衚瀺ãããŸããããã¯èŽãç©ã§ãã æåã®auth_socket.c-ãœã±ããã䜿çšãããŠããå Žåããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®ãŠãŒã¶ãŒãšããŠããŒã¿ããŒã¹ã«ãã°ã€ã³ã§ããŸãã ãŸããããè¯ããã®ããªããããç§ãã¡ã¯ããã䜿çšããŸã-ãããç§ãã¡ã®SSOã§ãã 次ã®ãã©ã°ã€ã³-test_plugin.c-ã¯æ¬¡ã®ããã«æ©èœããŸãã ãŠãŒã¶ãŒãäœæãããšãããã©ã°ã€ã³åã®åŸã«ç¥ç§çãªè¡AS 'auth_string'ãæå®ããŸãã ãã©ã°ã€ã³ã¯ãã¹ã¯ãŒãããã®è¡ãšæ¯èŒããŸãã äžèŽãããã®ãèŠã€ãããªãå Žåããšã©ãŒãã¹ããŒãããŸã;ãã¹ãŠãããŸããã£ãå Žåãååã ' auth_string 'ã§ãããŠãŒã¶ãŒã®ç¹æš©ãã»ãã·ã§ã³ã«å²ãåœãŠãããŸãã ãã©ã°ã€ã³ã¯ãããªãèªèº«ããã¹ããç解ããŠãããã¡ã«ããºã ãæ©èœããŠããããšã確èªããããã ãã®ãã®ã§ãã
ææžã«ãããšããã©ã°ã€ã³ã¯ãŠãŒã¶ãŒåãå€æŽãããããŸãã¯ãã®ããã«ç¹å¥ã«æå®ãããæ°ããinfo-> authenticate_asãã£ãŒã«ãã䜿çšããŠæžã蟌ã¿ããã¹ã¯ãŒããèšå®ããããšããã§ããŸãã
#define PASSWORD_USED_NO 0 #define PASSWORD_USED_YES 1 #define PASSWORD_USED_NO_MENTION 2
ãã¹ãã®å€æŽã§åé¡ãçºçããããããªã¹ã¯ãåããŸããã§ããã ãã¹ãŠLANã®ã¿ã
2ã€ã®é¢æ°ã®ãããããäœæãããã¹ãèªèšŒãã©ã°ã€ã³ã«æŒã蟌ã¿ãŸãïŒçªç¶ãå¥ã®ã·ã¹ãã ã§äœ¿çšãããŠããŸã...ïŒ
static int auth_test_plugin(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) { unsigned char *pkt; int pkt_len; MYSQL_PLUGIN_VIO_INFO vio_info; struct ucred cred; socklen_t cred_len= sizeof(cred); struct passwd pwd_buf, *pwd; char buf[1024]; /* */ if (vio->write_packet(vio, (const unsigned char *) PASSWORD_QUESTION, 1)) return CR_ERROR; /* */ if ((pkt_len= vio->read_packet(vio, &pkt)) < 0) return CR_ERROR; /* */ info->password_used= PASSWORD_USED_NO_MENTION; /* */ strcpy (info->authenticated_as, (const char *) pkt); vio->info(vio, &vio_info); if (vio_info.protocol != MYSQL_VIO_SOCKET) return CR_ERROR; /* get the UID of the client process */ if (getsockopt(vio_info.socket, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len)) return CR_ERROR; if (cred_len != sizeof(cred)) return CR_ERROR; /* and find the username for this uid */ getpwuid_r(cred.uid, &pwd_buf, buf, sizeof(buf), &pwd); if (pwd == NULL) return CR_ERROR; /* MySQL */ return strcmp(pwd->pw_name, info->user_name) ? CR_ERROR : CR_OK; }
次ã«è¡ããŸã
cmake -DCMAKE_INSTALL_PREFIX = / opt / mysql-5.5.15-ããã¯ç§ãã¡ã眮ãããŠãããã©ã«ããŒã§ãããçèã殺ããããªãã äœã ã€ã³ã¹ããŒã«ãã
ããŒã¿ããŒã¹ãæ§æããã«ãŒããšããŠãã°ã€ã³ãã次ã®ã¢ã¯ã·ã§ã³ãå®è¡ããŸãã
ãã©ã°ã€ã³test_plugin_server soname 'auth_test_plugin.so'ãã€ã³ã¹ããŒã«ããŸãã ãã©ã°ã€ã³ã衚瀺ããŸãã + ----------------------- + -------- + ---------------- ---- + --------------------- + --------- + | åå| ã¹ããŒã¿ã¹| ã¿ã€ã| å³æžé€š| ã©ã€ã»ã³ã¹| + ----------------------- + -------- + ---------------- ---- + --------------------- + --------- + ... | test_plugin_server | ã¢ã¯ãã£ã| èªèšŒ| auth_test_plugin.so | GPL | + ----------------------- + -------- + ---------------- ---- + --------------------- + --------- + ãŠãŒã¶ãŒãmikeã@ãlocalhostããäœæããŸãã ãtest_plugin_serverãã§ãvolkiããšããŠèå¥ããããŠãŒã¶ãŒãmcshadowã@ãlocalhostããäœæããŸãã ãrootã@ãlocalhostãã®ãããã·ããmcshadowã@ãlocalhostãã«ä»äžããŸãã ãmikeã@ãlocalhostãã®ãããã·ããmcshadowã@ãlocalhostãã«ä»äžããŸãã select * from mysql.proxies_priv; + ----------- + ---------- + ----------------- + -------- ------ + ------------ + ---------------- + ------------- -------- + | ãã¹ã| ãŠãŒã¶ãŒ| Proxied_host | Proxied_user | With_grant | å©æè | ã¿ã€ã ã¹ã¿ã³ã| + ----------- + ---------- + ----------------- + -------- ------ + ------------ + ---------------- + ------------- -------- + ... | ããŒã«ã«ãã¹ã| mcshadow | ããŒã«ã«ãã¹ã| ã«ãŒã| 0 | root @ localhost | 2011-08-17 01:15:09 | | ããŒã«ã«ãã¹ã| mcshadow | ããŒã«ã«ãã¹ã| ãã€ã¯| 0 | root @ localhost | 2011-08-17 01:30:35 | + ----------- + ---------- + ----------------- + -------- ------ + ------------ + ---------------- + ------------- -------- +
å®éãããã§ãã¹ãŠã§ã-ããã§ãrootæš©éãŸãã¯ãããã·ãèš±å¯ãããŠããä»ã®ãŠãŒã¶ãŒã®ã¢ã«ãŠã³ãã§ããŒã¿ããŒã¹ã«ãã°ã€ã³ã§ããŸãã è¡šãããããããã«ããŸã grant optionã§èšå®ã§ããŸãããçŽç²ã«ç§èŠã§ã¯ããã¯ãã§ã«äžèŠã§ãã
ãããã«
ãã¡ããããããŸã§ã®ãšããã解決çã¯æ¹¿ã£ãŠããŸããäœãæ©èœããäœãæ©èœããªãããæ確ã§ã¯ãªãããã§ãã ããšãã°ãç§ãè©Šãããã¹ãŠãç§ã®ããã«åãããããŸã å®å šãªèªä¿¡ã¯ãªãã ç解ãæ·±ããããã«ãåäœãã¹ãã®ãªã¹ã-plugin_auth.resultãèªãããšãã§ããŸãããã®ãã©ã°ã€ã³ã¯mysql-test \ r ãã©ã«ããŒã«ãããŸã ïŒ svetasmirnovaã®ãã³ãã®ãããã§ã ïŒããäžè¬ã«GRANT PROXYã«ã€ããŠã®æ å ±ã¯ã»ãšãã©ãããŸããã ãããã®äœæ¥ã®çµæã«åºã¥ããŠã diff-Nurãåå²ããRPMãåéããŸã-ç£æ¥çšããŒã¿ããŒã¹ã§ãã®ãœãªã¥ãŒã·ã§ã³ãïŒå®éã®ããã°ã©ããŒã«ããã¬ãã¥ãŒã®åŸïŒé§åããããšããŸãã ããªãã倱æãããªãããšãé¡ã£ãŠããŸãïŒãããïŒã
ååŒ·ïŒ ä»ããåå ãããïŒ ããªãã®çµéšãå ±æããŠãã ããïŒ