1
|
|
|
<?php |
2
|
|
|
/****************************************************************************** |
3
|
|
|
* Wikipedia Account Creation Assistance tool * |
4
|
|
|
* * |
5
|
|
|
* All code in this file is released into the public domain by the ACC * |
6
|
|
|
* Development Team. Please see team.json for a list of contributors. * |
7
|
|
|
******************************************************************************/ |
8
|
|
|
|
9
|
|
|
/************************************************************************** |
10
|
|
|
********** IMPORTANT NOTICE ********** |
11
|
|
|
*************************************************************************** |
12
|
|
|
** YOU MUST OVERRIDE THE CONFIGURATION IN THIS FILE WITH A LOCAL COPY!!! ** |
13
|
|
|
** IT IS VERY IMPORTANT THAT THAT FILE IS CALLED config.local.inc.php ** |
14
|
|
|
***************************************************************************/ |
15
|
|
|
|
16
|
|
|
/********************************* |
17
|
|
|
* Databases and stuff |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
// Main database location and access details. |
21
|
|
|
$toolserver_username = ""; |
22
|
|
|
$toolserver_password = ""; |
23
|
|
|
$toolserver_host = ""; |
24
|
|
|
$toolserver_database = ""; |
25
|
|
|
|
26
|
|
|
/********************************** |
27
|
|
|
* File paths etc |
28
|
|
|
*/ |
29
|
|
|
|
30
|
|
|
$metaWikimediaWebServiceEndpoint = "https://meta.wikimedia.org/w/api.php"; |
31
|
|
|
|
32
|
|
|
// URL of the current copy of the tool. |
33
|
|
|
$baseurl = "https://accounts.wmflabs.org"; |
34
|
|
|
|
35
|
|
|
// Set up cookies and session information. |
36
|
|
|
$cookiepath = '/acc/'; |
37
|
|
|
$sessionname = 'ACC'; |
38
|
|
|
|
39
|
|
|
$xff_trusted_hosts_file = '../TrustedXFF/trusted-hosts.txt'; |
40
|
|
|
/************************************ |
41
|
|
|
* Tool downtime |
42
|
|
|
*/ |
43
|
|
|
|
44
|
|
|
$dontUseDb = 0; // Disable the tool completely. |
45
|
|
|
$dontUseDbReason = ""; // Reason for disabling the tool. |
46
|
|
|
$dontUseDbCulprit = ""; // Your name, or the person who broke the tool. |
47
|
|
|
|
48
|
|
|
/************************************** |
49
|
|
|
* ACCBot IRC bot |
50
|
|
|
*/ |
51
|
|
|
|
52
|
|
|
$ircBotNotificationsEnabled = 1; // Enable Helpmebot's notifications. |
53
|
|
|
// Name of this instance of the tool. |
54
|
|
|
// This name would be used by the bot as reference point. |
55
|
|
|
$whichami = 'Live'; |
56
|
|
|
|
57
|
|
|
// AMQP configuration for notifications. |
58
|
|
|
$amqpConfiguration = ['host' => 'localhost', 'port' => 5672, 'user' => 'guest', 'password' => 'guest', 'vhost' => '/', 'exchange' => '', 'tls' => false]; |
59
|
|
|
|
60
|
|
|
/*************************************** |
61
|
|
|
* Email confirmation |
62
|
|
|
*/ |
63
|
|
|
|
64
|
|
|
// Enable request email confirmation. |
65
|
|
|
$enableEmailConfirm = 1; |
66
|
|
|
// Number of days that are given for a requestor to confirm their email address. |
67
|
|
|
$emailConfirmationExpiryDays = 7; |
68
|
|
|
|
69
|
|
|
/************************************** |
70
|
|
|
* Interface registration, interface users, etc. |
71
|
|
|
*/ |
72
|
|
|
|
73
|
|
|
$allowRegistration = true; |
74
|
|
|
|
75
|
|
|
// Force identification to the foundation |
76
|
|
|
$forceIdentification = true; |
77
|
|
|
|
78
|
|
|
// Time to cache positive automatic identification results, as a MySQL time interval |
79
|
|
|
$identificationCacheExpiry = "1 DAY"; |
80
|
|
|
|
81
|
|
|
/************************************ |
82
|
|
|
* OAuth Configuration |
83
|
|
|
*/ |
84
|
|
|
|
85
|
|
|
$oauthConsumerToken = ""; |
86
|
|
|
$oauthSecretToken = ""; |
87
|
|
|
|
88
|
|
|
// Formerly-used OAuth tokens to permit reading identities from |
89
|
|
|
$oauthLegacyTokens = []; |
90
|
|
|
|
91
|
|
|
$oauthMediaWikiCanonicalServer = "https://en.wikipedia.org"; |
92
|
|
|
|
93
|
|
|
$useOauthSignup = true; |
94
|
|
|
$enforceOAuth = false; |
95
|
|
|
|
96
|
|
|
// Password for the creation bot when this is used in place of OAuth |
97
|
|
|
$creationBotUsername = ''; |
98
|
|
|
$creationBotPassword = ''; |
99
|
|
|
|
100
|
|
|
/************************************ |
101
|
|
|
* Providers Configuration |
102
|
|
|
*/ |
103
|
|
|
|
104
|
|
|
// IP GeoLocation |
105
|
|
|
// ------------------------ |
106
|
|
|
// To set this up, change the class to "IpLocationProvider", and put *your* ipinfodb API key in. |
107
|
|
|
// You'll need to sign up at IpInfoDb.com to get an API key - it's free. |
108
|
|
|
$locationProviderApiKey = null; // ipinfodb api key |
109
|
|
|
|
110
|
|
|
/*********************************** |
111
|
|
|
* Data clear script |
112
|
|
|
*/ |
113
|
|
|
|
114
|
|
|
$dataclear_interval = '15 DAY'; |
115
|
|
|
|
116
|
|
|
/*********************************** |
117
|
|
|
* Other stuff that doesn't fit in. |
118
|
|
|
*/ |
119
|
|
|
|
120
|
|
|
$enableTitleblacklist = 0; // Enable Title Blacklist checks. |
121
|
|
|
|
122
|
|
|
// user agent of the tool. |
123
|
|
|
$toolUserAgent = "Wikipedia-ACC Tool/0.1 (+https://accounts.wmflabs.org/internal.php/team)"; |
124
|
|
|
|
125
|
|
|
// list of squid proxies requests go through. |
126
|
|
|
$squidIpList = array(); |
127
|
|
|
|
128
|
|
|
// miser mode |
129
|
|
|
$requestLimitShowOnly = 25; |
130
|
|
|
|
131
|
|
|
// HSTS expiry - use false to disable header. |
132
|
|
|
$strictTransportSecurityExpiry = false; |
133
|
|
|
|
134
|
|
|
// CSP violation report URI |
135
|
|
|
$cspReportUri = null; |
136
|
|
|
|
137
|
|
|
// Must be disabled in production. |
138
|
|
|
$enableErrorTrace = false; |
139
|
|
|
$enableCssBreakpoints = false; |
140
|
|
|
|
141
|
|
|
// Dangerous. |
142
|
|
|
// Don't set this. |
143
|
|
|
// Definitely don't set this if there's sensitive data stored here you care about such as OAuth credentials. |
144
|
|
|
$curlDisableSSLVerifyPeer = false; |
145
|
|
|
|
146
|
|
|
// Change this to be outside the web directory. |
147
|
|
|
$curlCookieJar = __DIR__ . '/../cookies.txt'; |
148
|
|
|
|
149
|
|
|
$yubicoApiId = 0; |
150
|
|
|
$yubicoApiKey = ""; |
151
|
|
|
|
152
|
|
|
$totpEncryptionKey = "1234"; |
153
|
|
|
|
154
|
|
|
// external resource cache epoch value. Bump me to force clients to reload assets |
155
|
|
|
$resourceCacheEpoch = 1; |
156
|
|
|
|
157
|
|
|
$commonEmailDomains = ['gmail.com', 'hotmail.com', 'outlook.com']; |
158
|
|
|
|
159
|
|
|
// limit for block/drop ban actions |
160
|
|
|
$banMaxIpBlockRange = [4 => 20, 6 => 48]; |
161
|
|
|
// limit for *all* ban actions, including block/drop. |
162
|
|
|
$banMaxIpRange = [4 => 16, 6 => 32]; |
163
|
|
|
|
164
|
|
|
$jobQueueBatchSize = 10; |
165
|
|
|
|
166
|
|
|
$emailSender = '[email protected]'; |
167
|
|
|
|
168
|
|
|
$identificationNoticeboardPage = 'Access to nonpublic personal data policy/Noticeboard'; |
169
|
|
|
$identificationNoticeboardApi = $metaWikimediaWebServiceEndpoint; |
170
|
|
|
|
171
|
|
|
$acceptClientHints = []; |
172
|
|
|
|
173
|
|
|
/************************************************************************** |
174
|
|
|
********** IMPORTANT NOTICE ********** |
175
|
|
|
*************************************************************************** |
176
|
|
|
** DON'T ADD ANY NEW CONFIGURATION OPTIONS BELOW THIS LINE!!! ** |
177
|
|
|
** THEY WILL NOT BE CHANGABLE BY THE LOCAL CONFIGURATION FILE. ** |
178
|
|
|
***************************************************************************/ |
179
|
|
|
|
180
|
|
|
// Retrieving the local configuration file. |
181
|
|
|
require_once('config.local.inc.php'); |
182
|
|
|
|
183
|
|
|
// Initialise the site configuration object |
184
|
|
|
global $siteConfiguration; |
185
|
|
|
$siteConfiguration->setBaseUrl($baseurl) |
186
|
|
|
->setFilePath(__DIR__) |
187
|
|
|
->setDebuggingTraceEnabled($enableErrorTrace) |
188
|
|
|
->setDebuggingCssBreakpointsEnabled($enableCssBreakpoints) |
189
|
|
|
->setForceIdentification($forceIdentification) |
190
|
|
|
->setIdentificationCacheExpiry($identificationCacheExpiry) |
191
|
|
|
->setMetaWikimediaWebServiceEndpoint($metaWikimediaWebServiceEndpoint) |
192
|
|
|
->setEnforceOAuth($enforceOAuth) |
193
|
|
|
->setEmailConfirmationEnabled($enableEmailConfirm == 1) |
194
|
|
|
->setEmailConfirmationExpiryDays($emailConfirmationExpiryDays) |
195
|
|
|
->setMiserModeLimit($requestLimitShowOnly) |
196
|
|
|
->setSquidList($squidIpList) |
197
|
|
|
->setUseStrictTransportSecurity($strictTransportSecurityExpiry) |
198
|
|
|
->setUserAgent($toolUserAgent) |
199
|
|
|
->setCurlDisableVerifyPeer($curlDisableSSLVerifyPeer) |
200
|
|
|
->setUseOAuthSignup($useOauthSignup) |
201
|
|
|
->setOAuthConsumerToken($oauthConsumerToken) |
202
|
|
|
->setOAuthLegacyConsumerTokens($oauthLegacyTokens) |
203
|
|
|
->setOAuthConsumerSecret($oauthSecretToken) |
204
|
|
|
->setOauthMediaWikiCanonicalServer($oauthMediaWikiCanonicalServer) |
205
|
|
|
->setDataClearInterval($dataclear_interval) |
206
|
|
|
->setXffTrustedHostsFile($xff_trusted_hosts_file) |
207
|
|
|
->setIrcNotificationsEnabled($ircBotNotificationsEnabled == 1) |
208
|
|
|
->setIrcNotificationsInstance($whichami) |
209
|
|
|
->setTitleBlacklistEnabled($enableTitleblacklist == 1) |
210
|
|
|
->setTorExitPaths(array_merge(gethostbynamel('en.wikipedia.org'), gethostbynamel('accounts.wmflabs.org'))) |
211
|
|
|
->setCreationBotUsername($creationBotUsername) |
212
|
|
|
->setCreationBotPassword($creationBotPassword) |
213
|
|
|
->setCurlCookieJar($curlCookieJar) |
214
|
|
|
->setYubicoApiId($yubicoApiId) |
215
|
|
|
->setYubicoApiKey($yubicoApiKey) |
216
|
|
|
->setTotpEncryptionKey($totpEncryptionKey) |
217
|
|
|
->setRegistrationAllowed($allowRegistration) |
218
|
|
|
->setCspReportUri($cspReportUri) |
219
|
|
|
->setResourceCacheEpoch($resourceCacheEpoch) |
220
|
|
|
->setLocationProviderApiKey($locationProviderApiKey) |
221
|
|
|
->setCommonEmailDomains($commonEmailDomains) |
222
|
|
|
->setBanMaxIpRange($banMaxIpRange) |
223
|
|
|
->setBanMaxIpBlockRange($banMaxIpBlockRange) |
224
|
|
|
->setJobQueueBatchSize($jobQueueBatchSize) |
225
|
|
|
->setAmqpConfiguration($amqpConfiguration) |
226
|
|
|
->setEmailSender($emailSender) |
227
|
|
|
->setIdentificationNoticeboardPage($identificationNoticeboardPage) |
228
|
|
|
->setIdentificationNoticeboardWebserviceEndpoint($identificationNoticeboardApi) |
229
|
|
|
->setAcceptClientHints($acceptClientHints) |
230
|
|
|
->setOffline(['offline' => $dontUseDb == 1, 'reason' => $dontUseDbReason, 'culprit' => $dontUseDbCulprit]) |
231
|
|
|
->setDatabaseConfig([ |
232
|
|
|
'datasource' => 'mysql:host=' . $toolserver_host . ';dbname=' . $toolserver_database, |
233
|
|
|
'username' => $toolserver_username, |
234
|
|
|
'password' => $toolserver_password, |
235
|
|
|
]) |
236
|
|
|
->setCookiePath($cookiepath) |
237
|
|
|
->setCookieSessionName($sessionname) |
238
|
|
|
; |
239
|
|
|
|