I'm a beginner and I'm learning about FreeRADIUS and DaloRADIUS to implement authentication on a network. I would like to know how to create a personalized login page that allows new users to register, integrating it with FreeRADIUS and DaloRADIUS
Freeradius 3.0 nodejs ` const bcrypt = require('bcrypt'); const db = require('../models/dbConfig');
const registerUser = async (username, password) => {
const hashedPassword = await bcrypt.hash(password, 10);
const sql = INSERT INTO radcheck (username, attribute, op, value) VALUES (?, 'Cleartext-Password', ':=', ?)
;
try {
const [results] = await db.query(sql, [username, hashedPassword]);
if (results.insertId) {
console.log('User registered successfully:', results);
return { userId: results.insertId };
} else {
console.log('Failed to insert user, result:', results);
throw new Error('Registration failed');
}
} catch (error) {
console.error('Error registering user:', error);
throw error;
}
};
const loginUser = async (username, password) => {
const sql = SELECT * FROM radcheck WHERE username = ? AND attribute = 'Cleartext-Password'
;
try {
const [results] = await db.query(sql, [username]);
if (results.length > 0) {
const user = results[0];
const isMatch = await bcrypt.compare(password, user.value);
return isMatch;
} else {
return false;
}
} catch (error) {
console.error('Error authenticating user:', error);
throw error;
}
};
module.exports = { registerUser, loginUser }; `
Could anyone provide me with a step-by-step tutorial or practical examples of how to configure and integrate a login page with FreeRADIUS and DaloRADIUS? I'm particularly interested in learning how to allow new users to register directly through the interface
I even managed to get the user to register and save it in the radcheck
table but it is not authenticated after registration