1 
2 /**
3  *    Copyright (C) 2018-present MongoDB, Inc.
4  *
5  *    This program is free software: you can redistribute it and/or modify
6  *    it under the terms of the Server Side Public License, version 1,
7  *    as published by MongoDB, Inc.
8  *
9  *    This program is distributed in the hope that it will be useful,
10  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *    Server Side Public License for more details.
13  *
14  *    You should have received a copy of the Server Side Public License
15  *    along with this program. If not, see
16  *    <http://www.mongodb.com/licensing/server-side-public-license>.
17  *
18  *    As a special exception, the copyright holders give permission to link the
19  *    code of portions of this program with the OpenSSL library under certain
20  *    conditions as described in each individual source file and distribute
21  *    linked combinations including the program with the OpenSSL library. You
22  *    must comply with the Server Side Public License in all respects for
23  *    all of the code used other than as permitted herein. If you modify file(s)
24  *    with this exception, you may extend this exception to your version of the
25  *    file(s), but you are not obligated to do so. If you do not wish to do so,
26  *    delete this exception statement from your version. If you delete this
27  *    exception statement from all source files in the program, then also delete
28  *    it in the license file.
29  */
30 
31 #include "mongo/db/audit.h"
32 
33 #if !MONGO_ENTERPRISE_VERSION
34 
logAuthentication(Client * client,StringData mechanism,const UserName & user,ErrorCodes::Error result)35 void mongo::audit::logAuthentication(Client* client,
36                                      StringData mechanism,
37                                      const UserName& user,
38                                      ErrorCodes::Error result) {}
39 
logCommandAuthzCheck(Client * client,const OpMsgRequest & cmdObj,CommandInterface * command,ErrorCodes::Error result)40 void mongo::audit::logCommandAuthzCheck(Client* client,
41                                         const OpMsgRequest& cmdObj,
42                                         CommandInterface* command,
43                                         ErrorCodes::Error result) {}
44 
logDeleteAuthzCheck(Client * client,const NamespaceString & ns,const BSONObj & pattern,ErrorCodes::Error result)45 void mongo::audit::logDeleteAuthzCheck(Client* client,
46                                        const NamespaceString& ns,
47                                        const BSONObj& pattern,
48                                        ErrorCodes::Error result) {}
49 
logGetMoreAuthzCheck(Client * client,const NamespaceString & ns,long long cursorId,ErrorCodes::Error result)50 void mongo::audit::logGetMoreAuthzCheck(Client* client,
51                                         const NamespaceString& ns,
52                                         long long cursorId,
53                                         ErrorCodes::Error result) {}
54 
logInsertAuthzCheck(Client * client,const NamespaceString & ns,const BSONObj & insertedObj,ErrorCodes::Error result)55 void mongo::audit::logInsertAuthzCheck(Client* client,
56                                        const NamespaceString& ns,
57                                        const BSONObj& insertedObj,
58                                        ErrorCodes::Error result) {}
59 
logKillCursorsAuthzCheck(Client * client,const NamespaceString & ns,long long cursorId,ErrorCodes::Error result)60 void mongo::audit::logKillCursorsAuthzCheck(Client* client,
61                                             const NamespaceString& ns,
62                                             long long cursorId,
63                                             ErrorCodes::Error result) {}
64 
logQueryAuthzCheck(Client * client,const NamespaceString & ns,const BSONObj & query,ErrorCodes::Error result)65 void mongo::audit::logQueryAuthzCheck(Client* client,
66                                       const NamespaceString& ns,
67                                       const BSONObj& query,
68                                       ErrorCodes::Error result) {}
69 
logUpdateAuthzCheck(Client * client,const NamespaceString & ns,const BSONObj & query,const BSONObj & updateObj,bool isUpsert,bool isMulti,ErrorCodes::Error result)70 void mongo::audit::logUpdateAuthzCheck(Client* client,
71                                        const NamespaceString& ns,
72                                        const BSONObj& query,
73                                        const BSONObj& updateObj,
74                                        bool isUpsert,
75                                        bool isMulti,
76                                        ErrorCodes::Error result) {}
77 
logCreateUser(Client * client,const UserName & username,bool password,const BSONObj * customData,const std::vector<RoleName> & roles,const boost::optional<BSONArray> & restrictions)78 void mongo::audit::logCreateUser(Client* client,
79                                  const UserName& username,
80                                  bool password,
81                                  const BSONObj* customData,
82                                  const std::vector<RoleName>& roles,
83                                  const boost::optional<BSONArray>& restrictions) {}
84 
logDropUser(Client * client,const UserName & username)85 void mongo::audit::logDropUser(Client* client, const UserName& username) {}
86 
logDropAllUsersFromDatabase(Client * client,StringData dbname)87 void mongo::audit::logDropAllUsersFromDatabase(Client* client, StringData dbname) {}
88 
logUpdateUser(Client * client,const UserName & username,bool password,const BSONObj * customData,const std::vector<RoleName> * roles,const boost::optional<BSONArray> & restrictions)89 void mongo::audit::logUpdateUser(Client* client,
90                                  const UserName& username,
91                                  bool password,
92                                  const BSONObj* customData,
93                                  const std::vector<RoleName>* roles,
94                                  const boost::optional<BSONArray>& restrictions) {}
95 
logGrantRolesToUser(Client * client,const UserName & username,const std::vector<RoleName> & roles)96 void mongo::audit::logGrantRolesToUser(Client* client,
97                                        const UserName& username,
98                                        const std::vector<RoleName>& roles) {}
99 
logRevokeRolesFromUser(Client * client,const UserName & username,const std::vector<RoleName> & roles)100 void mongo::audit::logRevokeRolesFromUser(Client* client,
101                                           const UserName& username,
102                                           const std::vector<RoleName>& roles) {}
103 
logCreateRole(Client * client,const RoleName & role,const std::vector<RoleName> & roles,const PrivilegeVector & privileges,const boost::optional<BSONArray> & restrictions)104 void mongo::audit::logCreateRole(Client* client,
105                                  const RoleName& role,
106                                  const std::vector<RoleName>& roles,
107                                  const PrivilegeVector& privileges,
108                                  const boost::optional<BSONArray>& restrictions) {}
109 
logUpdateRole(Client * client,const RoleName & role,const std::vector<RoleName> * roles,const PrivilegeVector * privileges,const boost::optional<BSONArray> & restrictions)110 void mongo::audit::logUpdateRole(Client* client,
111                                  const RoleName& role,
112                                  const std::vector<RoleName>* roles,
113                                  const PrivilegeVector* privileges,
114                                  const boost::optional<BSONArray>& restrictions) {}
115 
logDropRole(Client * client,const RoleName & role)116 void mongo::audit::logDropRole(Client* client, const RoleName& role) {}
117 
logDropAllRolesFromDatabase(Client * client,StringData dbname)118 void mongo::audit::logDropAllRolesFromDatabase(Client* client, StringData dbname) {}
119 
logGrantRolesToRole(Client * client,const RoleName & role,const std::vector<RoleName> & roles)120 void mongo::audit::logGrantRolesToRole(Client* client,
121                                        const RoleName& role,
122                                        const std::vector<RoleName>& roles) {}
123 
logRevokeRolesFromRole(Client * client,const RoleName & role,const std::vector<RoleName> & roles)124 void mongo::audit::logRevokeRolesFromRole(Client* client,
125                                           const RoleName& role,
126                                           const std::vector<RoleName>& roles) {}
127 
logGrantPrivilegesToRole(Client * client,const RoleName & role,const PrivilegeVector & privileges)128 void mongo::audit::logGrantPrivilegesToRole(Client* client,
129                                             const RoleName& role,
130                                             const PrivilegeVector& privileges) {}
131 
logRevokePrivilegesFromRole(Client * client,const RoleName & role,const PrivilegeVector & privileges)132 void mongo::audit::logRevokePrivilegesFromRole(Client* client,
133                                                const RoleName& role,
134                                                const PrivilegeVector& privileges) {}
135 
logReplSetReconfig(Client * client,const BSONObj * oldConfig,const BSONObj * newConfig)136 void mongo::audit::logReplSetReconfig(Client* client,
137                                       const BSONObj* oldConfig,
138                                       const BSONObj* newConfig) {}
139 
logApplicationMessage(Client * client,StringData msg)140 void mongo::audit::logApplicationMessage(Client* client, StringData msg) {}
141 
logShutdown(Client * client)142 void mongo::audit::logShutdown(Client* client) {}
143 
logCreateIndex(Client * client,const BSONObj * indexSpec,StringData indexname,StringData nsname)144 void mongo::audit::logCreateIndex(Client* client,
145                                   const BSONObj* indexSpec,
146                                   StringData indexname,
147                                   StringData nsname) {}
148 
logCreateCollection(Client * client,StringData nsname)149 void mongo::audit::logCreateCollection(Client* client, StringData nsname) {}
150 
logCreateDatabase(Client * client,StringData dbname)151 void mongo::audit::logCreateDatabase(Client* client, StringData dbname) {}
152 
153 
logDropIndex(Client * client,StringData indexname,StringData nsname)154 void mongo::audit::logDropIndex(Client* client, StringData indexname, StringData nsname) {}
155 
logDropCollection(Client * client,StringData nsname)156 void mongo::audit::logDropCollection(Client* client, StringData nsname) {}
157 
logDropDatabase(Client * client,StringData dbname)158 void mongo::audit::logDropDatabase(Client* client, StringData dbname) {}
159 
logRenameCollection(Client * client,StringData source,StringData target)160 void mongo::audit::logRenameCollection(Client* client, StringData source, StringData target) {}
161 
logEnableSharding(Client * client,StringData dbname)162 void mongo::audit::logEnableSharding(Client* client, StringData dbname) {}
163 
logAddShard(Client * client,StringData name,const std::string & servers,long long maxSize)164 void mongo::audit::logAddShard(Client* client,
165                                StringData name,
166                                const std::string& servers,
167                                long long maxSize) {}
168 
logRemoveShard(Client * client,StringData shardname)169 void mongo::audit::logRemoveShard(Client* client, StringData shardname) {}
170 
logShardCollection(Client * client,StringData ns,const BSONObj & keyPattern,bool unique)171 void mongo::audit::logShardCollection(Client* client,
172                                       StringData ns,
173                                       const BSONObj& keyPattern,
174                                       bool unique) {}
175 
writeImpersonatedUsersToMetadata(OperationContext * opCtx,BSONObjBuilder * metadata)176 void mongo::audit::writeImpersonatedUsersToMetadata(OperationContext* opCtx,
177                                                     BSONObjBuilder* metadata) {}
178 
179 #endif
180