Uhhmmm.... have you looked into stopforumspam?
Not a silver bullet but never hurts to have one more arrow in yer' quiver, eh?
Might be worth a gander? 🤔 🌴 🌴
Hello.
NodeBB crashing when I filling nodebb-plugin-node-ldap settings value.
After save settings beginning rebuilding and restart and then i get error
2023-01-12T21:17:50.028Z [4567/275] - error: uncaughtException: Cannot read properties of undefined (reading 'search')
TypeError: Cannot read properties of undefined (reading 'search')
at /usr/src/app/node_modules/@nodebb/nodebb-plugin-node-ldap/index.js:117:29
at /usr/src/app/node_modules/@nodebb/nodebb-plugin-node-ldap/index.js:150:28
at callbackWrapper (/usr/src/app/node_modules/ldapjs/lib/client/client.js:292:5)
at sendResult (/usr/src/app/node_modules/ldapjs/lib/client/client.js:1193:37)
at messageCallback (/usr/src/app/node_modules/ldapjs/lib/client/client.js:1216:18)
at Parser.onMessage (/usr/src/app/node_modules/ldapjs/lib/client/client.js:884:14)
at Parser.emit (node:events:513:28)
at Parser.write (/usr/src/app/node_modules/ldapjs/lib/messages/parser.js:107:8)
at Socket.onData (/usr/src/app/node_modules/ldapjs/lib/client/client.js:871:22)
at Socket.emit (node:events:513:28) {"date":"Thu Jan 12 2023 21:17:50 GMT+0000 (Coordinated Universal Time)","error":{},"exception":true,"os":{"loadavg":[0.53,0.19,0.17],"uptime":7368033.42},"process":{"argv":["/usr/local/bin/node","/usr/src/app/app.js"],"cwd":"/usr/src/app","execPath":"/usr/local/bin/node","gid":1000,"memoryUsage":{"arrayBuffers":808907,"external":2855723,"heapTotal":109543424,"heapUsed":76714472,"rss":159031296},"pid":275,"uid":1000,"version":"v18.13.0"},"stack":"TypeError: Cannot read properties of undefined (reading 'search')\n at /usr/src/app/node_modules/@nodebb/nodebb-plugin-node-ldap/index.js:117:29\n at /usr/src/app/node_modules/@nodebb/nodebb-plugin-node-ldap/index.js:150:28\n at callbackWrapper (/usr/src/app/node_modules/ldapjs/lib/client/client.js:292:5)\n at sendResult (/usr/src/app/node_modules/ldapjs/lib/client/client.js:1193:37)\n at messageCallback (/usr/src/app/node_modules/ldapjs/lib/client/client.js:1216:18)\n at Parser.onMessage (/usr/src/app/node_modules/ldapjs/lib/client/client.js:884:14)\n at Parser.emit (node:events:513:28)\n at Parser.write (/usr/src/app/node_modules/ldapjs/lib/messages/parser.js:107:8)\n at Socket.onData (/usr/src/app/node_modules/ldapjs/lib/client/client.js:871:22)\n at Socket.emit (node:events:513:28)","trace":[{"column":29,"file":"/usr/src/app/node_modules/@nodebb/nodebb-plugin-node-ldap/index.js","function":null,"line":117,"method":null,"native":false},{"column":28,"file":"/usr/src/app/node_modules/@nodebb/nodebb-plugin-node-ldap/index.js","function":null,"line":150,"method":null,"native":false},{"column":5,"file":"/usr/src/app/node_modules/ldapjs/lib/client/client.js","function":"callbackWrapper","line":292,"method":null,"native":false},{"column":37,"file":"/usr/src/app/node_modules/ldapjs/lib/client/client.js","function":"sendResult","line":1193,"method":null,"native":false},{"column":18,"file":"/usr/src/app/node_modules/ldapjs/lib/client/client.js","function":"messageCallback","line":1216,"method":null,"native":false},{"column":14,"file":"/usr/src/app/node_modules/ldapjs/lib/client/client.js","function":"Parser.onMessage","line":884,"method":"onMessage","native":false},{"column":28,"file":"node:events","function":"Parser.emit","line":513,"method":"emit","native":false},{"column":8,"file":"/usr/src/app/node_modules/ldapjs/lib/messages/parser.js","function":"Parser.write","line":107,"method":"write","native":false},{"column":22,"file":"/usr/src/app/node_modules/ldapjs/lib/client/client.js","function":"Socket.onData","line":871,"method":"onData","native":false},{"column":28,"file":"node:events","function":"Socket.emit","line":513,"method":"emit","native":false}]}
And forum not running after that while I not disable manually plugin via ./nodebb reset -p @nodebb/nodebb-plugin-node-ldap
NodeBB i run in docker like that
version: '3.5'
services:
nodebb-forum:
image: nodebb/docker:latest
restart: unless-stopped
volumes:
- /projects/NodeBB/app:/usr/src/app
ports:
- "4567:4567"
NodeBB v 2.8.1 and nodebb-plugin-node-ldap v 2.0.2
@baris Yes, with 2.0.3 crashes disappeared and now in logs i see belowe:
(node:409) [LRU_CACHE_UNBOUNDED] UnboundedCacheWarning: TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.
(Use `node --trace-warnings ...` to show where the warning was created)
config seems invalid Error: could not bind with admin config 80090308: LdapErr: DSID-0C090447, comment: AcceptSecurityContext error, data 57, v3839
at /usr/src/app/node_modules/@nodebb/nodebb-plugin-node-ldap/index.js:150:37
at callbackWrapper (/usr/src/app/node_modules/ldapjs/lib/client/client.js:292:5)
at sendResult (/usr/src/app/node_modules/ldapjs/lib/client/client.js:1193:37)
at messageCallback (/usr/src/app/node_modules/ldapjs/lib/client/client.js:1216:18)
at Parser.onMessage (/usr/src/app/node_modules/ldapjs/lib/client/client.js:884:14)
at Parser.emit (node:events:513:28)
at Parser.write (/usr/src/app/node_modules/ldapjs/lib/messages/parser.js:107:8)
at Socket.onData (/usr/src/app/node_modules/ldapjs/lib/client/client.js:871:22)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
2023-01-13T16:25:39.673Z [4567/409] - warn: [authentication] Login override detected, skipping local login strategy.
Next step would be to check if the config is saved properly in the acp, that error indicates the plugin is unable to connect in this function.
adminClient: (callback) => {
const tlsOptions = {'rejectUnauthorized': false}
const client = ldapjs.createClient({
url: master_config.server + ':' + master_config.port,
tlsOptions: tlsOptions,
timeout: 2000
});
client.on('error', error => callback(error));
client.bind(master_config.admin_user, master_config.password, (err) => {
if (err) {
return callback(new Error('could not bind with admin config ' + err.message));
}
callback(null, client);
});
},
@baris Thanks. I fix my ldap settings and it's worked.
But now i have another issue. New user creating everytime when I try auth for same user. It's creating username like username, username 0, username 1 and etc.
Should it works like that? How can i get user from ldap once and after that login under that user?