This commit is contained in:
parent
c2e295f777
commit
bb6f3b4cfd
|
@ -31,7 +31,7 @@ RUN apt-get update \
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
samba-common-bin \
|
samba-common-bin samba-dsdb-modules\
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& npm -g install pm2
|
&& npm -g install pm2
|
||||||
|
|
||||||
|
|
|
@ -33,16 +33,17 @@ module.exports = Self => {
|
||||||
.split('.')
|
.split('.')
|
||||||
.map(part => `dc=${part}`)
|
.map(part => `dc=${part}`)
|
||||||
.join(',');
|
.join(',');
|
||||||
const ldapUser = `cn=${this.adUser},cn=Users,${baseDn}`;
|
const bindDn = `cn=${this.adUser},cn=Users,${baseDn}`;
|
||||||
|
|
||||||
const adClient = ldap.createClient({
|
const adClient = ldap.createClient({
|
||||||
url: `ldaps://${this.adController}:636`,
|
url: `ldaps://${this.adController}:636`,
|
||||||
tlsOptions: {rejectUnauthorized: this.verifyCert}
|
tlsOptions: {rejectUnauthorized: this.verifyCert}
|
||||||
});
|
});
|
||||||
await adClient.bind(ldapUser, this.adPassword);
|
await adClient.bind(bindDn, this.adPassword);
|
||||||
Object.assign(this, {
|
Object.assign(this, {
|
||||||
adClient,
|
adClient,
|
||||||
fullUsersDn: `${this.userDn},${baseDn}`
|
fullUsersDn: `${this.userDn},${baseDn}`,
|
||||||
|
bindDn
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -51,11 +52,14 @@ module.exports = Self => {
|
||||||
},
|
},
|
||||||
|
|
||||||
async sambaTool(command, args = []) {
|
async sambaTool(command, args = []) {
|
||||||
const authArgs = [
|
let authArgs = [
|
||||||
'--URL', `ldap://${this.adController}`,
|
'--URL', `ldaps://${this.adController}`,
|
||||||
'--username', this.adUser,
|
'--simple-bind-dn', this.bindDn,
|
||||||
'--password', this.adPassword
|
'--password', this.adPassword
|
||||||
];
|
];
|
||||||
|
if (!this.verifyCert)
|
||||||
|
authArgs.push('--option', 'tls verify peer = no_check');
|
||||||
|
|
||||||
const allArgs = [command].concat(
|
const allArgs = [command].concat(
|
||||||
args, authArgs
|
args, authArgs
|
||||||
);
|
);
|
||||||
|
@ -151,8 +155,8 @@ module.exports = Self => {
|
||||||
*/
|
*/
|
||||||
async getUsers(usersToSync) {
|
async getUsers(usersToSync) {
|
||||||
const LDAP_MATCHING_RULE_BIT_AND = '1.2.840.113556.1.4.803';
|
const LDAP_MATCHING_RULE_BIT_AND = '1.2.840.113556.1.4.803';
|
||||||
// eslint-disable-next-line max-len
|
const filter = `!(userAccountControl:${LDAP_MATCHING_RULE_BIT_AND}`
|
||||||
const filter = `!(userAccountControl:${LDAP_MATCHING_RULE_BIT_AND}:=${UserAccountControlFlags.ACCOUNTDISABLE})`;
|
+ `:=${UserAccountControlFlags.ACCOUNTDISABLE})`;
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
scope: 'sub',
|
scope: 'sub',
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<vn-card class="vn-pa-lg" vn-focus>
|
<vn-card class="vn-pa-lg" vn-focus>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-check
|
<vn-check
|
||||||
label="Enable synchronization"
|
label="Enable synchronization"
|
||||||
ng-model="watcher.hasData">
|
ng-model="watcher.hasData">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
|
@ -20,28 +20,33 @@
|
||||||
ng-if="watcher.hasData"
|
ng-if="watcher.hasData"
|
||||||
class="vn-mt-md">
|
class="vn-mt-md">
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
label="AD domain"
|
label="AD domain"
|
||||||
ng-model="$ctrl.config.adDomain"
|
ng-model="$ctrl.config.adDomain"
|
||||||
rule="SambaConfig">
|
rule="SambaConfig">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
label="Domain controller"
|
label="Domain controller"
|
||||||
ng-model="$ctrl.config.adController"
|
ng-model="$ctrl.config.adController"
|
||||||
rule="SambaConfig">
|
rule="SambaConfig">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
label="AD user"
|
label="AD user"
|
||||||
ng-model="$ctrl.config.adUser"
|
ng-model="$ctrl.config.adUser"
|
||||||
rule="SambaConfig">
|
rule="SambaConfig">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
label="AD password"
|
label="AD password"
|
||||||
ng-model="$ctrl.config.adPassword"
|
ng-model="$ctrl.config.adPassword"
|
||||||
type="password"
|
type="password"
|
||||||
rule="SambaConfig">
|
rule="SambaConfig">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
label="User DN (without domain part)"
|
||||||
|
ng-model="$ctrl.config.userDn"
|
||||||
|
rule="SambaConfig">
|
||||||
|
</vn-textfield>
|
||||||
<vn-check
|
<vn-check
|
||||||
label="Verify certificate"
|
label="Verify certificate"
|
||||||
ng-model="$ctrl.config.verifyCert">
|
ng-model="$ctrl.config.verifyCert">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
|
@ -63,4 +68,4 @@
|
||||||
ng-click="watcher.loadOriginalData()">
|
ng-click="watcher.loadOriginalData()">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
</vn-button-bar>
|
</vn-button-bar>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -3,6 +3,7 @@ Domain controller: Controlador de dominio
|
||||||
AD domain: Dominio AD
|
AD domain: Dominio AD
|
||||||
AD user: Usuario AD
|
AD user: Usuario AD
|
||||||
AD password: Contraseña AD
|
AD password: Contraseña AD
|
||||||
|
User DN (without domain part): DN usuarios (sin la parte del dominio)
|
||||||
Verify certificate: Verificar certificado
|
Verify certificate: Verificar certificado
|
||||||
Test connection: Probar conexión
|
Test connection: Probar conexión
|
||||||
Samba connection established!: ¡Conexión con Samba establecida!
|
Samba connection established!: ¡Conexión con Samba establecida!
|
||||||
|
|
Loading…
Reference in New Issue