48 Commits

Author SHA1 Message Date
Manuel Romero
2237232cc8 new config for cluster 2023-03-20 14:01:51 +01:00
Manuel Romero
98b5f4ff9c cluster_size 2023-03-20 13:33:20 +01:00
Manuel Romero
1e306f9efe cluster_size 2023-03-20 13:00:19 +01:00
Manuel Romero
6b2eaa6d19 secret to all 2023-03-20 12:44:41 +01:00
Manuel Romero
cb633dda5e fix 2023-03-20 12:30:24 +01:00
Manuel Romero
8728f8b109 dbricks SQL name 2023-03-20 12:26:17 +01:00
Manuel Romero
c0d76a2b1d fix scope 2023-03-20 12:14:58 +01:00
Manuel Romero
a2c0735f14 new databricks 2023-03-20 12:06:37 +01:00
Manuel Romero
a1f0414512 fix vm-qdc on https 2023-03-15 15:46:41 +01:00
Manuel Romero
2d17f418b0 fix vm-qdc on https 2023-03-15 15:45:56 +01:00
Manuel Romero
e1fb80ff4a fix vm-qdc on https 2023-03-15 15:41:54 +01:00
Manuel Romero
e062728fae new cert 2023-03-15 15:12:54 +01:00
Manuel Romero
3ff07f37b6 new cert 2023-03-15 15:02:14 +01:00
Manuel Romero
2484a5c090 new cert 2023-03-15 15:01:03 +01:00
Manuel Romero
57bfb366c1 new certificate 2023-03-15 14:47:23 +01:00
Manuel Romero
4176f45593 new certificate 2023-03-15 14:26:44 +01:00
Manuel Romero
c4dbff136b new certificate 2023-03-15 14:22:13 +01:00
Manuel Romero
d56290caa4 new certificate 2023-03-15 14:12:40 +01:00
Manuel Romero
1fc4c1b57c new certificate 2023-03-15 13:55:14 +01:00
Manuel Romero
9a2518885d new certificate 2023-03-15 13:50:26 +01:00
Manuel Romero
28c93c8905 new certificate 2023-03-15 13:45:33 +01:00
Manuel Romero
84030db306 update switch 2023-03-15 13:37:11 +01:00
Manuel Romero
1f87ab4ea2 update switch 2023-03-15 13:14:49 +01:00
Manuel Romero
a47a85a528 stuff 2023-03-15 13:07:45 +01:00
Manuel Romero
26e0bbaed0 fix custom_data 2023-03-15 12:49:10 +01:00
Manuel Romero
a2d9fa3134 fix custom_data 2023-03-15 12:47:34 +01:00
Manuel Romero
5f1d8aec59 fix custom_data 2023-03-15 12:41:48 +01:00
Manuel Romero
30f6d1de65 fix custom_data 2023-03-15 12:40:59 +01:00
Manuel Romero
7ff8a4710d fix custom_data 2023-03-15 12:29:05 +01:00
Manuel Romero
b662c7b975 fix custom_data 2023-03-15 12:19:33 +01:00
Manuel Romero
91fd8697b6 fix custom_data 2023-03-15 12:05:45 +01:00
Manuel Romero
6b3d69f50c fix custom_data 2023-03-15 11:57:44 +01:00
Manuel Romero
7112f091a2 fix custom_data 2023-03-15 11:48:48 +01:00
Manuel Romero
13ae7eb9b4 fix custom_data 2023-03-15 11:36:45 +01:00
Manuel Romero
6796c53c93 fix custom_data 2023-03-15 11:16:30 +01:00
Manuel Romero
3716a29365 fix custom_data 2023-03-15 10:58:14 +01:00
Manuel Romero
e1b7a5f5c7 fix custom_data 2023-03-15 10:56:44 +01:00
Manuel Romero
50df71d2ee fix custom_data 2023-03-15 10:53:43 +01:00
Manuel Romero
3c6687a2c6 fix custom_data 2023-03-15 10:42:46 +01:00
Manuel Romero
c6e9e4c102 fix custom_data 2023-03-15 10:41:48 +01:00
Manuel Romero
4f9322c060 shell script 2023-03-15 10:30:23 +01:00
Manuel Romero
0ecfa30952 test vm-centos 2023-03-15 10:12:50 +01:00
Manuel Romero
8a83983993 new cert 2023-03-15 10:10:55 +01:00
Manuel Romero
80577ffdd9 fix 2023-03-14 17:05:40 +01:00
Manuel Romero
cde377b833 test save pem cert 2023-03-14 16:24:59 +01:00
Manuel Romero
a5639963c3 test save pem cert 2023-03-14 16:17:49 +01:00
Manuel Romero
947503e2e5 test save pem cert 2023-03-14 16:13:45 +01:00
Manuel Romero
26f1175499 test save pem cert 2023-03-14 16:12:11 +01:00
27 changed files with 154 additions and 15 deletions

View File

@@ -6,6 +6,11 @@ Param(
try {
Write-Host "Install qmi_qlik-poc_com certificate on Windows"
$ProgressPreference = 'SilentlyContinue'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile("https://gitlab.com/qmi/qmi-cloud-tf-modules/-/raw/master/qmicerts/wildcard_qmi_qlik-poc_com.pfx", "$PSScriptRoot\wildcard_qmi_qlik-poc_com.pfx")
$secpasswd = ConvertTo-SecureString $CertPwd -AsPlainText -Force
$sslCert = Import-PfxCertificate -FilePath $PSScriptRoot/wildcard_qmi_qlik-poc_com.pfx -CertStoreLocation Cert:\LocalMachine\My -Password $secpasswd
$thumb=$($sslCert.Thumbprint)

View File

@@ -5,11 +5,16 @@ terraform {
required_providers {
databricks = {
source = "databricks/databricks"
version = ">= 1.6.0"
version = ">= 1.13.0"
}
}
}
locals {
cluster_nameUpper = upper(var.cluster_name)
}
/*resource "databricks_workspace_conf" "this" {
custom_config = {
@@ -88,16 +93,42 @@ resource "databricks_group_member" "i-am-admin-aor" {
member_id = databricks_user.aor[0].id
}
resource "databricks_secret_scope" "scopeapp" {
name = "${var.cluster_name}scope"
}
resource "databricks_secret" "publishing_api" {
key = "accesskey"
string_value = var.app_reg_secret
scope = databricks_secret_scope.scopeapp.name
}
resource "databricks_sql_endpoint" "sqlep" {
count = (var.sku == "premium")? 1 : 0
name = "qmi-sqlwh-${databricks_user.me.id}"
cluster_size = "Small"
name = "${local.cluster_nameUpper} SQL warehouse"
cluster_size = var.cluster_size
max_num_clusters = 1
}
resource "databricks_sql_global_config" "this" {
security_policy = "DATA_ACCESS_CONTROL"
data_access_config = {
"spark.hadoop.fs.azure.account.auth.type.${var.storage_account_name}.dfs.core.windows.net" : "OAuth",
"spark.hadoop.fs.azure.account.oauth.provider.type.${var.storage_account_name}.dfs.core.windows.net": "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider",
"spark.hadoop.fs.azure.account.oauth2.client.id.${var.storage_account_name}.dfs.core.windows.net" : var.app_reg_id,
"spark.hadoop.fs.azure.account.oauth2.client.secret.${var.storage_account_name}.dfs.core.windows.net" : "{{secrets/${var.cluster_name}scope/accesskey}}",
"spark.hadoop.fs.azure.account.oauth2.client.endpoint.${var.storage_account_name}.dfs.core.windows.net": "https://login.microsoftonline.com/c21eeb5f-f5a6-44e8-a997-124f2f7a497c/oauth2/token"
}
enable_serverless_compute = false
sql_config_params = {}
}
resource "databricks_token" "pat" {
@@ -122,9 +153,12 @@ resource "databricks_cluster" "dbrickscluster" {
"spark.databricks.delta.preview.enabled": true,
"spark.databricks.repl.allowedLanguages": "sql,python,r",
"spark.databricks.cluster.profile": "serverless",
"fs.azure.account.key.${var.storage_account_name}.dfs.core.windows.net": var.storage_account_accesskey
"fs.azure.account.key.${var.storage_account_name}.dfs.core.windows.net": var.storage_account_accesskey,
"spark.databricks.delta.properties.defaults.autoOptimize.autoCompact": true,
"spark.databricks.delta.properties.defaults.autoOptimize.optimizeWrite": true
}
spark_env_vars = {
"PYSPARK_PYTHON": "/databricks/python3/bin/python3"
}
@@ -134,5 +168,5 @@ resource "databricks_cluster" "dbrickscluster" {
max_workers = 4
}
autotermination_minutes = 120
autotermination_minutes = 45
}

View File

@@ -24,4 +24,16 @@ variable "node_type_id" {
variable "sku" {
default = "standard"
}
variable "app_reg_id" {
default = null
}
variable "app_reg_secret" {
default = null
}
variable "cluster_size" {
default = "Small"
}

View File

@@ -3,6 +3,9 @@
BASEDIR=$(dirname "$0")
mkdir -p $BASEDIR/qmicerts
wget --quiet https://gitlab.com/qmi/qmi-cloud-tf-modules/-/raw/master/qmicerts/wildcard_qmi_qlik-poc_com.pfx -O $BASEDIR/qmicerts/wildcard_qmi_qlik-poc_com.pfx
PASSWORD=$1
# Extract the private key
openssl pkcs12 -in $BASEDIR/qmicerts/wildcard_qmi_qlik-poc_com.pfx -nocerts -nodes -out $BASEDIR/qmicerts/wildcard_qmi_qlik-poc_com.key -passin pass:$PASSWORD

View File

@@ -0,0 +1,9 @@
#!/bin/bash
BASEDIR=$(dirname "$0")
echo $1 > $BASEDIR/qmicerts/myserver.crt
echo $2 > $BASEDIR/qmicerts/myserver.key

View File

@@ -0,0 +1,2 @@
echo 'Updating OS. This will take a around 10 minutes'
yum -y --quiet update

View File

@@ -13,15 +13,22 @@ data "azurerm_key_vault_secret" "cert_password" {
key_vault_id = var.key_vault_id
}
#data "azurerm_key_vault_certificate_data" "cert-data" {
# name = "star-qmi-qlikpoc-com-cert"
# key_vault_id = var.key_vault_id
#}
locals {
falcon_id = nonsensitive(data.azurerm_key_vault_secret.cid.value)
tenable_key = nonsensitive(data.azurerm_key_vault_secret.tenable-key.value)
cert_password = nonsensitive(data.azurerm_key_vault_secret.cert_password.value)
}
#cert_pem = nonsensitive(data.azurerm_key_vault_certificate_data.cert-data.pem)
#cert_key = nonsensitive(data.azurerm_key_vault_certificate_data.cert-data.key)
}
resource "null_resource" "post-linux-vm" {
provisioner "file" {
resource "null_resource" "files" {
provisioner "file" {
connection {
type = "ssh"
host = var.private_ip_address
@@ -33,6 +40,13 @@ resource "null_resource" "post-linux-vm" {
source = "${path.module}/${var.os_type}/common"
destination = "/home/${var.admin_username}"
}
}
resource "null_resource" "post-linux-vm" {
depends_on = [
null_resource.files
]
provisioner "remote-exec" {
connection {
@@ -50,6 +64,34 @@ resource "null_resource" "post-linux-vm" {
"sudo /home/${var.admin_username}/common/resizedisk.sh",
"sudo /home/${var.admin_username}/common/tenable.sh '${local.tenable_key}'",
"sudo /home/${var.admin_username}/common/extract-certs.sh '${local.cert_password}'",
#"sudo /home/${var.admin_username}/common/save-cert.sh '${local.cert_pem}' '${local.cert_key}'",
]
}
}
}
resource "null_resource" "update" {
count = var.update? 1 : 0
depends_on = [
null_resource.files,
null_resource.post-linux-vm
]
provisioner "remote-exec" {
connection {
type = "ssh"
host = var.private_ip_address
user = var.admin_username
password = var.admin_password
timeout = "60s"
#private_key = "${file("~/.ssh/id_rsa")}"
}
inline = [
"echo ${var.admin_password} | sudo -S chmod u+x /home/${var.admin_username}/common/*.sh",
"sudo /home/${var.admin_username}/common/update.sh",
]
}
}

View File

@@ -3,6 +3,9 @@
BASEDIR=$(dirname "$0")
mkdir -p $BASEDIR/qmicerts
wget --quiet https://gitlab.com/qmi/qmi-cloud-tf-modules/-/raw/master/qmicerts/wildcard_qmi_qlik-poc_com.pfx -O $BASEDIR/qmicerts/wildcard_qmi_qlik-poc_com.pfx
PASSWORD=$1
# Extract the private key
openssl pkcs12 -in $BASEDIR/qmicerts/wildcard_qmi_qlik-poc_com.pfx -nocerts -nodes -out $BASEDIR/qmicerts/wildcard_qmi_qlik-poc_com.key -passin pass:$PASSWORD

View File

@@ -9,7 +9,7 @@ binary="falcon-sensor_5.17.0-8103_amd64.deb"
echo "--- Installing CrowdStrike falcon agent --> $binary"
echo "CID=$1"
sudo apt -qq -y update
#sudo apt -qq -y update
sudo apt install libnl-3-200 libnl-genl-3-200 -qq -y
wget --quiet https://d7ipctdjxxii4.cloudfront.net/others/$binary -O $BASEDIR/$binary

View File

@@ -0,0 +1,3 @@
echo 'Updating OS. This will take a around 10 minutes'
apt -qq -y update
apt --fix-broken -qq -y upgrade

View File

@@ -16,3 +16,8 @@ variable "key_vault_id" {
default = "/subscriptions/62ebff8f-c40b-41be-9239-252d6c0c8ad9/resourceGroups/QMI-Machines/providers/Microsoft.KeyVault/vaults/qmisecrets"
}
variable "update" {
type = bool
default = true
}

Binary file not shown.

View File

@@ -7,6 +7,11 @@ Param(
try {
Write-Host "Install qmi_qlik-poc_com certificate on Windows"
$ProgressPreference = 'SilentlyContinue'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile("https://gitlab.com/qmi/qmi-cloud-tf-modules/-/raw/master/qmicerts/wildcard_qmi_qlik-poc_com.pfx", "$PSScriptRoot\wildcard_qmi_qlik-poc_com.pfx")
$secpasswd = ConvertTo-SecureString $CertPwd -AsPlainText -Force
$sslCert = Import-PfxCertificate -FilePath $PSScriptRoot/wildcard_qmi_qlik-poc_com.pfx -CertStoreLocation Cert:\LocalMachine\My -Password $secpasswd
$thumb=$($sslCert.Thumbprint)

View File

@@ -123,5 +123,6 @@ module "linux-common" {
private_ip_address = module.qmi-nic.private_ip_address
admin_username = local.admin_username
admin_password = local.admin_password
update = false
}

View File

@@ -13,6 +13,7 @@ if [[ $2 == *"4.9.0"* ]]; then
sudo cp /home/qmi/scripts/feb2022/tomcat.service /etc/systemd/system/
fi
wget --quiet https://gitlab.com/qmi/qmi-cloud-tf-modules/-/raw/master/qmicerts/wildcard_qmi_qlik-poc_com.pfx -O /home/qmi/scripts/wildcard_qmi_qlik-poc_com.pfx
sudo cp /home/qmi/scripts/wildcard_qmi_qlik-poc_com.pfx /usr/local/qdc
if [[ $2 == *"4.13.0"* ]]; then

View File

@@ -7,6 +7,9 @@ TOMCAT_HOME=$BASE/$TOMCAT
BASEDIR=$(dirname "$0")
echo "Replacing server.xml for Tomcat - Stopping Tomcat"
wget --quiet https://gitlab.com/qmi/qmi-cloud-tf-modules/-/raw/master/qmicerts/wildcard_qmi_qlik-poc_com.pfx -O /home/qmi/scripts/wildcard_qmi_qlik-poc_com.pfx
sudo cp /home/qmi/scripts/wildcard_qmi_qlik-poc_com.pfx /usr/local/qdc
sudo cp /home/qmi/scripts/wildcard_qmi_qlik-poc_com.pfx /usr/local/qdc
sudo systemctl stop tomcat.service
mv $TOMCAT_HOME/conf/server.xml $TOMCAT_HOME/conf/server.xml_backup

View File

@@ -99,7 +99,7 @@
clientAuth="false" sslProtocol="TLS"
keystoreFile="/usr/local/qdc/wildcard_qmi_qlik-poc_com.pfx"
keystoreType="PKCS12"
keystorePass="QJ]5M$>m,X)t=_:BNNt:mwFks7NqocSMbR@/zA" />
keystorePass="8@afBR2AwKMb@4Rj" />
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"

View File

@@ -117,6 +117,11 @@ While( (Connect-Qlik $($env:COMPUTERNAME) -TrustAllCerts -UseDefaultCredentials
### Install qlik-poc_com certificate
Write-Log -Message "Install 'qmi.qlik-poc.com' certificate, set thumbsprint and whitelist domain in QS central virtual proxy"
$ProgressPreference = 'SilentlyContinue'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile("https://gitlab.com/qmi/qmi-cloud-tf-modules/-/raw/master/qmicerts/wildcard_qmi_qlik-poc_com.pfx", "C:\provision\wildcard_qmi_qlik-poc_com.pfx")
try {
$secpasswd = ConvertTo-SecureString $CertPwd -AsPlainText -Force
$sslCert=Import-PfxCertificate -FilePath C:/provision/wildcard_qmi_qlik-poc_com.pfx -CertStoreLocation Cert:\LocalMachine\My -Password $secpasswd

View File

@@ -129,7 +129,7 @@ resource "azurerm_windows_virtual_machine" "vm" {
}
/*resource "null_resource" "vm-qs-post" {
resource "null_resource" "vm-qs-post" {
depends_on = [
azurerm_windows_virtual_machine.vm
@@ -210,5 +210,4 @@ module "win-common" {
private_ip_address = module.qmi-nic.private_ip_address
admin_username = local.admin_username
admin_password = local.admin_password
}
*/
}

View File

@@ -243,6 +243,13 @@ restartQse
### Install qlik-poc_com certificate
Write-Log -Message "Install qmi_qlik-poc_com certificate on Windows"
$ProgressPreference = 'SilentlyContinue'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile("https://gitlab.com/qmi/qmi-cloud-tf-modules/-/raw/master/qmicerts/wildcard_qmi_qlik-poc_com.pfx", "C:\provision\wildcard_qmi_qlik-poc_com.pfx")
write-log -Message "Cert password is: $CertPwd"
try {
$secpasswd = ConvertTo-SecureString $CertPwd -AsPlainText -Force
$sslCert=Import-PfxCertificate -FilePath C:/provision/wildcard_qmi_qlik-poc_com.pfx -CertStoreLocation Cert:\LocalMachine\My -Password $secpasswd