|
1 | 1 | # MyLDAP
|
2 | 2 |
|
3 |
| -This is a small node LDAP server which uses a MySQL database internally. Usage: |
| 3 | +## Installation |
4 | 4 |
|
5 |
| - git clone https://github.com/cyber-tron/node-myldap.git |
6 |
| - cd node-myldap |
7 |
| - npm install |
8 |
| - npm start [port] |
| 5 | +Currently this project is not available in the node registry. Just check out this repository with `git clone https://github.com/cyber-tron/node-myldap.git`. Then, run `npm install` to fetch all project dependencies. Congratulations, you are ready to go! |
| 6 | + |
| 7 | +## Usage |
| 8 | + |
| 9 | +### Configuration |
| 10 | + |
| 11 | +Before you run MyLDAP for the first time, copy `config.json.example` and edit the MySQL connection. The configuration has the following format: |
| 12 | + |
| 13 | + * `ldap`: LDAP server configuration |
| 14 | + * `port`: The port, at wich the server will listen. Defaults to **1389**. |
| 15 | + * `dn`: The distinguished name of this server (e.g. *dc=example,dc=org*). |
| 16 | + * `backend`: MySQL backend configuration |
| 17 | + * `host`: The MySQL server host name or IP address. |
| 18 | + * `user`: The user used to connect to the database. |
| 19 | + * `pwd`: A password supplied when connecting. |
| 20 | + * `db`: The name of the database which contains user data. |
| 21 | + * `table`: The users table name in the database. |
| 22 | + * `attributes`: A list of attributes which will be served by the LDAP server. |
| 23 | + |
| 24 | +All fields in the configuration are mandatory, but some can also be left empty (e.g. `backend.pwd`). Attributes can be chosen freely, but the distinguished name (*dn*) is mandatory. |
| 25 | + |
| 26 | +### Production - myldapd |
| 27 | + |
| 28 | +Among source codes, the repository also contains the standalone executable `myldap` and the daemon `myldapd`. To start the server, you have to provide the path to a configuration file. In daemon mode, the server is started with |
| 29 | + |
| 30 | + myldapd start config.json |
9 | 31 |
|
10 |
| -The port defaults to `1389`. To stop the LDAP server simply run `npm stop`. |
| 32 | +The daemon also accepts `stop` and `restart` without further parameters. |
| 33 | + |
| 34 | +**Note:** You can also add the bin path to your PATH environment variable or link the binaries. This makes it easier to control the MyLDAP server at any time. |
| 35 | + |
| 36 | +### Development - NPM |
| 37 | + |
| 38 | +When using **NPM** to start the MyLDAP server, please make sure a valid `config.json` exists in the project root. Then, simply run: |
| 39 | + |
| 40 | + npm start |
| 41 | + |
| 42 | +The NPM script also accepts all other commands of myldapd. |
0 commit comments