diff --git a/.codeclimate.yml b/.codeclimate.yml index 75cf8a1..0e443ca 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,9 +1,9 @@ -engines: +engines: eslint: enabled: true - channel: "eslint-3" + channel: "eslint-8" config: - config: ".eslintrc.json" + config: ".eslintrc.yaml" ratings: paths: diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 85e8420..ed7ccfe 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -2,6 +2,7 @@ env: node: true es6: true mocha: true + es2020: true plugins: - haraka diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index a3b4db0..957ccf3 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -8,5 +8,3 @@ Checklist: - [ ] docs updated - [ ] tests updated - [ ] Changes.md updated -- [ ] package.json.version bumped -- [ ] published to NPM (will be done by @core) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0449e4a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + allow: + - dependency-type: production diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d768329 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI + +on: [ push ] + +env: + CI: true + +jobs: + + lint: + uses: haraka/.github/.github/workflows/lint.yml@master + + # coverage: + # uses: haraka/.github/.github/workflows/coverage.yml@master + # secrets: inherit + + test: + needs: [ lint, get-lts ] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest ] + node-version: ${{ fromJson(needs.get-lts.outputs.active) }} + fail-fast: false + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + name: Node ${{ matrix.node-version }} on ${{ matrix.os }} + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test + + get-lts: + runs-on: ubuntu-latest + steps: + - id: get + uses: msimerson/node-lts-versions@v1 + outputs: + active: ${{ steps.get.outputs.active }} + lts: ${{ steps.get.outputs.lts }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..383aca2 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,13 @@ +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '18 7 * * 4' + +jobs: + codeql: + uses: haraka/.github/.github/workflows/codeql.yml@master diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..42a9bb9 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,14 @@ +name: publish + +on: + push: + branches: + - master + +env: + CI: true + +jobs: + publish: + uses: haraka/.github/.github/workflows/publish.yml@master + secrets: inherit \ No newline at end of file diff --git a/.gitignore b/.gitignore index 621038f..37f6313 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,6 @@ typings/ # dotenv environment variables file .env + +haraka-update.sh +package-lock.json diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a8e94cb --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule ".release"] + path = .release + url = git@github.com:msimerson/.release.git diff --git a/.release b/.release new file mode 160000 index 0000000..9be2b27 --- /dev/null +++ b/.release @@ -0,0 +1 @@ +Subproject commit 9be2b270ef836bcfefda085674bf62e2a91defe8 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 12abae8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: node_js -node_js: - - "8" - - "10" - - "12" - -services: -# https://docs.travis-ci.com/user/database-setup/ -# - mongodb -# - elasticsearch -# - redis-server - -before_script: - -script: - - npm run lint - - npm test - -after_success: - -# enable codecov, which doesn't currently work for plugins because -# plugins are run in vm.runInNewContext() -# -# - npm install istanbul codecov -# - npm run cover -# - ./node_modules/.bin/codecov - -sudo: false diff --git a/Changes.md b/Changes.md index 9c8bd42..a2e78c5 100644 --- a/Changes.md +++ b/Changes.md @@ -1,11 +1,27 @@ -# 1.0.2 - 2018-09-18 + +### Unreleased + +### [1.0.3] - 2022-06-06 + +- dep(async): bump version 3.0.1 -> 3.2.3 +- ci: replace appveyor & travis with GitHub Actions +- ci: add GHA shared workflows +- lint: object-shorthand, prefer-template + + +### 1.0.2 - 2018-09-18 - New: add PLAIN authentication -# 1.0.1 - 2018-03-24 + +### 1.0.1 - 2018-03-24 - Fix: properly load auth_ldap.ini -# 1.0.0 - 201_-__-__ + +### 1.0.0 - 2017-09-30 - initial release + + +[1.0.3]: https://github.com/haraka/haraka-plugin-auth-ldap/releases/tag/1.0.3 diff --git a/README.md b/README.md index 9cf20f3..86bc898 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ [![Build Status][ci-img]][ci-url] -[![Windows Build Status][ci-win-img]][ci-win-url] [![Code Climate][clim-img]][clim-url] -[![Greenkeeper badge][gk-img]][gk-url] [![NPM][npm-img]][npm-url] # haraka-plugin-auth-ldap @@ -44,15 +42,11 @@ Example: -[ci-img]: https://travis-ci.org/haraka/haraka-plugin-auth-ldap.svg -[ci-url]: https://travis-ci.org/haraka/haraka-plugin-auth-ldap -[ci-win-img]: https://ci.appveyor.com/api/projects/status/6m1g2de9s9s3bnij?svg=true -[ci-win-url]: https://ci.appveyor.com/project/msimerson/haraka-plugin-auth-ldap +[ci-img]: https://github.com/haraka/haraka-plugin-auth-ldap/actions/workflows/ci.yml/badge.svg +[ci-url]: https://github.com/haraka/haraka-plugin-auth-ldap/actions/workflows/ci.yml [cov-img]: https://codecov.io/github/haraka/haraka-plugin-auth-ldap/coverage.svg [cov-url]: https://codecov.io/github/haraka/haraka-plugin-auth-ldap [clim-img]: https://codeclimate.com/github/haraka/haraka-plugin-auth-ldap/badges/gpa.svg [clim-url]: https://codeclimate.com/github/haraka/haraka-plugin-auth-ldap -[gk-img]: https://badges.greenkeeper.io/haraka/haraka-plugin-auth-ldap.svg -[gk-url]: https://greenkeeper.io/ [npm-img]: https://nodei.co/npm/haraka-plugin-auth-ldap.png [npm-url]: https://www.npmjs.com/package/haraka-plugin-auth-ldap diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 8858bc2..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,20 +0,0 @@ -environment: - nodejs_version: "6" - -install: - - ps: Install-Product node $env:nodejs_version - - npm install - -before_build: -build: off -after_build: - -before_test: - - node --version - - npm --version - -test_script: - - npm test - -after_test: - diff --git a/index.js b/index.js index 494bbe9..0682221 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ exports.hook_capabilities = function (next, connection) { // Don't offer AUTH capabilities by default unless session is encrypted if (connection.tls.enabled) { const methods = [ 'PLAIN', 'LOGIN' ]; - connection.capabilities.push('AUTH ' + methods.join(' ')); + connection.capabilities.push(`AUTH ${ methods.join(' ')}`); connection.notes.allowed_auth_methods = methods; } next(); @@ -45,12 +45,12 @@ exports.check_plain_passwd = function (connection, user, passwd, cb) { url: ldap_url, timeout: (config.core.timeout != undefined) ? config.core.timeout : 5000, tlsOptions: { - rejectUnauthorized: rejectUnauthorized + rejectUnauthorized } }); client.on('error', function (err) { - connection.loginfo('auth_ldap: client error ' + err.message); + connection.loginfo(`auth_ldap: client error ${ err.message}`); cb(false); }); @@ -62,7 +62,7 @@ exports.check_plain_passwd = function (connection, user, passwd, cb) { dn = dn.replace(/%u/g, user); client.bind(dn, passwd, function (err) { if (err) { - connection.loginfo("auth_ldap: (" + dn + ") " + err.message); + connection.loginfo(`auth_ldap: (${ dn }) ${ err.message}`); return callback(false); } else { diff --git a/package.json b/package.json index e95e07c..603a372 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,12 @@ { "name": "haraka-plugin-auth-ldap", - "version": "1.0.2", + "version": "1.0.3", "description": "Haraka plugin that uses an LDAP bind to authenticate users", "main": "index.js", "scripts": { - "lint": "./node_modules/.bin/eslint *.js test/**/*.js", - "lintfix": "./node_modules/.bin/eslint --fix *.js test/**/*.js", - "cover": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha", - "test": "./node_modules/.bin/_mocha" + "lint": "npx eslint *.js test", + "lintfix": "npx eslint --fix *.js test", + "test": "npx _mocha" }, "repository": { "type": "git", @@ -25,13 +24,13 @@ }, "homepage": "https://github.com/haraka/haraka-plugin-auth-ldap#readme", "devDependencies": { - "eslint": ">=3", + "eslint": ">=8", "eslint-plugin-haraka": "*", "haraka-test-fixtures": "*", - "mocha": "*" + "mocha": ">=9" }, "dependencies": { - "async": "^3.0.1", - "ldapjs": "^1.0.1" + "async": "^3.2.3", + "ldapjs": "^1.0.2" } } diff --git a/test/.eslintrc.json b/test/.eslintrc.json deleted file mode 100644 index 8d978a0..0000000 --- a/test/.eslintrc.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "env": { - "mocha": true, - "node": true, - "es6": true - }, - "globals": { - "OK": true, - "CONT": true, - "DENY": true, - "DENYSOFT": true, - "DENYDISCONNECT": true, - "DENYSOFTDISCONNECT": true - } -}