aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/leap_cli/commands/ca.rb14
-rw-r--r--test/leap_platform/provider_base/provider.json2
-rw-r--r--test/leap_platform/provider_base/services/ca.json1
-rw-r--r--test/leap_platform/provider_base/services/couchdb.json1
4 files changed, 11 insertions, 7 deletions
diff --git a/lib/leap_cli/commands/ca.rb b/lib/leap_cli/commands/ca.rb
index b5a8765..b3d0a9d 100644
--- a/lib/leap_cli/commands/ca.rb
+++ b/lib/leap_cli/commands/ca.rb
@@ -93,22 +93,28 @@ module LeapCli; module Commands
domain = options[:domain] || provider.domain
assert_files_missing! [:commercial_key, domain], [:commercial_csr, domain], :msg => 'If you really want to create a new key and CSR, remove these files first.'
+ server_certificates = provider.ca.server_certificates
+
# RSA key
keypair = CertificateAuthority::MemoryKeyMaterial.new
- log :generating, "%s bit RSA key" % provider.ca.server_certificates.bit_size do
- keypair.generate_key(provider.ca.server_certificates.bit_size)
+ log :generating, "%s bit RSA key" % server_certificates.bit_size do
+ keypair.generate_key(server_certificates.bit_size)
write_file! [:commercial_key, domain], keypair.private_key.to_pem
end
# CSR
dn = CertificateAuthority::DistinguishedName.new
csr = CertificateAuthority::SigningRequest.new
- dn.common_name = domain
+ dn.common_name = domain
dn.organization = provider.name[provider.default_language]
+ dn.country = server_certificates['country'] # optional
+ dn.state = server_certificates['state'] # optional
+ dn.locality = server_certificates['locality'] # optional
+
log :generating, "CSR with commonName => '%s', organization => '%s'" % [dn.common_name, dn.organization] do
csr.distinguished_name = dn
csr.key_material = keypair
- csr.digest = provider.ca.server_certificates.digest
+ csr.digest = server_certificates.digest
request = csr.to_x509_csr
write_file! [:commercial_csr, domain], csr.to_pem
end
diff --git a/test/leap_platform/provider_base/provider.json b/test/leap_platform/provider_base/provider.json
index cf1baac..ee24f5f 100644
--- a/test/leap_platform/provider_base/provider.json
+++ b/test/leap_platform/provider_base/provider.json
@@ -16,7 +16,7 @@
"service": {
"levels": [
// bandwidth limit is in Bytes, storage limit is in MB.
- {"id": 1, "name": "free", "bandwidth":"limited", "storage":50},
+ {"id": 1, "name": "free", "storage":50},
{"id": 2, "name": "basic", "storage":1000, "rate": ["US$10", "€10"]},
{"id": 3, "name": "pro", "storage":10000, "rate": ["US$20", "€20"]}
],
diff --git a/test/leap_platform/provider_base/services/ca.json b/test/leap_platform/provider_base/services/ca.json
index 68f970f..d7d8452 100644
--- a/test/leap_platform/provider_base/services/ca.json
+++ b/test/leap_platform/provider_base/services/ca.json
@@ -1,5 +1,4 @@
{
- "service_type": "internal_service",
"x509": {
"use": true
}
diff --git a/test/leap_platform/provider_base/services/couchdb.json b/test/leap_platform/provider_base/services/couchdb.json
index 0c40731..ce24e7f 100644
--- a/test/leap_platform/provider_base/services/couchdb.json
+++ b/test/leap_platform/provider_base/services/couchdb.json
@@ -1,5 +1,4 @@
{
- "service_type": "internal_service",
"x509": {
"use": true
},