-
Notifications
You must be signed in to change notification settings - Fork 1
/
configuration.example.php
310 lines (282 loc) · 8.02 KB
/
configuration.example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
<?php
defined('_SFTPGO') or die;
define('_SFTPGO_CLI', PHP_SAPI === 'cli');
define('_SFTPGO_LOG', false);
define('_SFTPGO_DEBUG', false);
define('_SFTPGO_DEBUG_ENV', false);
use LdapRecord\Connection;
use Monolog\Logger;
use Monolog\Handler\RotatingFileHandler;
// create a log channel
$log = new Logger('name');
$log->pushHandler(new RotatingFileHandler('logs/sftpgo-ldap.log', 30, Logger::DEBUG));
// If the debug flag is set to true, please set the username/password directly for the LDAP user you want to test below:
$debug_object = '{"username":"test","password":"test","ip":"::1","keyboard_interactive":"","protocol":"SSH","public_key":""}';
// Localhost IPs are present, but add remote IP of SFTPGo server into the list below if needed:
$allowed_ips = [
'::1',
'127.0.0.1'
];
// Force usernames to lowercase (helps enforce consistency when creating folder names automatically based on username):
$convert_username_to_lowercase = true;
// Special functionality to strip email domains automatically from the username if provided:
$domains_to_strip_automatically = [
'example.com',
];
// Add named connection strings for each LDAP connection you want to utilize with SFTPGo:
$connections = [];
$connections['example'] = new Connection([
// Mandatory Configuration Options
'hosts' => ['192.168.1.1'],
'base_dn' => 'dc=local,dc=com',
'username' => 'cn=admin,dc=local,dc=com',
'password' => 'password',
// Optional Configuration Options
'port' => 389,
'use_ssl' => false,
'use_tls' => false,
'version' => 3,
'timeout' => 5,
'follow_referrals' => false,
// Custom LDAP Options
'options' => [
// See: http://php.net/ldap_set_option
//LDAP_OPT_X_TLS_REQUIRE_CERT => LDAP_OPT_X_TLS_HARD
]
]);
// Create an entry for each connection you have above:
$home_directories = [];
### NOTE: You may include #USERNAME# in the path you define and it will be replaced by the user's username:
$home_directories['example'] = 'C:\test\#USERNAME#';
// Optional: create virtual folder entries for each connection you have above:
$virtual_folders = [];
### NOTE: You may include #USERNAME# in the 'name' and 'mapped_path' values you define and it will be replaced by the user's username:
// Note: that for each connection you need to provide a nested array (since you can technically define more than one virtual folder per connection):
$virtual_folders['example'] = [
[
//"id" => 0,
"name" => "private-#USERNAME#",
"mapped_path" => 'C:\example-private\#USERNAME#',
//"used_quota_size" => 0,
//"used_quota_files" => 0,
//"last_quota_update" => 0,
"virtual_path" => "/private",
"quota_size" => -1,
"quota_files" => -1
]
];
// You can make adjustments here that will be used for all of your user object responses back to SFTPGo:
$default_output_object = [
'status' => 1,
'username' => '',
'expiration_date' => 0,
'home_dir' => '',
// Need to comment the virtual_folders entry out:
//'virtual_folders' => array(
//$privateFolderName
//),
'uid' => 0,
'gid' => 0,
'max_sessions' => 0,
'quota_size' => 0,
'quota_files' => 100000,
'permissions' => [
"/" => ["*"],
//"/somedir" => array("list", "download"),
],
'upload_bandwidth' => 0,
'download_bandwidth' => 0,
'filters' => [
'allowed_ip' => [],
'denied_ip' => [],
],
'public_keys' => [],
];
// If you want to have a specific LDAP connection use a different output object template,
// add in an entry using the connection name as key:
$connection_output_objects = [];
$connection_output_objects['default'] = [
'status' => 1,
'username' => '',
'expiration_date' => 0,
'home_dir' => '',
// Need to comment the virtual_folders entry out:
//'virtual_folders' => array(
//$privateFolderName
//),
'uid' => 0,
'gid' => 0,
'max_sessions' => 0,
'quota_size' => 0,
'quota_files' => 100000,
'permissions' => [
"/" => ["*"],
//"/somedir" => array("list", "download"),
],
'upload_bandwidth' => 0,
'download_bandwidth' => 0,
'filters' => [
'allowed_ip' => [],
'denied_ip' => [],
],
'public_keys' => [],
];
// If you want to have a specific LDAP username to use a different output object template,
// add in an entry using the username as key:
$user_output_objects = [];
$user_output_objects['example_username'] = [
'status' => 1,
'username' => '',
'expiration_date' => 0,
'home_dir' => '',
// Need to comment the virtual_folders entry out:
//'virtual_folders' => array(
//$privateFolderName
//),
'uid' => 0,
'gid' => 0,
'max_sessions' => 0,
'quota_size' => 0,
'quota_files' => 100000,
'permissions' => [
"/" => ["*"],
//"/somedir" => array("list", "download"),
],
'upload_bandwidth' => 0,
'download_bandwidth' => 0,
'filters' => [
'allowed_ip' => [],
'denied_ip' => [],
],
'public_keys' => [],
];
// If automatic groups mode is disabled, then you have to manually add the allowed groups into $allowed_groups down below:
// If enabled, then any groups you are a memberof will automatically be added in using the template below.
$auto_groups_mode = true;
$auto_groups_mode_virtual_folder_template = [
[
//"id" => 0,
"name" => "groups-#GROUP#",
"mapped_path" => 'C:\groups\#GROUP#',
//"used_quota_size" => 0,
//"used_quota_files" => 0,
//"last_quota_update" => 0,
"virtual_path" => "/groups/#GROUP#",
"quota_size" => -1,
"quota_files" => -1
]
];
// Used only when auto groups mode is enabled and will help prevent all your groups from being
// added into SFTPGo since only groups with the prefixes defined here will be automatically added
// with prefixes automatically removed when listed as a virtual folder (e.g. a group with name
// "sftpgo-example" would simply become "example").
$allowed_group_prefixes = [
'sftpgo-'
];
// List of groups where a virtual folder will be created and associated with any group members:
$allowed_groups = [];
// Note: that for each group you need to provide a nested array (this allows for more than one virtual folder per group to be defined):
$allowed_groups['example'] = [
[
//"id" => 0,
"name" => "groups-#GROUP#",
"mapped_path" => 'C:\groups\#GROUP#',
//"used_quota_size" => 0,
//"used_quota_files" => 0,
//"last_quota_update" => 0,
"virtual_path" => "/groups/#GROUP#",
"quota_size" => -1,
"quota_files" => -1
]
];
// Add a minimum length for usernames (set to 0 to ignore length):
$username_minimum_length = 4;
// This list of usernames will simply be ignored completed (no LDAP authentication will occur):
$username_blacklist = [
'admin',
'apagar',
'auto',
'bananapi',
'bdadmin',
'billing',
'bin',
'crm',
'csgoserver',
'deploy',
'eas',
'escaner',
'factorio',
'fedena',
'fernando',
'ftp',
'ftp_id',
'ftpserver',
'ftpuser',
'furukawa',
'gc',
'git',
'gitblit',
'gmod',
'guest',
'hxeadm',
'ircd',
'kafka',
'kk',
'koha',
'kms',
'mariadb',
'minecraft',
'mysql',
'node',
'odoo',
'oozie',
'openvpn',
'operator',
'oracle',
'pcguest',
'pi',
'platform',
'plcmspip',
'postgres',
'prueba',
'prueba1',
'rpm',
'root',
'rs',
'sample',
'secretaria',
'shutdown',
'sinus',
'squadserver',
'steam',
'student',
'student10',
'support',
'sysadmin',
'teacher',
'teacher1',
'teamspeak',
'temp',
'test',
'test1',
'test001',
'teste',
'testftp',
'trinity',
'ts3',
'ts3bot',
'ubuntu',
'user',
'usuario',
'uploader',
'vbox',
'vboxuser',
'voip',
'vyos',
'web5',
'webftp',
'www',
'www-data',
'zabbix',
'zte',
];