Refine Container Startup
[aaf/authz.git] / docs / sections / configuration / AAF_4.1_config.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright © 2017 AT&T Intellectual Property. All rights reserved.
4
5 ========================================
6 Automated Configuration and Certificates
7 ========================================
8
9 *Note: this document assumes UNIX Bash Shell.  Being Java, AAF works in Windows, but you will have to create your own script/instruction conversions.*
10
11 =================
12 Optimal Strategy
13 =================
14
15 ONAP is deployed in Docker Containers or Kubernetes managed Docker Containers.  Therefore, this instruction utilizes a Docker Container as a standalone Utility... (This means that this container will stop as soon as it is done with its work... it is not a long running daemon)
16
17 Given that all ONAP entities are also in Docker Containers, they all can access Persistent Volumes.
18
19 This tool creates all the Configurations, including Certificates, onto a declared Volume on the directories starting with "/opt/app/osaaf"
20
21 ==================
22 Prerequisites
23 ==================
24   * Access to a RUNNING AAF System
25
26     * For ONAP TEST, this means
27
28       * Windriver VPN
29       * include lastest IP of aaf-onap-test.osaaf.org" in your /etc/hosts or DNS
30
31         * As of Mar 20, 2019, this is 10.12.5.145. 
32
33   * For Writing to Volumes for Docker or K8s
34
35     * Docker
36
37       * Note: it does NOT have to be the SAME Docker that AAF is deployed on...
38
39          * but it DOES have be accessible to the AAF Instance.  
40
41   * For creating Configurations on Local Disk
42
43     * For Development purposes
44     * For running AAF on Bare Metal (or VM)
45     * A Truststore that includes your CA
46
47       * for ONAP TEST, you can obtain truststoreONAPall.jks from the `AAF FileServer`_.
48
49         * (You can also get the ONAP TEST Root CA there)
50
51     * the latest aaf-cadi-aaf-<VERSION>-full.jar from `ONAP Nexus`_.
52     * you can still use the same "agent.sh" script below
53
54 .. _AAF FileServer: http://aaf-onap-test.osaaf.org/-
55 .. _ONAP Nexus: https://nexus.onap.org/#nexus-search;gav~~aaf-cadi-aaf~~~
56
57 -----------------------
58 Obtain the Agent Script
59 -----------------------
60 Choose the directory you wish to start in... 
61
62 If you don't want to clone all of AAF, just get the "agent.sh" from a Browser:
63
64   https://gerrit.onap.org/r/gitweb?p=aaf/authz.git;a=blob_plain;f=auth/docker/agent.sh;hb=HEAD
65   
66   rename file "auth-docker-agent.sh" to "agent.sh" (named because of subdirectory in which it is found) 
67
68 Note: curl/wget returns an  html, instead of text.  This cannot be used!
69   | You have to mv, and rename it to "agent.sh", but avoids full clone...
70
71 =============
72 Run Script
73 =============
74 ----------------
75 For Docker/K8s
76 ----------------
77 In your chosen directory ::
78  
79   $ bash agent.sh
80
81 The Agent will look for "aaf.props", and if it doesn't exist, or is missing information, it will ask for it.
82
83 This file is available to reuse for multiple calls. More importantly, you should use it as a template for auto-configuration.  (In ONAP, these are HEAT templates and OOM Helm Charts)
84
85 --------------------------
86 For Local/BareMetal (VM)
87 --------------------------
88 In your chosen directory ::
89  
90   $ bash agent.sh local <instructions>
91
92 The Agent will look for "aaf.props", and if it doesn't exist, or is missing information, it will ask for it.
93
94 IMPORTANT: When you are doing "LOCAL", you are creating a CERTIFICATE for your local Machine.  Therefore, you need to AUTHORIZE this creation 
95 by creating an "Artifact" as the OWNER of the Namespace (In ONAP Test, all the NSs are owned by "aaf_admin@people.osaaf.org")
96
97   1) Copy the out-of-the-box Artifact from the Credentials of your Namespace
98  
99     * In ONAP Test, as "aaf_admin", click https://aaf-onap-test.osaaf.org:8200/gui/ns
100     * Select the NS you are need a Certificate for (i.e. org.onap.aai)
101     * Select the Green "Cred Details" button in Credentials area
102     * Select "View All" on credential line
103     * Select the ONAP default FQDN line's "Details" button
104     * Select "Copy Artifact" Radio Button at Bottom, and enter YOUR MACHINE'S FQDN in the entry box that appears.
105     * Click "Copy" button
106     * Click "Artifacts Show" Breadcrumb. You should see your new entry.
107
108   2) Edit the new Artifact to match your Local Machine
109
110     * Check the SANS.  If it does not include the original FQDN, then add it.  (Example, add "aai").  This is so this Certificate can be used by aai
111       inside of containers as well.  
112     * Change the "Directory" to be the Local Directory you want to put your Local Certs in. 
113     * Change the "O/S User" to be the O/S user that needs to access the Certificate (yours)
114     * Click on the Artifact types you want.  "file" means PEM format private key and cert.  "script" has ready-made O/S crontab and validation scripts 
115       for auto-renewal of O/S based Services.  We will do something different for containers.
116     * click "Update"
117
118   3) Be sure to validate this information with a "read" command on your target machine.
119
120 <**Instructions**> - Commands you can do with agent.sh local:
121
122 Note: There are some command line defaults, relating to ID from aaf.props and FQDN, if your local machine (uname -n) REPORTS the same name as your FQDN.  
123 If it does not, you will need to explicitly set the command.  Examples will use "aai" and local machine "mymachine.myco.com"
124
125   read 
126     Prints the Artifact information from Certificate Manager related to command.  Generally, it's a good idea to Read to make sure things are setup
127     Example: ``$ bash agent.sh local read aai@aai.onap.org mymachine.myco.com``
128
129   place 
130     Actually creates the Certificate Artifacts requested on disk, in the directory requested with the O/S User requested, etc.
131     Depending on what you asked for in the Artifact, you should see:
132     Example: ``$ bash agent.sh local place aai@aai.onap.org mymachine.myco.com``
133
134       | Writing to /private/tmp/onap
135       | Writing file /private/tmp/onap/org.onap.aai.keyfile
136       | Writing file /private/tmp/onap/org.onap.aai.crt
137       | Writing file /private/tmp/onap/org.onap.aai.key
138       | Writing file /private/tmp/onap/org.onap.aai.p12
139       | Writing file /private/tmp/onap/org.onap.aai.trust.jks
140       | Writing file /private/tmp/onap/org.onap.aai.check.sh
141       | Writing file /private/tmp/onap/org.onap.aai.crontab.sh
142       | Creating new /private/tmp/onap/org.onap.aai.cred.props
143       | 2019-03-25T09:14:29.174-0500: Trans Info
144       |   REMOTE Place Artifact 2743.9736ms
145       |   Reconstitute Private Key 0.212454ms
146       |
147
148     Focus on "Reconstitute Private Key"... if that isn't there, it didn't create
149
150   showpass 
151     Shows the passwords generated and used for the various artifacts that need them.  Example org.onap.aai. will be generated with a password.
152     Example: ``$ bash agent.sh local showpass aai@aai.onap.org mymachine.myco.com``
153
154 =======================
155 'aaf.prop' Properties
156 =======================
157
158 These properties will be created when you run "agent.sh".  Many of the values will be defaulted, or allow you to change.  It will be placed into an "aaf.props" file for you to save, edit or otherwise modify/utilize.
159
160 ==================== ================= ============
161 Query                Tag               Description
162 ==================== ================= ============
163 DOCKER REPOSITORY    DOCKER_REPOSITORY Defaults to current ONAP Repository
164 CADI Version         VERSION           Defaults to current CADI (AAF) version
165 AAF's FQDN           AAF_FQDN          PUBLIC Name for AAF. For ONAP Test, it is 'aaf-onap-test.osaaf.org'
166 AAF FQDN IP          AAF_FQDN_IP       If FQDN isn't actually found with DNS, you will have to enter the IP.  For 'aaf-onap-test.osaaf.org', as of March 20, 2019, it is '10.12.5.145'
167 Deployer's FQI       DEPLOY_FQI        In a REAL system, this would be a person or process. For ONAP Testing, the id is 'deployer@people.osaaf.org'
168 Deployer's PASSWORD  DEPLOY_PASSWORD   OPTIONAL!! REAL systems should not store passwords in clear text. For ONAP Testing, the password is 'demo123456!'
169 App's Root FQDN      APP_FQDN          This will show up in the Cert Subject, make it the App Acronym. i.e 'clamp'
170 App's FQI            APP_FQI           Fully Qualified ID given by Organization and with AAF NS/domain.  ex: 'clamp@clamp.onap.org'
171 App's Volume         VOLUME            Volume to put the data, see above. ex: 'clamp_config'
172 DRIVER               DRIVER            Docker Volume type... See Docker Volume documentation. Default is 'local'
173 LATITUDE of Node     LATITUDE          Global latitude coordinate of Node (best guess in Kubernetes)
174 LONGITUDE of Node    LONGITUDE         Global longitude coordinate of Node (best guess in Kubernetes)
175 HOSTNAME             HOSTNAME          Defaults to SYSTEM provided "hostname". Use when System doesn't report what is actually needed, such as vanity urls, multi-NIC cards, short names, i.e. htydb77 reported instead of htydb77.some.company.org, etc.
176 Docker User          DUSER             User needed inside the Docker Container.  Without, this will be root
177 Container NS         CONTAINER_NS      The Namespace for the container.  Provided for Multi-NS support, this would be "onap" for Test OOM, etc.
178 ==================== ================= ============
179
180 =================================
181 Typical ONAP Entity Info in AAF
182 =================================
183 *This is not intended to be a comprehensive list, but a short list of main entities*
184
185 ============================= ===========================  ======================= ==============================================
186 ONAP Namespaces               APP FQI                      APP FQDN OOM            APP FQDN HEAT
187 ============================= ===========================  ======================= ==============================================
188 org.osaaf.aaf                 aaf@aaf.osaaf.org            aaf.onap                aaf.api.simpledemo.onap.org
189 org.onap.aaf-sms              aaf-sms@aaf-sms.onap.org     aaf-sms.onap            aaf-sms.api.simpledemo.onap.org
190 org.onap.aai                  aai@aai.onap.org             aai.onap                aai.api.simpledemo.onap.org
191 org.onap.appc                 appc@appc.onap.org           appc.onap               appc.api.simpledemo.onap.org
192 org.onap.clamp                clamp@clamp.onap.org         clamp.onap              clamp.api.simpledemo.onap.org
193 org.onap.dcae                 dcae@dcae.onap.org           dcae.onap               dcae.api.simpledemo.onap.org
194 org.onap.dmaap                dmaap@dmaap.onap.org         dmaap.onap              dmaap.api.simpledemo.onap.org                                         
195 org.onap.dmaap-bc             dmaap-bc@dmaap-bc.onap.org   dmaap-bc.onap           dmaap-bc.api.simpledemo.onap.org
196 org.onap.dmaap-dr             dmaap-bc@dmaap-dr.onap.org   dmaap-dr.onap           dmaap-dr.api.simpledemo.onap.org                                           
197 org.onap.dmaap-mr             dmaap-mr@dmaap-mr.onap.org   dmaap-mr.onap           dmaap-mr.api.simpledemo.onap.org
198 org.onap.oof                  oof@oof.onap.org             oof.onap                oof.api.simpledemo.onap.org
199 org.onap.policy               policy@policy.onap.org       policy.onap             policy.api.simpledemo.onap.org
200 org.onap.pomba                pomba@pomba.onap.org         pomba.onap              pomba.api.simpledemo.onap.org
201 org.onap.portal               portal@portal.onap.org       portal.onap             portal.api.simpledemo.onap.org
202 org.onap.sdc                  sdc@sdc.onap.org             sdc.onap                sdc.api.simpledemo.onap.org
203 org.onap.sdnc                 sdnc@sdnc.onap.org           sdnc.onap               sdnc.api.simpledemo.onap.org
204 org.onap.so                   so@so.onap.org               so.onap                 so.api.simpledemo.onap.org
205 org.onap.vfc                  vfc@vfc.onap.org             vfc.onap                vfc.api.simpledemo.onap.org
206 org.onap.vid                  vid@vid.onap.org             vid.onap                vid.api.simpledemo.onap.org
207 ============================= ===========================  ======================= ==============================================
208
209 *Note 1: FQDNs are set in AAF's Credential Artifact data, accessible in "Cred Details" from Namespace Page*
210
211 *Note 2: Also, AAF itself is different, as it is not an ONAP only component... It is also expected to be used outside of ONAP.*
212
213 If something goes wrong, and Certificate is not created, you can adjust the data, remove the data from the Container's /opt/app/osaaf/local dir, and it will generate again. ::
214
215   root@77777:/opt/app/osaaf/local# rm *
216   root@77777:/opt/app/osaaf/local# exit
217   $ bash agent.sh bash
218
219 ===============
220 Informational
221 ===============
222
223 There are two sets of Credentials at play here.  The ability to create the Certificate belongs to one of
224   
225   * The person responsible for the ID in the Organization 
226   * A delegated deployer
227
228 It is expected in large organizations that Individual Employees are given the responsibility of an ID for an APP they are responsible for.
229
230   In ONAP test, to simplify create/tear-down environment... 
231      | The **Owner** is always "mmanager@people.osaaf.org". 
232      | The **Sponsor** is always "aaf_admin@people.osaaf.org".
233
234 In a large org, there are probably many Operations teams to support many different apps.
235
236   In ONAP test, 
237      The **Deployer** is always set to "deployer@people.osaaf.org" for all Apps.
238
239
240
241
242
243
244
245
246
247
248
249