infinispan 0.11.0 → 0.13.0

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.
Files changed (95) hide show
  1. package/README.md +1 -1
  2. package/lib/protostream/query.proto +1 -1
  3. package/package.json +9 -9
  4. package/.eslintrc +0 -25
  5. package/.flowconfig +0 -6
  6. package/Jenkinsfile +0 -50
  7. package/Jenkinsfile-release +0 -63
  8. package/documentation/asciidoc/stories/assembly_client_usage_examples.adoc +0 -10
  9. package/documentation/asciidoc/stories/assembly_installation_configuration.adoc +0 -20
  10. package/documentation/asciidoc/titles/js_client.asciidoc +0 -28
  11. package/documentation/asciidoc/titles/stories.adoc +0 -5
  12. package/documentation/asciidoc/topics/attributes/community-attributes.adoc +0 -9
  13. package/documentation/asciidoc/topics/attributes/downstream-attributes.adoc +0 -2
  14. package/documentation/asciidoc/topics/code_examples/authentication-digest.js +0 -12
  15. package/documentation/asciidoc/topics/code_examples/authentication-external.js +0 -15
  16. package/documentation/asciidoc/topics/code_examples/authentication-oauthbearer.js +0 -10
  17. package/documentation/asciidoc/topics/code_examples/authentication-plain.js +0 -11
  18. package/documentation/asciidoc/topics/code_examples/authentication-scram.js +0 -11
  19. package/documentation/asciidoc/topics/code_examples/await-multiple-entries.js +0 -36
  20. package/documentation/asciidoc/topics/code_examples/await-single-entries.js +0 -29
  21. package/documentation/asciidoc/topics/code_examples/conditional-operations.js +0 -57
  22. package/documentation/asciidoc/topics/code_examples/connection-multiple-servers.js +0 -23
  23. package/documentation/asciidoc/topics/code_examples/connection-xsite-cluster-switch.js +0 -39
  24. package/documentation/asciidoc/topics/code_examples/connection-xsite.js +0 -13
  25. package/documentation/asciidoc/topics/code_examples/data-types.js +0 -30
  26. package/documentation/asciidoc/topics/code_examples/encryption-crypto-store.js +0 -11
  27. package/documentation/asciidoc/topics/code_examples/encryption-private-key.js +0 -13
  28. package/documentation/asciidoc/topics/code_examples/encryption-sni-hostname.js +0 -9
  29. package/documentation/asciidoc/topics/code_examples/encryption-trust-certs.js +0 -8
  30. package/documentation/asciidoc/topics/code_examples/ephemeral-data.js +0 -52
  31. package/documentation/asciidoc/topics/code_examples/hello-world.js +0 -42
  32. package/documentation/asciidoc/topics/code_examples/key-value-converter.js +0 -67
  33. package/documentation/asciidoc/topics/code_examples/logging-configuration.js +0 -2
  34. package/documentation/asciidoc/topics/code_examples/multiple-entries.js +0 -64
  35. package/documentation/asciidoc/topics/code_examples/queries.js +0 -92
  36. package/documentation/asciidoc/topics/code_examples/register-event-listener.js +0 -64
  37. package/documentation/asciidoc/topics/code_examples/sample-script-execute.js +0 -33
  38. package/documentation/asciidoc/topics/code_examples/sample-script.js +0 -3
  39. package/documentation/asciidoc/topics/code_examples/single-entries.js +0 -49
  40. package/documentation/asciidoc/topics/config_examples/logging.json +0 -14
  41. package/documentation/asciidoc/topics/proc_configuring_authentication.adoc +0 -16
  42. package/documentation/asciidoc/topics/proc_configuring_connections.adoc +0 -25
  43. package/documentation/asciidoc/topics/proc_configuring_connections_xsite.adoc +0 -18
  44. package/documentation/asciidoc/topics/proc_configuring_data_formats.adoc +0 -30
  45. package/documentation/asciidoc/topics/proc_configuring_encryption.adoc +0 -15
  46. package/documentation/asciidoc/topics/proc_configuring_logging.adoc +0 -28
  47. package/documentation/asciidoc/topics/proc_installing_clients.adoc +0 -58
  48. package/documentation/asciidoc/topics/proc_switching_clusters.adoc +0 -17
  49. package/documentation/asciidoc/topics/ref_authentication_mechanisms.adoc +0 -68
  50. package/documentation/asciidoc/topics/ref_client_usage.adoc +0 -128
  51. package/documentation/asciidoc/topics/ref_encryption.adoc +0 -71
  52. package/gen-jsdoc.sh +0 -6
  53. package/make-ssl.sh +0 -335
  54. package/memory-profiling/helper.js +0 -9
  55. package/memory-profiling/infinispan_memory_many_get.js +0 -50
  56. package/memory-profiling/infinispan_memory_one_get.js +0 -56
  57. package/release.sh +0 -19
  58. package/run-servers.sh +0 -156
  59. package/run-testsuite.sh +0 -6
  60. package/server/.keep +0 -0
  61. package/set-npm-auth-token.sh +0 -4
  62. package/smoke-tests.sh +0 -21
  63. package/spec/codec_spec.js +0 -224
  64. package/spec/configs/clean/infinispan.xml +0 -55
  65. package/spec/configs/infinispan-clustered.xml +0 -63
  66. package/spec/configs/infinispan-ssl.xml +0 -115
  67. package/spec/configs/infinispan-xsite-EARTH.xml +0 -191
  68. package/spec/configs/infinispan-xsite-MOON.xml +0 -193
  69. package/spec/configs/infinispan.xml +0 -77
  70. package/spec/functional_spec.js +0 -73
  71. package/spec/infinispan_auth_spec.js +0 -19
  72. package/spec/infinispan_cluster_spec.js +0 -176
  73. package/spec/infinispan_expiry_spec.js +0 -218
  74. package/spec/infinispan_failover_listener_spec.js +0 -52
  75. package/spec/infinispan_failover_spec.js +0 -63
  76. package/spec/infinispan_json_spec.js +0 -182
  77. package/spec/infinispan_local_spec.js +0 -354
  78. package/spec/infinispan_ssl_spec.js +0 -441
  79. package/spec/infinispan_stress_spec.js +0 -32
  80. package/spec/infinispan_xsite_spec.js +0 -99
  81. package/spec/protocols_spec.js +0 -82
  82. package/spec/protostream_spec.js +0 -237
  83. package/spec/tests.js +0 -28
  84. package/spec/utils/test-log4js.json +0 -14
  85. package/spec/utils/testing.js +0 -790
  86. package/spec/utils/typed-cachemanager-put-get.js +0 -3
  87. package/spec/utils/typed-null-return-dist.js +0 -2
  88. package/spec/utils/typed-null-return.js +0 -2
  89. package/spec/utils/typed-put-get-dist.js +0 -3
  90. package/spec/utils/typed-put-get-unicode.js +0 -3
  91. package/spec/utils/typed-put-get.js +0 -3
  92. package/spec/utils/typed-size.js +0 -2
  93. package/spec/utils_spec.js +0 -154
  94. package/spec-manual/infinispan_manual_stress_get_spec.js +0 -50
  95. package/spec-manual/infinispan_manual_stress_iterate_spec.js +0 -86
@@ -1,58 +0,0 @@
1
- [id='installing-clients_{context}']
2
- = Installing {hr_js} clients
3
- {brandname} provides a distribution of the {hr_js} client that you can install via the NPM package manager.
4
-
5
- .Prerequisites
6
-
7
- * Node.js version `12` or `14`.
8
- //Community content
9
- ifdef::community[]
10
- * {brandname} Server 9.4.x or later.
11
- +
12
- Use js-client `0.7` for {brandname} Server `8.2.x` to `9.3.x`.
13
- endif::community[]
14
- //Downstream content
15
- ifdef::downstream[]
16
- * {brandname} Server {ProductVersion}.
17
- endif::downstream[]
18
-
19
- .Procedure
20
-
21
- //Community content
22
- ifdef::community[]
23
- * Install the `infinispan` client as follows:
24
- +
25
- [source,options="nowrap",subs=attributes+]
26
- ----
27
- npm install infinispan
28
- ----
29
- endif::community[]
30
-
31
- //Downstream content
32
- ifdef::rhdg-install-npmrepo[]
33
- . Add the Red Hat repository to your NPM configuration.
34
- +
35
- You can use the `npm config` command or add the following to an `.npmrc` file in your project:
36
- +
37
- [source,options="nowrap",subs=attributes+]
38
- ----
39
- @redhat:registry=https://npm.registry.redhat.com
40
- registry=https://registry.npmjs.org/
41
- ----
42
-
43
- . Install the {hr_js} client as follows:
44
- +
45
- [source,options="nowrap",subs=attributes+]
46
- ----
47
- npm install @redhat/infinispan
48
- ----
49
- endif::rhdg-install-npmrepo[]
50
- ifdef::rhdg-install-package[]
51
- . Download and extract the `redhat-datagrid-<version>-nodejs-client.zip` from the {portal}.
52
- . Install the `tgz` package from the extracted directory as in the following example:
53
- +
54
- [source,bash,options="nowrap",subs=attributes+]
55
- ----
56
- npm install /path/to/redhat-datagrid-<version>-nodejs-client/infinispan-<version>.tgz
57
- ----
58
- endif::rhdg-install-package[]
@@ -1,17 +0,0 @@
1
- [id='switching-clusters_{context}']
2
- = Manually switching {brandname} clusters
3
- Change the {brandname} cluster to which the {hr_js} client is connectioned.
4
-
5
- .Prerequisites
6
-
7
- * Define {brandname} clusters in the {hr_js} client configuration.
8
-
9
- .Procedure
10
-
11
- . Call the `switchToCluster(clusterName)` method to force the client to switch to a {brandname} cluster that is defined in the client configuration.
12
- . Call the `switchToDefaultCluster()` method to start using the initial {brandname} cluster.
13
- +
14
- [source,javascript,options="nowrap",subs=attributes+]
15
- ----
16
- include::code_examples/connection-xsite-cluster-switch.js[]
17
- ----
@@ -1,68 +0,0 @@
1
- [id='authentication-mechanisms_{context}']
2
- = SASL authentication mechanisms
3
-
4
- {hr_js} clients can use the following SASL authentication mechanisms to connect to {brandname} Server.
5
-
6
- [discrete]
7
- == PLAIN
8
-
9
- Sends credentials in plain text (unencrypted) over the wire in a way that is similar to HTTP `BASIC` authentication.
10
-
11
- [IMPORTANT]
12
- ====
13
- To secure {brandname} credentials, you should use `PLAIN` authentication only in combination with TLS encryption.
14
- ====
15
-
16
- [source,javascript,options="nowrap",subs=attributes+]
17
- ----
18
- include::code_examples/authentication-plain.js[]
19
- ----
20
-
21
- [discrete]
22
- == DIGEST-MD5
23
-
24
- Uses the MD5 hashing algorithm in addition to nonces to encrypt credentials.
25
-
26
- [source,javascript,options="nowrap",subs=attributes+]
27
- ----
28
- include::code_examples/authentication-digest.js[]
29
- ----
30
-
31
- [discrete]
32
- == SCRAM
33
-
34
- Uses salt values in addition to hashing algorithms and nonce values to encrypt credentials.
35
- Hot Rod endpoints support `SCRAM-SHA-1`, `SCRAM-SHA-256`, `SCRAM-SHA-384`, `SCRAM-SHA-512` hashing algorithms, in order of strength.
36
-
37
- [source,javascript,options="nowrap",subs=attributes+]
38
- ----
39
- include::code_examples/authentication-scram.js[]
40
- ----
41
-
42
- //Community content
43
- ifdef::community[]
44
- [discrete]
45
- == EXTERNAL
46
-
47
- Uses client certificates to provide valid identities to {brandname} Server and enable encryption.
48
-
49
- [source,javascript,options="nowrap",subs=attributes+]
50
- ----
51
- include::code_examples/authentication-external.js[]
52
- ----
53
-
54
-
55
- [discrete]
56
- == OAUTHBEARER
57
-
58
- Uses tokens obtained via an OAuth 2.0 provider to securely connect to {brandname} Server.
59
-
60
- [source,javascript,options="nowrap",subs=attributes+]
61
- ----
62
- include::code_examples/authentication-oauthbearer.js[]
63
- ----
64
- endif::community[]
65
-
66
- [role="_additional-resources"]
67
- .Additional resources
68
- * link:{server_docs}#endpoint-authentication[Configuring Endpoint Authentication Mechanisms]
@@ -1,128 +0,0 @@
1
- [id='client-usage_{context}']
2
- = {hr_js} client examples
3
-
4
- After you install and configure your {hr_js} client, start using it by trying out some basic cache operations before moving on to more complex interactions with {brandname}.
5
-
6
- == Hello world
7
-
8
- Create a cache named "myCache" on {brandname} Server then add and retrieve an entry.
9
-
10
- [source,javascript,options="nowrap",subs=attributes+]
11
- ----
12
- include::code_examples/hello-world.js[]
13
- ----
14
-
15
- == Working with entries and retrieving cache statistics
16
-
17
- Add, retrieve, remove single entries and view statistics for the cache.
18
-
19
- [source,javascript,options="nowrap",subs=attributes+]
20
- ----
21
- include::code_examples/single-entries.js[]
22
- ----
23
-
24
- == Working with multiple cache entries
25
-
26
- Create multiple cache entries with simple recursive loops.
27
-
28
- [source,javascript,options="nowrap",subs=attributes+]
29
- ----
30
- include::code_examples/multiple-entries.js[]
31
- ----
32
-
33
- == Using Async and Await constructs
34
-
35
- Node.js provides `async` and `await` constructs that can simplify cache operations.
36
-
37
- .Single cache entries
38
- [source,javascript,options="nowrap",subs=attributes+]
39
- ----
40
- include::code_examples/await-single-entries.js[]
41
- ----
42
-
43
- .Multiple cache entries
44
- [source,javascript,options="nowrap",subs=attributes+]
45
- ----
46
- include::code_examples/await-multiple-entries.js[]
47
- ----
48
-
49
- == Running server-side scripts
50
-
51
- You can add custom scripts to {brandname} Server and then run them from {hr_js} clients.
52
-
53
- .Sample script
54
- [source,javascript,options="nowrap",subs=attributes+]
55
- ----
56
- include::code_examples/sample-script.js[]
57
- ----
58
-
59
- .Script execution
60
- [source,javascript,options="nowrap",subs=attributes+]
61
- ----
62
- include::code_examples/sample-script-execute.js[]
63
- ----
64
-
65
- == Registering event listeners
66
-
67
- Event listeners notify {hr_js} clients when cache updates occur, including when entries are created, modified, removed, or expired.
68
-
69
- [NOTE]
70
- ====
71
- Events for entry creation and modification notify clients about keys and values.
72
- Events for entry removal and expiration notify clients about keys only.
73
- ====
74
-
75
- .Event listener registration
76
- [source,javascript,options="nowrap",subs=attributes+]
77
- ----
78
- include::code_examples/register-event-listener.js[]
79
- ----
80
-
81
- You can tune notifications from event listeners to avoid unnecessary roundtrips with the `key-value-with-previous-converter-factory` converter.
82
- This allows you to, for example, find out values associated with keys within the event instead of retrieving them afterwards.
83
-
84
- .Remote event converter
85
- [source,javascript,options="nowrap",subs=attributes+]
86
- ----
87
- include::code_examples/key-value-converter.js[]
88
- ----
89
-
90
- [TIP]
91
- ====
92
- You can add custom converters to {brandname} Server.
93
- See the link:{doc_home}[{brandname} documentation] for information.
94
- ====
95
-
96
- == Using conditional operations
97
-
98
- The Hot Rod protocol stores metadata about values in {brandname}.
99
- This metadata provides a deterministic factor that lets you perform cache operations for certain conditions.
100
- For example, if you want to replace the value of a key if the versions do not match.
101
-
102
- Use the `getWithMetadata` method to retrieve metadata associated with the value for a key.
103
-
104
- [source,javascript,options="nowrap",subs=attributes+]
105
- ----
106
- include::code_examples/conditional-operations.js[]
107
- ----
108
-
109
- == Working with ephemeral data
110
-
111
- Use the `getWithMetadata` and `size` methods expire cache entries.
112
-
113
- [source,javascript,options="nowrap",subs=attributes+]
114
- ----
115
- include::code_examples/ephemeral-data.js[]
116
- ----
117
-
118
- == Working with queries
119
-
120
- Use the `query` method to perform queries on your caches.
121
- You must configure {hr_js} client to have `application/x-protostream` data format for values in your caches.
122
-
123
- [source,javascript,options="nowrap",subs=attributes+]
124
- ----
125
- include::code_examples/queries.js[]
126
- ----
127
-
128
- See link:{query_docs}[Querying {brandname} caches] for more information.
@@ -1,71 +0,0 @@
1
- [id='encryption_{context}']
2
- = Encryption types
3
-
4
- {hr_js} clients can use different types of encryption to negotiate secure connections with {brandname} Server.
5
-
6
- [discrete]
7
- == {brandname} Server identities
8
-
9
- For basic encryption, you can add the signing certificate, or CA bundle, for {brandname} Server certificates to your configuration as follows:
10
-
11
- [NOTE]
12
- ====
13
- To verify certificates issued to {brandname} Server, {hr_js} clients require either the full certificate chain or a partial chain that starts with the Root CA.
14
- ====
15
-
16
- [source,javascript,options="nowrap",subs=attributes+]
17
- ----
18
- include::code_examples/encryption-trust-certs.js[]
19
- ----
20
-
21
- [discrete]
22
- == Trust stores
23
-
24
- You can add trust stores in `PKCS12` or `PFX` format as follows:
25
-
26
- [source,javascript,options="nowrap",subs=attributes+]
27
- ----
28
- include::code_examples/encryption-crypto-store.js[]
29
- ----
30
-
31
- [discrete]
32
- == Client certificate authentication
33
-
34
- If you enable client certificate authentication in {brandname} Server configuration, add a keystore as in the following example:
35
-
36
- [NOTE]
37
- ====
38
- You must configure the {hr_js} client with the `EXTERNAL` authentication mechanism when using client certificate authentication.
39
- ====
40
-
41
- [source,javascript,options="nowrap",subs=attributes+]
42
- ----
43
- include::code_examples/encryption-private-key.js[]
44
- ----
45
-
46
- [discrete]
47
- == Server Name Indication (SNI)
48
-
49
- If you use SNI to allow {hr_js} clients to request {brandname} Server hostnames, set a value for the `sniHostName` parameter that matches a hostname in the {brandname} Server configuration.
50
-
51
- [NOTE]
52
- ====
53
- The `sniHostName` parameter defaults to `localhost`.
54
- ====
55
-
56
- [source,javascript,options="nowrap",subs=attributes+]
57
- ----
58
- include::code_examples/encryption-sni-hostname.js[]
59
- ----
60
-
61
- [TIP]
62
- ====
63
- {hr_js} clients do not allow self-signed certificates by default, which can cause issues in development or test environments where no public certificate authority (CA) key is available.
64
-
65
- Check out the link:{code_tutorials}[{brandname} code tutorials] for an example on creating signed certificates with the Java keytool.
66
- ====
67
-
68
- [role="_additional-resources"]
69
- .Additional resources
70
- * link:{server_docs}#interfaces-endpoints[Network interfaces and endpoints]
71
- * link:{server_docs}#endpoint-encryption[Encrypting {brandname} Server connections]
package/gen-jsdoc.sh DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # Stop if any errors found
4
- set -e
5
-
6
- ./node_modules/.bin/jsdoc lib/*.js
package/make-ssl.sh DELETED
@@ -1,335 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e -x
4
-
5
- ROOT="out"
6
- PASS="secret"
7
-
8
- #CA_ALIAS="infinispan-ca"
9
- #CA_DIR=${ROOT}/ssl/ca
10
- #CA_KEYSTORE="ca.jks"
11
-
12
- # Remove any previous certificate
13
- rm -drf ${ROOT}/ssl
14
-
15
-
16
- # Create keystore
17
- create_keystore() {
18
- local alias=$1
19
- local dname=$2
20
- local dir=$3
21
- local keystore=$4
22
-
23
- keytool -genkeypair \
24
- -alias $alias \
25
- -dname $dname \
26
- -keystore $dir/$keystore \
27
- -storepass $PASS \
28
- -keypass $PASS \
29
- -keyalg RSA \
30
- -keysize 2048 \
31
- -storetype JKS
32
- }
33
-
34
-
35
- # Create certificate sign request
36
- create_sign_request() {
37
- local alias=$1
38
- local dname=$2
39
- local dir=$3
40
- local keystore=$4
41
- local csr=$5
42
-
43
- keytool -certreq \
44
- -alias $alias \
45
- -dname $dname \
46
- -keystore $dir/$keystore \
47
- -storepass $PASS \
48
- -keypass $PASS \
49
- -file $dir/$csr
50
- }
51
-
52
-
53
- # Sign certificate with CA
54
- sign_certificate() {
55
- local ca=$1
56
- local dir=$2
57
- local csr=$3
58
- local cer=$4
59
-
60
- local ca_alias="infinispan-$ca"
61
- local ca_dir=${ROOT}/ssl/$ca
62
- local ca_keystore="$ca.jks"
63
-
64
- keytool -gencert \
65
- -alias $ca_alias \
66
- -keystore $ca_dir/$ca_keystore \
67
- -storepass $PASS \
68
- -keypass $PASS \
69
- -infile $dir/$csr \
70
- -outfile $dir/$cer
71
- }
72
-
73
-
74
- # Import CA keystore into keystore
75
- import_ca() {
76
- local ca=$1
77
- local dir=$2
78
- local keystore=$3
79
-
80
- local ca_alias="infinispan-$ca"
81
- local ca_dir=${ROOT}/ssl/$ca
82
- local ca_keystore="$ca.jks"
83
-
84
- keytool -importkeystore \
85
- -srcalias $ca_alias \
86
- -srcstorepass $PASS \
87
- -srckeystore $ca_dir/$ca_keystore \
88
- -deststorepass $PASS \
89
- -destkeystore $dir/$keystore
90
- }
91
-
92
-
93
- # Import certificate into keystore
94
- import_certificate() {
95
- local alias=$1
96
- local dir=$2
97
- local keystore=$3
98
- local cer=$4
99
-
100
- keytool -importcert \
101
- -alias $alias \
102
- -keystore $dir/$keystore \
103
- -storepass $PASS \
104
- -keypass $PASS \
105
- -file $dir/$cer
106
- }
107
-
108
-
109
- # Convert into a p12 keystore
110
- keystore_to_p12() {
111
- local dir=$1
112
- local keystore=$2
113
- local p12store=$3
114
-
115
- keytool -importkeystore \
116
- -srckeystore $dir/$keystore \
117
- -destkeystore $dir/$p12store \
118
- -srcstoretype jks \
119
- -deststoretype pkcs12 \
120
- -srcstorepass $PASS \
121
- -deststorepass $PASS
122
- }
123
-
124
-
125
- # Extract client certificate as pem
126
- extract_pem_certificate() {
127
- local dir=$1
128
- local p12store=$2
129
- local pem=$3
130
-
131
- openssl pkcs12 \
132
- -in $dir/$p12store \
133
- -passin pass:$PASS \
134
- -passout pass:$PASS \
135
- -nokeys \
136
- -clcerts \
137
- | awk '/-BEGIN CERTIFICATE-/{a=1};a;/-END CERTIFICATE-/{exit}' \
138
- > $dir/$pem
139
- }
140
-
141
-
142
- make_ca() {
143
- local name=$1
144
- local dir=${ROOT}/ssl/$name
145
- local alias="infinispan-$name"
146
- local dname="CN=CA,OU=Infinispan,O=JBoss,L=RedHat"
147
- local keystore="$name.jks"
148
- local p12store="$name.p12"
149
- local pem="$name.pem"
150
- local pass="secret"
151
-
152
- # Make directories to work from
153
- mkdir -p $dir
154
-
155
- # Create your very own Root Certificate Authority
156
- keytool -genkeypair \
157
- -alias $alias \
158
- -dname $dname \
159
- -keystore $dir/$keystore \
160
- -storepass $pass \
161
- -keypass $PASS \
162
- -keyalg RSA \
163
- -keysize 2048 \
164
- -storetype JKS \
165
- -ext bc:c
166
-
167
- # Convert into a p12 keystore
168
- keytool -importkeystore \
169
- -srckeystore $dir/$keystore \
170
- -destkeystore $dir/$p12store \
171
- -srcstoretype jks \
172
- -deststoretype pkcs12 \
173
- -srcstorepass $pass \
174
- -deststorepass $pass
175
-
176
- # Extract pem
177
- openssl pkcs12 \
178
- -in $dir/$p12store \
179
- -out $dir/$pem \
180
- -passin pass:$pass \
181
- -passout pass:$pass \
182
- -nokeys
183
- }
184
-
185
-
186
- make_server_keystore() {
187
- local ca=$1
188
- local dir=${ROOT}/ssl/server
189
- local alias="server"
190
-
191
- # CN has to match Hostname/IP, otherwise you get:
192
- # Hostname/IP doesn't match certificate's altnames: "Host: localhost. is not cert's CN: Server"
193
- local dname="CN=localhost,OU=Infinispan,O=JBoss,L=RedHat"
194
-
195
- local keystore="server.jks"
196
- local p12store="server.p12"
197
- local csr="server.csr"
198
- local pass="secret"
199
- local cer="server.cer"
200
-
201
- local ca_dir=${ROOT}/ssl/$ca # TODO global
202
- local ca_keystore="$ca.jks" # TODO global
203
- local ca_alias="infinispan-$ca" # TODO global
204
-
205
- # Make directories to work from
206
- mkdir -p $dir
207
-
208
- # Create server keystore
209
- create_keystore $alias $dname $dir $keystore
210
-
211
- # Create certificate sign request
212
- keytool -certreq \
213
- -alias $alias \
214
- -dname $dname \
215
- -keystore $dir/$keystore \
216
- -storepass $pass \
217
- -keypass $PASS \
218
- -file $dir/$csr \
219
-
220
- # Sign certicate with CA
221
- keytool -gencert \
222
- -alias $ca_alias \
223
- -keystore $ca_dir/$ca_keystore \
224
- -storepass $pass \
225
- -keypass $PASS \
226
- -infile $dir/$csr \
227
- -outfile $dir/$cer
228
-
229
- # Import CA keystore into server keystore
230
- keytool -importkeystore \
231
- -srcalias $ca_alias \
232
- -srcstorepass $pass \
233
- -srckeystore $ca_dir/$ca_keystore \
234
- -deststorepass $pass \
235
- -destkeystore $dir/$keystore
236
-
237
- # Import server certificate into server keystore
238
- keytool -importcert \
239
- -alias $alias \
240
- -keystore $dir/$keystore \
241
- -storepass $pass \
242
- -keypass $PASS \
243
- -file $dir/$cer
244
-
245
- # Convert into a p12 keystore
246
- keytool -importkeystore \
247
- -srckeystore $dir/$keystore \
248
- -destkeystore $dir/$p12store \
249
- -srcstoretype jks \
250
- -deststoretype pkcs12 \
251
- -srcstorepass $pass \
252
- -deststorepass $pass
253
- }
254
-
255
-
256
- make_client_keystore() {
257
- local ca=$1
258
- local dir=${ROOT}/ssl/client
259
- local alias="client"
260
-
261
- # CN has to match Hostname/IP, otherwise you get:
262
- # Hostname/IP doesn't match certificate's altnames: "Host: localhost. is not cert's CN: Server"
263
- local dname="CN=localhost,OU=Infinispan,O=JBoss,L=RedHat"
264
-
265
- local keystore="client.jks"
266
- local p12store="client.p12"
267
- local pass="secret"
268
- local csr="client.csr"
269
- local cer="client.cer"
270
- local pem="client.pem"
271
- local privkey="client.pk"
272
-
273
- # Make directories to work from
274
- mkdir -p $dir
275
-
276
- create_keystore $alias $dname $dir $keystore
277
- create_sign_request $alias $dname $dir $keystore $csr
278
- sign_certificate $ca $dir $csr $cer
279
- import_ca $ca $dir $keystore
280
- import_certificate $alias $dir $keystore $cer
281
- keystore_to_p12 $dir $keystore $p12store
282
- extract_pem_certificate $dir $p12store $pem
283
-
284
- # Extract client private key as pem
285
- openssl pkcs12 \
286
- -in $dir/$p12store \
287
- -passin pass:$pass \
288
- -passout pass:$pass \
289
- -nocerts \
290
- -nodes \
291
- | awk '/-BEGIN PRIVATE KEY-/{a=1};a;/-END PRIVATE KEY-/{exit}' \
292
- > $dir/$privkey
293
- }
294
-
295
-
296
- make_sni() {
297
- local ca=$1
298
- local host=$2
299
- local dir=${ROOT}/ssl/sni-$host
300
- local alias=$host
301
-
302
- # CN has to match Hostname/IP
303
- local dname="CN=$host,OU=Infinispan,O=JBoss,L=RedHat"
304
-
305
- local keystore="$host.jks"
306
- local p12store="$host.p12"
307
- local csr="$host.csr"
308
- local cer="$host.cer"
309
- local pem="$host.pem"
310
-
311
- # Make directories to work from
312
- mkdir -p $dir
313
-
314
- create_keystore $alias $dname $dir $keystore
315
- create_sign_request $alias $dname $dir $keystore $csr
316
- sign_certificate $ca $dir $csr $cer
317
- import_ca $ca $dir $keystore
318
- import_certificate $alias $dir $keystore $cer
319
- keystore_to_p12 $dir $keystore $p12store
320
- extract_pem_certificate $dir $p12store $pem
321
- }
322
-
323
-
324
- main() {
325
- make_ca ca
326
- make_server_keystore ca
327
- make_client_keystore ca
328
- make_sni ca trust1
329
- make_sni ca trust2
330
- make_ca untrust-ca
331
- make_sni untrust-ca untrust
332
- }
333
-
334
-
335
- main
@@ -1,9 +0,0 @@
1
- const fs = require('fs');
2
- const v8 = require('v8');
3
-
4
- exports.createHeapSnapshot = function() {
5
- const snapshotStream = v8.getHeapSnapshot();
6
- const fileName = `${Date.now()}.heapsnapshot`;
7
- const fileStream = fs.createWriteStream('/tmp/' + fileName);
8
- snapshotStream.pipe(fileStream);
9
- }