1
1
#! /bin/bash
2
2
set -e
3
- if [[ ! " $JANS_FQDN " ]]; then
4
- read -rp " Enter Hostname [demoexample.jans.io ]: " JANS_FQDN
3
+ if [[ ! " $GLUU_FQDN " ]]; then
4
+ read -rp " Enter Hostname [demoexample.gluu.org ]: " GLUU_FQDN
5
5
fi
6
- if ! [[ $JANS_FQDN == * " ." * " ." * ]]; then
6
+ if ! [[ $GLUU_FQDN == * " ." * " ." * ]]; then
7
7
echo " [E] Hostname provided is invalid or empty.
8
- Please enter a FQDN with the format demoexample.jans.io "
8
+ Please enter a FQDN with the format demoexample.gluu.org "
9
9
exit 1
10
10
fi
11
11
sudo apt-get update
12
- sudo apt-get install python3-pip -y
13
- sudo pip3 install pip --upgrade
14
- sudo pip3 install setuptools --upgrade
15
- sudo pip3 install pyOpenSSL --upgrade
16
- sudo apt-get update
17
- sudo apt-get install build-essential unzip -y
18
- sudo pip3 install requests --upgrade
19
- sudo pip3 install shiv
20
12
sudo snap install microk8s --classic
21
13
sudo microk8s.status --wait-ready
22
- sudo microk8s.enable dns registry ingress
14
+ sudo microk8s.enable dns registry ingress helm3
15
+ sudo snap alias microk8s.kubectl kubectl
16
+ sudo snap alias microk8s.helm3 helm
23
17
sudo microk8s kubectl get daemonset.apps/nginx-ingress-microk8s-controller -n ingress -o yaml | sed -s " s@ingress-class=public@ingress-class=nginx@g" | microk8s kubectl apply -f -
24
18
sudo apt-get update
25
- sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
26
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
27
- sudo add-apt-repository " deb [arch=amd64] https://download.docker.com/linux/ubuntu $( lsb_release -cs) stable"
28
- sudo apt-get update
29
- sudo apt-get install net-tools
30
- curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
31
- chmod 700 get_helm.sh
32
- ./get_helm.sh
33
- sudo apt-get install docker-ce docker-ce-cli containerd.io -y
34
19
sudo microk8s config > config
35
20
KUBECONFIG=" $PWD " /config
36
- sudo microk8s.kubectl create namespace jans --kubeconfig=" $KUBECONFIG " || echo " namespace exists"
21
+ sudo microk8s.kubectl create namespace gluu --kubeconfig=" $KUBECONFIG " || echo " namespace exists"
37
22
sudo helm repo add bitnami https://charts.bitnami.com/bitnami
38
23
sudo microk8s.kubectl get po --kubeconfig=" $KUBECONFIG "
39
- sudo helm install my-release --set auth.rootPassword=Test1234#,auth.database=jans bitnami/mysql -n jans --kubeconfig=" $KUBECONFIG "
40
- EXT_IP=$( dig +short myip.opendns.com @resolver1.opendns.com )
41
- sudo echo " $EXT_IP $JANS_FQDN " >> /etc/hosts
24
+ sudo helm install my-release --set auth.rootPassword=Test1234#,auth.database=gluu -n gluu oci://registry-1.docker.io/bitnamicharts/mysql --kubeconfig=" $KUBECONFIG "
25
+ EXT_IP=$( curl ipinfo.io/ip )
26
+ sudo echo " $EXT_IP $GLUU_FQDN " >> /etc/hosts
42
27
cat << EOF > override.yaml
43
28
config:
44
29
countryCode: US
45
30
46
31
orgName: Gluu
47
32
city: Austin
48
33
configmap:
49
- cnSqlDbName: jans
34
+ cnSqlDbName: gluu
50
35
cnSqlDbPort: 3306
51
36
cnSqlDbDialect: mysql
52
- cnSqlDbHost: my-release-mysql.jans .svc
37
+ cnSqlDbHost: my-release-mysql.gluu .svc
53
38
cnSqlDbUser: root
54
39
cnSqlDbTimezone: UTC
55
40
cnSqldbUserPassword: Test1234#
56
41
nginx-ingress:
57
42
ingress:
58
- adminUiEnabled: false
59
- openidConfigEnabled: true
60
- uma2ConfigEnabled: true
61
- webfingerEnabled: true
62
- webdiscoveryEnabled: true
63
- scimConfigEnabled: false
64
- scimEnabled: false
65
- configApiEnabled: true
66
- u2fConfigEnabled: true
67
- fido2ConfigEnabled: false
68
- authServerEnabled: true
69
43
path: /
70
44
hosts:
71
- - $JANS_FQDN
45
+ - $GLUU_FQDN
72
46
# -- Secrets holding HTTPS CA cert and key.
73
47
tls:
74
48
- secretName: tls-certificate
75
49
hosts:
76
- - $JANS_FQDN
77
- authServerProtectedToken: true
78
- authServerProtectedRegister: true
50
+ - $GLUU_FQDN
79
51
additionalAnnotations:
80
52
nginx.ingress.kubernetes.io/auth-tls-verify-client: "optional"
81
- nginx.ingress.kubernetes.io/auth-tls-secret: "gluu/ca-secret "
53
+ nginx.ingress.kubernetes.io/auth-tls-secret: "gluu/tls-ob- ca-certificates "
82
54
nginx.ingress.kubernetes.io/auth-tls-verify-depth: "1"
83
55
nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream: "true"
84
56
global:
57
+ cloud:
58
+ testEnviroment: true
59
+ admin-ui:
60
+ enabled: false
61
+ auth-server:
62
+ ingress:
63
+ authServerProtectedToken: true
64
+ authServerProtectedRegister: true
85
65
auth-server-key-rotation:
86
66
enabled: false
67
+ casa:
68
+ enabled: false
87
69
config-api:
88
70
enabled: true
89
71
fido2:
@@ -92,43 +74,18 @@ global:
92
74
enabled: false
93
75
isFqdnRegistered: false
94
76
lbIp: $EXT_IP
77
+ fqdn: $GLUU_FQDN
95
78
EOF
96
- sudo helm repo add jans https://gluufederation.github.io/flex/flex-cn-setup/pygluu/kubernetes/templates/helm
79
+ sudo helm repo add gluu-flex https://docs.gluu.org/charts
97
80
sudo helm repo update
98
- sudo helm install jans jans/gluu -n jans --version=5.0.2 -f override.yaml --kubeconfig=" $KUBECONFIG "
99
- echo " Waiting for auth-server to come up....Please do not cancel out...This will wait for the auth-server to be ready.."
100
- sleep 120
101
- cat << EOF > testendpoints.sh
102
- # get certs and keys. This will also generate the client crt and key to be used to access protected endpoints
103
- mkdir quicktestcerts || echo "directory exists"
104
- cd quicktestcerts
105
- sudo microk8s config > config
106
- KUBECONFIG="$PWD "/config
107
- rm ca.crt ca.key server.crt server.key client.csr client.crt client.key
108
- sudo microk8s.kubectl delete secret generic ca-secret -n gluu --kubeconfig="$KUBECONFIG " || echo "secret ca-secret does not exist and will be created."
109
- sudo microk8s.kubectl get secret cn -o json -n gluu --kubeconfig="$KUBECONFIG " | grep '"ssl_ca_cert":' | sed -e 's#.*:\(\)#\1#' | tr -d '"' | tr -d "," | tr -d '[:space:]' | base64 -d > ca.crt
110
- sudo microk8s.kubectl get secret cn -o json -n gluu --kubeconfig="$KUBECONFIG " | grep '"ssl_ca_key":' | sed -e 's#.*:\(\)#\1#' | tr -d '"' | tr -d "," | tr -d '[:space:]' | base64 -d > ca.key
111
- sudo microk8s.kubectl get secret cn -o json -n gluu --kubeconfig="$KUBECONFIG " | grep '"ssl_cert":' | sed -e 's#.*:\(\)#\1#' | tr -d '"' | tr -d "," | tr -d '[:space:]' | base64 -d > server.crt
112
- sudo microk8s.kubectl get secret cn -o json -n gluu --kubeconfig="$KUBECONFIG " | grep '"ssl_key":' | sed -e 's#.*:\(\)#\1#' | tr -d '"' | tr -d "," | tr -d '[:space:]' | base64 -d > server.key
113
- openssl req -new -newkey rsa:4096 -keyout client.key -out client.csr -nodes -subj '/CN=Openbanking'
114
- openssl x509 -req -sha256 -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 02 -out client.crt
115
- sudo microk8s.kubectl create secret generic ca-secret -n gluu --from-file=tls.crt=server.crt --from-file=tls.key=server.key --from-file=ca.crt=ca.crt
116
- echo -e "Starting simple test to endpoints. \n"
117
- sleep 10
118
- echo -e "Testing openid-configuration endpoint.. \n"
119
- curl -k https://demoexample.gluu.org/.well-known/openid-configuration
120
- TESTCLIENT=$( microk8s.kubectl get cm cn -o json -n gluu --kubeconfig=" $KUBECONFIG " | grep ' "jca_client_id":' | sed -e ' s#.*:\(\)#\1#' | tr -d ' "' | tr -d " ," | tr -d ' [:space:]' )
121
- TESTCLIENTSECRET=$( microk8s.kubectl get secret cn -o json -n gluu --kubeconfig=" $KUBECONFIG " | grep ' "jca_client_pw":' | sed -e ' s#.*:\(\)#\1#' | tr -d ' "' | tr -d " ," | tr -d ' [:space:]' | base64 -d)
122
- echo -e "Testing protected endpoint /token without client crt and key. This should show a 403, showing mTLS works \n"
123
- curl -X POST -k -u $TESTCLIENT :$TESTCLIENTSECRET https://demoexample.gluu.org/jans-auth/restv1/token -d grant_type=client_credentials
124
- echo -e "Testing protected endpoint /token with client crt and key. This should recieve a token, showing mTLS works \n"
125
- curl -X POST -k --cert client.crt --key client.key -u $TESTCLIENT :$TESTCLIENTSECRET https://demoexample.gluu.org/jans-auth/restv1/token -d grant_type=client_credentials
126
- echo -e "Testing protected endpoint /register without client crt and key. This should show a 403, showing mTLS works \n"
127
- curl -X POST -k -u $TESTCLIENT :$TESTCLIENTSECRET https://demoexample.gluu.org/jans-auth/restv1/register
128
- echo -e "Testing protected endpoint /register with client crt and key. This should still recieve an error but from the AS showing mTLS works \n"
129
- curl -X POST -k --cert client.crt --key client.key -u $TESTCLIENT :$TESTCLIENTSECRET https://demoexample.gluu.org/jans-auth/restv1/register
130
- cd ..
131
- EOF
132
- sudo microk8s.kubectl -n jans wait --for=condition=available --timeout=600s deploy/jans-auth-server --kubeconfig=" $KUBECONFIG "
133
- sudo bash testendpoints.sh
134
- echo -e " You may re-execute bash testendpoints.sh to do a quick test to protected endpoints and openid-configuration endpoint."
81
+ sudo helm install gluu gluu-flex/gluu -n gluu -f override.yaml --kubeconfig=" $KUBECONFIG "
82
+ echo " Waiting for the configuration job to complete. Please do not cancel out. This can take up to 3 minutes."
83
+ sudo microk8s.kubectl -n gluu wait --for=condition=complete --timeout=180s deploy/gluu-config --kubeconfig=" $KUBECONFIG "
84
+ sudo microk8s.kubectl get secret cn -n gluu --kubeconfig=" $KUBECONFIG " --template={{.data.ssl_ca_cert}} | base64 -d > ca.crt
85
+ sudo microk8s.kubectl get secret cn -n gluu --kubeconfig=" $KUBECONFIG " --template={{.data.ssl_cert}} | base64 -d > server.crt
86
+ sudo microk8s.kubectl get secret cn -n gluu --kubeconfig=" $KUBECONFIG " --template={{.data.ssl_key}} | base64 -d > server.key
87
+ sudo microk8s.kubectl create secret generic tls-ob-ca-certificates -n gluu --kubeconfig=" $KUBECONFIG " --from-file=tls.crt=server.crt --from-file=tls.key=server.key --from-file=ca.crt=ca.crt
88
+ sudo microk8s.kubectl rollout restart deployment gluu-auth-server -n gluu --kubeconfig=" $KUBECONFIG "
89
+ sudo microk8s.kubectl rollout restart deployment gluu-config-api -n gluu --kubeconfig=" $KUBECONFIG "
90
+ echo " Waiting for gluu-flex to come up. Please do not cancel out. This can take up to 5 minutes."
91
+ sudo microk8s.kubectl -n gluu wait --for=condition=available --timeout=300s deploy/gluu-auth-server --kubeconfig=" $KUBECONFIG "
0 commit comments