This repository was archived by the owner on Apr 9, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconfig.default.js
More file actions
328 lines (311 loc) · 9.25 KB
/
config.default.js
File metadata and controls
328 lines (311 loc) · 9.25 KB
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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
/**
* ===========================
* IEDON-PEERAPI
* Configutation
* ===========================
*/
export default {
listen: {
type: 'unix', // 'tcp' or 'unix'
hostname: 'localhost',
port: 3000,
path: '/var/run/peerapi.sock'
},
loggerSettings: {
provider: 'log4js',
log4js: {
appenders: {
stdout: {
type: 'stdout'
},
app: {
type: 'file',
filename: './logs/app/app.log',
compress: true,
backups: 7,
maxLogSize: 10485760,
keepFileExt: true
},
acorle: {
type: 'file',
filename: './logs/acorle/acorle.log',
compress: true,
backups: 7,
maxLogSize: 10485760,
keepFileExt: true
},
mail: {
type: 'file',
filename: './logs/mail/mail.log',
compress: true,
backups: 7,
maxLogSize: 10485760,
keepFileExt: true
},
whois: {
type: 'file',
filename: './logs/whois/whois.log',
compress: true,
backups: 7,
maxLogSize: 10485760,
keepFileExt: true
},
fetch: {
type: 'file',
filename: './logs/fetch/fetch.log',
compress: true,
backups: 7,
maxLogSize: 10485760,
keepFileExt: true
},
auth: {
type: 'file',
filename: './logs/auth/auth.log',
compress: true,
backups: 7,
maxLogSize: 10485760,
keepFileExt: true
},
ssh: {
type: 'file',
filename: './logs/ssh/ssh.log',
compress: true,
backups: 7,
maxLogSize: 10485760,
keepFileExt: true
}
},
categories: {
default: {
level: 'info',
appenders: ['stdout']
},
app: {
level: 'info',
appenders: ['app']
},
acorle: {
level: 'info',
appenders: ['acorle']
},
database: {
level: 'debug',
appenders: ['stdout']
},
mail: {
level: 'info',
appenders: ['mail']
},
whois: {
level: 'info',
appenders: ['whois']
},
fetch: {
level: 'info',
appenders: ['fetch']
},
auth: {
level: 'info',
appenders: ['auth']
},
ssh: {
level: 'info',
appenders: ['ssh']
}
}
}
},
// Integration with acorle microservice
acorle: {
enabled: false,
zone: 'dev',
secret: '',
regIntervalSeconds: 30,
centerServerUrl: 'http://',
localUrl: 'http://',
// To configure which configuration we will use, from center server via acorle, or configuration presented below
retriveConfigFromCenterServer: true,
configKey: 'peerapi_config',
serviceKey: 'peerapi',
serviceName: 'iEdon PeerAPI'
},
// ** The following configutations can be retrived via acorle **
authHandler: {
stateSignSecret: '__DEMO__STATE_SIGN_SECRET__',
stateSignOptions: {
algorithm: 'HS256',
expiresIn: '10m' // where sign-in state(via mail, pgp, ssh) expires
},
agentApiKey: '__DEMO__AGENT_API_TOKEN__', // PeerAPIConfig.secret in agent
},
sshAuthServerSettings: { // This app will starts a ssh server to accept connections to auth with us
provider: 'default',
challengeHint: 'ssh [-o "IdentitiesOnly=yes" -i ~/.ssh/id_rsa|ed25519] iedon.net -p 4222',
ssh2: {
listen: {
type: 'tcp', // tcp or unix
port: 4222,
hostname: 'localhost',
path: '/var/run/peerapi-ssh.sock' // unix domain socket
},
hostKeysPath: [
'/etc/ssh/ssh_host_rsa_key'
],
timeoutSeconds: 120,
bannerText: [
'==================================================',
'Welcome to the IEDON-NET DN42 Auth Server!',
'Kopiere den folgenden Herausforderungstext, um dich anzumelden.',
'サインインするには、次のチャレンジテキストをコピーしてください。',
'複製以下挑戰文本以登入。',
'复制以下挑战文本以登录。',
'==================================================',
]
}
},
dbSettings: {
dialect: 'mysql', /* sqlite */
storage: '', /* for sqlite */
host: 'localhost',
port: 3306,
user: '',
password: '',
database: 'iedon-peerapi',
pool: {
max: 5,
min: 1,
idle: 10000
},
logging: true,
alter: false, // set to true to alter database schema on startup
dialectOptions: {}
},
redisSettings: {
driver: {
host: 'localhost',
port: 6379,
username: "default", // needs Redis >= 6
password: '',
db: 0,
keyPrefix: 'peerapi:',
maxRetriesPerRequest: 1,
enableOfflineQueue: false
}
},
mailSettings: {
enableLoginByMail: false,
provider: 'default', // change to nodemailer to use smtp and fill configuration section bellow
senderEmailAddress: 'dn42@localhost.localdomain',
logging: true,
limit: {
maxEmailsPerDay: 500,
maxEmailsPerHour: 100,
maxEmailsPerMinute: 10
},
templateFile: './emailTemplate.html', // path to email template file
nodemailer: {
host: 'smtp.localhost.localdomain',
port: 465,
secure: true,
auth: {
user: '',
pass: ''
}
},
acorle: { // configuration for acorle mail provider(via microservice)
serviceKey: 'dn42_send_mail' // service key for RPC
}
},
whoisSettings: {
provider: 'default', // default provider is using whois package and takes whois configuration section bellow
logging: true,
whois: {
server: 'whois.dn42', // this can be a string ("host:port") or an object with host and port as its keys; leaving it empty makes lookup rely on servers.json
follow: 2, // number of times to follow redirects
timeout: 10000, // socket timeout, excluding this doesn't override any default timeout value
verbose: false, // setting this to true returns an array of responses from all servers
bind: null, // bind the socket to a local IP address
// proxy: { // (optional) SOCKS Proxy
// host: "",
// port: 0,
// type: 5 // or 4
// }
},
acorle: { // configuration for acorle whois provider(via microservice)
serviceKey: 'dn42_whois' // service key for RPC
}
},
fetchSettings: {
provider: 'default', // default provider is using urllib package and takes fetch configuration section bellow
logging: true,
fetch: {
options: {
timeout: 10000,
cache: 'no-cache',
headers: {
'User-Agent': 'iEdon-PeerAPI'
},
}
},
},
openAuthSettings: {
providers: [ 'kioubit', 'default' ],
kioubit: {
myDomain: 'iedon.net',
notAllowed: [ 4242422189 ],
publicKey: './kioubitAuth.pem'
},
},
tokenSettings: {
provider: 'default', // default provider is using jsonwebtoken package and takes jwt configuration section bellow
logging: true,
jwt: {
secret: '__DEMO_SECRET_IEDON_PEERAPI__',
options: {
algorithm: 'HS256',
expiresIn: '5m'
}
},
acorle: { // configuration for acorle auth provider(via microservice)
serviceKey: 'dn42_token' // service key for RPC
}
},
metricSettings: {
maxRecordsToKeep: 288, // 288 records = 24 hours with 5 minutes interval
redisLockTimeoutMs: 10000, // 10 seconds
exporter: {
scannerBatchSize: 200, // number of keys to scan in one batch when exporting metrics
allowedBasicAuthUsers: [ // Recommended HTTPS endpoint
{
username: 'admin',
password: 'admin'
}
]
}
},
probeServerSettings: {
enabled: true,
sessionHealthyTimeoutSec: 300, // 5min, if no data received in this time, session is considered unhealthy
bindUdpPort: 2189,
bindAddress4: '0.0.0.0',
bindAddress6: '::',
encryptionKey: '___DEMO__PROBE_32_PACKET__KEY___',
expectedBanner: 'iEdon-Net PeerAPI Peering Prober',
maxPacketLength: 512,
timestampToleranceSec: 120, // Anti replay tolerance for packet timestamp
},
// Configure CORS, preflight headers and custom headers here
preflightHeaders: {
'Access-Control-Request-Method': 'POST',
'Access-Control-Request-Headers': 'X-PINGOTHER, Content-Type',
'Access-Control-Allow-Methods': 'POST, OPTIONS',
'Access-Control-Max-Age': '86400'
},
corsHeaders: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'X-PeerAPI-Version, Content-Type, Authorization'
},
customHeaders: {
'X-Powered-By': 'PHP/8.4.11'
}
}