haraka-plugin-karma 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ #!/bin/sh
2
+
3
+ branch_is_master()
4
+ {
5
+ if [ "$(git branch --show-current)" = "master" ]; then
6
+ return 0
7
+ fi
8
+
9
+ return 1
10
+ }
11
+
12
+ repo_is_clean()
13
+ {
14
+ if [ -z "$(git status --porcelain)" ]; then
15
+ return 0
16
+ fi
17
+
18
+ return 1
19
+ }
20
+
21
+ assure_repo_is_clean()
22
+ {
23
+ if repo_is_clean; then return 0; fi
24
+
25
+ echo
26
+ echo "ERROR: Uncommitted changes, cowardly refusing to continue..."
27
+ echo
28
+ sleep 2
29
+
30
+ git status
31
+
32
+ return 1
33
+ }
34
+
35
+ find_changelog()
36
+ {
37
+ CHANGELOG=$(ls [Cc][Hh][Aa]*.md)
38
+ export CHANGELOG
39
+ #echo "I found your CHANGELOG at: $CHANGELOG"
40
+ }
package/.release/do.sh ADDED
@@ -0,0 +1,51 @@
1
+ #!/bin/sh
2
+
3
+ usage() {
4
+ echo "do.sh {major | minor | patch}"
5
+ exit
6
+ }
7
+
8
+ . .release/base.sh || exit
9
+
10
+ case "$1" in
11
+ "major" )
12
+ ;;
13
+ "minor" )
14
+ ;;
15
+ "patch" )
16
+ ;;
17
+ *)
18
+ usage
19
+ ;;
20
+ esac
21
+
22
+ NEW_VERSION=$(npm --no-git-tag-version version "$1")
23
+
24
+ YMD=$(date "+%Y-%m-%d")
25
+ # echo "Preparing $NEW_VERSION - $YMD"
26
+
27
+ if branch_is_master; then
28
+ git checkout -b "release-${NEW_VERSION}"
29
+ fi
30
+
31
+ update_changes() {
32
+ tee .release/new.txt <<EO_CHANGE
33
+
34
+
35
+ #### ${NEW_VERSION//v} - $YMD
36
+
37
+ -
38
+ -
39
+ EO_CHANGE
40
+
41
+ sed -i '' -e "/#### N.N.N.*$/r .release/new.txt" "$CHANGELOG"
42
+ rm .release/new.txt
43
+
44
+ if command -v open; then open "$CHANGELOG"; fi
45
+
46
+ echo
47
+ echo "AFTER editing $CHANGELOG, run: .release/push.sh"
48
+ }
49
+
50
+ find_changelog
51
+ update_changes
@@ -0,0 +1,23 @@
1
+ #!/bin/sh
2
+
3
+ . .release/base.sh || exit
4
+
5
+ if branch_is_master; then
6
+ echo "ERROR: run the release scripts in a feature branch! (not master)"
7
+ exit
8
+ fi
9
+
10
+ VERSION=$(node -e 'console.log(require("./package.json").version)')
11
+
12
+ find_changelog
13
+
14
+ git add package.json
15
+ git add "$CHANGELOG"
16
+
17
+ git commit -m "Release v$VERSION"
18
+
19
+ git push --set-upstream origin "$(git branch --show-current)"
20
+
21
+ if command -v gh; then
22
+ gh pr create
23
+ fi
package/Changes.md CHANGED
@@ -1,91 +1,94 @@
1
1
 
2
- ### 2.0.2 - 2022-05-27
2
+ #### N.N.N - YYYY-MM-DD
3
+
4
+
5
+ #### 2.0.3 - 2022-05-28
3
6
 
4
7
  - fix: depend directly on redis
5
8
  - fix: update redis command names for v4 compatibility
6
9
  - fix: update redis commands to be async
7
10
 
8
11
 
9
- ### 2.0.1 - 2022-05-27
12
+ #### 2.0.1 - 2022-05-27
10
13
 
11
14
  - chore(ci): depend on shared GHA workflows
12
15
 
13
16
 
14
- ### 2.0.0 - 2022-03-29
17
+ #### 2.0.0 - 2022-03-29
15
18
 
16
19
  - remove lots of plugin=this
17
20
  - remove unnecessary braces and trailing ;
18
21
  - some promises.
19
22
 
20
23
 
21
- ### 1.0.14 - 2022-02-14
24
+ #### 1.0.14 - 2022-02-14
22
25
 
23
26
  - try to unsubscribe in case connection is marked to skip during transaction
24
27
 
25
28
 
26
- ### 1.0.13 - 2019-04-23
29
+ #### 1.0.13 - 2019-04-23
27
30
 
28
31
  - add 'exists' pattern
29
32
 
30
33
 
31
- ### 1.0.12 - 2019-03-08
34
+ #### 1.0.12 - 2019-03-08
32
35
 
33
36
  - don't interfere with STARTLS and AUTH when karma is listed above those plugins in config/plugins
34
37
 
35
38
 
36
- ### 1.0.11 - 2017-10-25
39
+ #### 1.0.11 - 2017-10-25
37
40
 
38
41
  - private addresses and flagged connections exemption
39
42
 
40
43
 
41
- ### 1.0.10 - 2017-08-30
44
+ #### 1.0.10 - 2017-08-30
42
45
 
43
46
  - add TLS awards #19
44
47
 
45
48
 
46
- ### 1.0.9 - 2017-07-29
49
+ #### 1.0.9 - 2017-07-29
47
50
 
48
51
  - splash on some es6
49
52
  - add AppVeyor CI testing
50
53
 
51
54
 
52
- ### 1.0.8 - 2017-06-26
55
+ #### 1.0.8 - 2017-06-26
53
56
 
54
57
  - revert #9, it breaks current Haraka deployments
55
58
 
56
59
 
57
- ### 1.0.7 - 2017-06-16
60
+ #### 1.0.7 - 2017-06-16
58
61
 
59
62
  - update for eslint 4 compat
60
63
  - Add results_redis_publish=true for haraka-results changes #9
61
64
 
62
65
 
63
- ### 1.0.6 - 2017-05-04
66
+ #### 1.0.6 - 2017-05-04
64
67
 
65
68
  - emit error if redis plugin didn't create connection
66
69
 
67
70
 
68
- ### 1.0.5 - 2017-02-06
71
+ #### 1.0.5 - 2017-02-06
69
72
 
70
73
  - move merge_redis_ini into load_karma_ini, so it also gets applied
71
74
  after a karma.ini change
72
75
  - skip redis operations when no connection exists
73
76
 
74
77
 
75
- ### 1.0.4 - 2017-01-29
78
+ #### 1.0.4 - 2017-01-29
76
79
 
77
80
  - use the new haraka-plugin-redis
78
81
  - remove exceptions for soft denials. This makes denial time simpler.
79
82
  - rules updates
80
83
 
81
84
 
82
- ### 1.0.3 - 2017-01-27
85
+ #### 1.0.3 - 2017-01-27
83
86
 
84
87
  - add rule #280 for known-senders
85
88
  - add support for 'length' type, with eq, gt, and lt operators
86
89
  - use shared haraka-eslint
87
90
 
88
91
 
89
- ### 1.0.2 - 2017-01-24
92
+ #### 1.0.2 - 2017-01-24
90
93
 
91
94
  - use redis.merge_redis_ini()
package/index.js CHANGED
@@ -562,10 +562,8 @@ exports.ip_history_from_redis = function (next, connection) {
562
562
  .hIncrBy(dbkey, 'connections', 1) // increment total conn
563
563
  .expire(dbkey, expire) // extend expiration
564
564
  .exec()
565
- .then(replies => {
566
- console.log(replies)
567
- }).catch(err2 => {
568
- connection.results.add(plugin, {err: err2})
565
+ .catch(err => {
566
+ connection.results.add(plugin, { err })
569
567
  })
570
568
 
571
569
  const results = {
@@ -587,7 +585,7 @@ exports.ip_history_from_redis = function (next, connection) {
587
585
  connection.results.add(plugin, results)
588
586
 
589
587
  plugin.check_awards(connection)
590
- return next()
588
+ next()
591
589
  })
592
590
  .catch(err => {
593
591
  connection.results.add(plugin, { err })
@@ -982,9 +980,9 @@ exports.check_asn = function (connection, asnkey) {
982
980
  })
983
981
  }
984
982
 
985
- exports.init_ip = function (dbkey, rip, expire) {
983
+ exports.init_ip = async function (dbkey, rip, expire) {
986
984
  if (!this.db) return
987
- this.db.multi()
985
+ await this.db.multi()
988
986
  .hmSet(dbkey, {'bad': 0, 'good': 0, 'connections': 1})
989
987
  .expire(dbkey, expire)
990
988
  .exec()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haraka-plugin-karma",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "A heuristics scoring and reputation engine for SMTP connections",
5
5
  "main": "index.js",
6
6
  "scripts": {