Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
5c239da
add setup files
Hu5ton Oct 13, 2022
09009ac
Added initial LiveLab files
milesnov Oct 13, 2022
9995d2e
Corrected Lab Names
milesnov Oct 20, 2022
5e9b817
Worked on first lab and introduction
NGalloso Nov 3, 2022
eb17e7f
Deleted currently unneeded files, renamed files to match conventions,…
milesnov Nov 3, 2022
3513fd4
Added basic steps for labs 2-3
milesnov Nov 9, 2022
a82c1b2
Merge pull request #1 from milesnov/main
milesnov Nov 14, 2022
d6ab6fe
Added cloud shell step to first lab, small other changes throughout
milesnov Nov 16, 2022
c3c7710
Merge pull request #2 from milesnov/main
milesnov Nov 16, 2022
28b8e55
Updates to Lab 2 & Lab 3
milesnov Nov 16, 2022
8190cca
Merge pull request #3 from milesnov/main
milesnov Nov 16, 2022
0825e98
Added Some Screenshots
NGalloso Nov 16, 2022
ed0712a
Fixed small issue with Note
NGalloso Nov 16, 2022
1d6463a
Update lab1-task1-step4.png
NGalloso Nov 16, 2022
aae4f52
Updates to text descriptions & fixed one step
milesnov Nov 16, 2022
1630f97
Merge branch 'NGalloso:main' into main
milesnov Nov 16, 2022
06ec4b0
Merge pull request #4 from milesnov/main
milesnov Nov 16, 2022
115a3e0
Removed Screenshots and added descriptions instead
NGalloso Nov 17, 2022
8b1dd3c
Added screenshots to show successful connection to database
NGalloso Nov 17, 2022
6e6ecd2
Other file changes
milesnov Nov 29, 2022
01bc1c3
Added optional lab and other small changes
milesnov Dec 1, 2022
a27cfd3
changes to lab 2 and many step descriptions.
milesnov Dec 2, 2022
f02bca8
Acknowledgements added
milesnov Dec 2, 2022
ac5f0f3
Attempt to fix paths
NGalloso Dec 5, 2022
f16527e
Updated Lab 3 steps and added output examples.
milesnov Dec 6, 2022
51e1949
Merge branch 'main' of https://github.com/NGalloso/database
milesnov Dec 6, 2022
48eb09a
Small fix
milesnov Dec 6, 2022
a6f1f3e
Obscured user information in Lab #3 and added a note about it.
milesnov Dec 6, 2022
dd20df6
Small Fix
milesnov Dec 6, 2022
9a35616
Format fix
milesnov Dec 6, 2022
858981d
Implemented Rich's recommended Changes
milesnov Dec 9, 2022
8575b56
Updated Cloud Shell access directions
milesnov Dec 9, 2022
a8f40db
Made some fixes to typos and attempting fixes on weird formatting
NGalloso Dec 9, 2022
2ae73bb
Fixed Richard Evans name
NGalloso Dec 9, 2022
484cd22
Attempt to fix weird formatting
NGalloso Dec 9, 2022
3b2f3b4
Small cleanup done
NGalloso Dec 12, 2022
af51f28
Added Appendix and Notes for edge case where Direct Sign-In is needed
NGalloso Dec 19, 2022
8c9536d
Moved note for sign in error
NGalloso Jan 5, 2023
e2879d5
Fixed more formatting
NGalloso Jan 5, 2023
40e1db3
Updated Introduction to the lab that talks about the cloud shell
NGalloso Jan 9, 2023
d40c95b
Added QA Changes
milesnov Jan 13, 2023
7649539
Manifest path fix
milesnov Jan 13, 2023
31114ab
Fixed naming and captions
NGalloso Jan 13, 2023
71e607a
Fixed typos
NGalloso Jan 17, 2023
ccf6933
Final Format updates + new images for Lab4
milesnov Jan 17, 2023
e36c2ee
Temporary Update to Screenshots
NGalloso Jan 19, 2023
80958f1
Fixed workshop title
milesnov Jan 23, 2023
5145fad
Small fixes
milesnov Jan 26, 2023
39aa4f7
Updated File names to adhere to livelabs QA standards.
milesnov Jan 30, 2023
d9cc4a0
Merge branch 'oracle-livelabs:main' into main
milesnov Jan 30, 2023
5d6daa3
Added levelup23 folder with index.html & manifest.json
milesnov Feb 10, 2023
fd611f3
Merge branch 'main' of https://github.com/NGalloso/database
milesnov Feb 10, 2023
28e6929
Merge branch 'oracle-livelabs:main' into main
milesnov Feb 10, 2023
e9a2fae
Added image with new redwood theme
milesnov Feb 16, 2023
d33b476
Merge branch 'main' of https://github.com/NGalloso/database
milesnov Feb 16, 2023
ab9dedc
Updated some images to redwood
NGalloso Feb 16, 2023
e2302e7
Merge branch 'main' of https://github.com/NGalloso/database
NGalloso Feb 16, 2023
705d7f5
Updated images for redwood again
NGalloso Feb 16, 2023
35a9cca
Merge branch 'oracle-livelabs:main' into main
milesnov Feb 16, 2023
affb20f
Updating create user screenshot
NGalloso Feb 22, 2023
684a004
Updated Lab to add administrative user
NGalloso Feb 22, 2023
b5caa65
covered emails in image
NGalloso Feb 22, 2023
e808f82
Merge branch 'oracle-livelabs:main' into main
milesnov Feb 22, 2023
465061e
Added a quick note to prevent insert sql code errors
NGalloso Mar 13, 2023
8433ae9
Merge branch 'oracle-livelabs:main' into main
milesnov Mar 13, 2023
c5ced5e
Merge branch 'oracle-livelabs:main' into main
milesnov Mar 14, 2023
fc7509f
QA and Alan changes pt1
NGalloso Apr 7, 2023
8f2c2e5
QA + Alan changes Labs 2-4
milesnov Apr 18, 2023
c9f9321
Added echo root_comp_id
NGalloso Apr 25, 2023
253c9ac
Final QA changes
milesnov Apr 28, 2023
140ade9
Merge branch 'main' into main
milesnov Apr 28, 2023
06db8b8
Intro Format fix
milesnov May 1, 2023
5e1f819
Merge branch 'main' of https://github.com/NGalloso/database
milesnov May 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions oci-adb-iam/cleanup/cleanup.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,35 @@ This lab assumes that you have completed the previous labs and created all resou
<copy>oci iam group delete --group-id $DB_ADMIN_OCID</copy>
```

5. You may now close your cloud shell session, as you will use the OCI Console to delete the final resource. Click on the hamburger icon in the top left corner. Choose **Identity and Security** then **Policies**.
5. You may now close your cloud shell session, as you will use the OCI Console to delete the final resources. Click on the hamburger icon in the top left corner. Choose **Identity and Security** then **Policies**.

![Identity and Security](https://oracle-livelabs.github.io/common/images/console/id-policies.png " ")

6. Ensure that you are in your root compartment, and you should see the policiy called **grant-adb-access**. Click the box next to its name then click delete.
6. Ensure that you are in your root compartment, and you should see the policiy called **grant-adb-access**. Check the box next to its name then click **Delete**.

![Policy Page - Delete](images/delete-policy.png)

7. Next you will click on the **Profile** icon in the top right corner and choose **My profile**.

![Navigate to user profile](images/user-profile.png)

8. Scroll down to the bottom of the page, choose **Database passwords**. Find the database password that you created in this lab, identified by the description "DB password for your OCI account". Check the box next to it and choose **Delete**.

![Delete database password](images/delete-database-password.png)

## Appendix: Delete federated IAM user

1. This step is only necessary if you followed the steps in the Lab 1 appendix to create a federated IAM user. Log out of OCI with the federated user. Log back in with your original user and delete the federated user with the following command.

```
<copy>oci iam user delete --user-id [Federated user OCID]</copy>
```

Your OCI tenancy should now be cleared of all lab resources.

## Acknowledgements
* **Author**
* Richard Evans, Database Security Product Management
* Miles Novotny, Solution Engineer, North America Specialist Hub
* Noah Galloso, Solution Engineer, North America Specialist Hub
* **Last Updated By/Date** - Miles Novotny, December 2022
* **Last Updated By/Date** - Miles Novotny, April 2023
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added oci-adb-iam/cleanup/images/user-profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 19 additions & 16 deletions oci-adb-iam/db-credentials-and-login/db-credentials-and-login.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,35 @@
## Introduction

Now that you have enabled IAM as the identity provider of your ADB, in this lab you will
create IAM credentails for your user and use them to connect to the database. First we connect with our IAM username and password, then with a token. Using a token lets you connect to the database without a password, and is possible for you because of the OCI_TOKEN parameter you added to the tnsnames.ora file in the previous lab. Not needing a password is useful if you have hundreds of databases in your environment, as managing passwords for each DB can be time consuming.
create IAM database credentials for your user and use them to connect to the database. First we connect with our IAM database username and password, then with a token. Using a token lets you connect to the database without a password, and is possible for you because of the OCI_TOKEN parameter you added to the tnsnames.ora file in the previous lab. Using a token instead of a password is more secure since the password verifier isn’t used and sent across the network.

*Estimated Lab Time*: 15 minutes

Watch the video below for a quick walk-through of the lab.
[Create IAM Credentials and log into the database](videohub:1_tth3qivl)

### Objectives
- Create IAM credentials for users of your ADB
- Use IAM credentials to log into and query the database
- Use a IAM Token to connect to and query the database
- Create IAM database credentials for users of your ADB
- Use IAM database credentials to log into and query the database
- Use an IAM Token to connect to and query the database

### Prerequisites
This lab assumes that you have completed the introduction lab.

### Prerequisites
This lab assumes that you have completed the previous labs and successfully enabled IAM as your database identity provider.

>**Note:** An IAM database password is not the same as your IAM console password. The IAM database password is created separately in your IAM user profile.

## Task 1: Connect to the database as your OCI user.

1. Create IAM credentials for your OCI user
1. Create an IAM database credential for your OCI user

```
<copy>oci iam user create-db-credential --user-id $OCI_CS_USER_OCID --password Oracle123+Oracle123+ --description "DB password for your OCI account"</copy>
```

2. Connect to database with IAM credentials as your OCI user. All values you see should match the output below except for **AUTHENTICATED\_IDENTITY** and **ENTERPIRSE\_IDENTITY**. These are unique to your user.
2. Connect to the database with the IAM database credentials as your OCI user. All values you see should match the output below except for **AUTHENTICATED\_IDENTITY** and **ENTERPRISE\_IDENTITY**. These are unique to your user.

```
<copy>sql /nolog <<EOF
Expand All @@ -45,7 +47,7 @@ This lab assumes that you have completed the previous labs and successfully enab
```

```
<copy>SYS_CONTEXT('SYS_SESSION_ROLES','SR_DBA_ROLE')
SYS_CONTEXT('SYS_SESSION_ROLES','SR_DBA_ROLE')
_________________________________________________
FALSE

Expand Down Expand Up @@ -77,7 +79,7 @@ This lab assumes that you have completed the previous labs and successfully enab

SYS_CONTEXT('USERENV','NETWORK_PROTOCOL')
____________________________________________
tcps</copy>
tcps
```

3. Add your OCI user to the **DB_ADMIN** group.
Expand All @@ -86,7 +88,7 @@ This lab assumes that you have completed the previous labs and successfully enab
<copy>oci iam group add-user --user-id $OCI_CS_USER_OCID --group-id $DB_ADMIN_OCID</copy>
```

4. Connect to the database with IAM credentials again. Because the **DB\_ADMIN** IAM group is mapped to the **SR\_DBA\_ROLE** ADB group you will see the first query of this script now return TRUE. Again, all all values you see should match the output below except for **AUTHENTICATED\_IDENTITY** and **ENTERPIRSE\_IDENTITY**. These are unique to your user.
4. Connect to the database with IAM credentials again. Because the **DB\_ADMIN** IAM group is mapped to the **SR\_DBA\_ROLE** ADB group you will see the first query of this script now return TRUE. Again, all all values you see should match the output below except for **AUTHENTICATED\_IDENTITY** and **ENTERPRISE\_IDENTITY**. These are unique to your user.

```
<copy>sql /nolog <<EOF
Expand All @@ -102,7 +104,7 @@ This lab assumes that you have completed the previous labs and successfully enab
```

```
<copy>SYS_CONTEXT('SYS_SESSION_ROLES','SR_DBA_ROLE')
SYS_CONTEXT('SYS_SESSION_ROLES','SR_DBA_ROLE')
_________________________________________________
TRUE

Expand Down Expand Up @@ -134,18 +136,19 @@ This lab assumes that you have completed the previous labs and successfully enab

SYS_CONTEXT('USERENV','NETWORK_PROTOCOL')
____________________________________________
tcps</copy>
tcps
```

## Task 2: Connect to the database with a token.

1. Generate a token used for database access. It is possible to generate this token because of the OCI_TOKEN parameter we added to the tnsnames.ora file in the previous lab. Not needing a password is useful if you have hundreds of databases in your environment, as managing passwords for each DB can be time consuming.
1. Generate a token used for database access. It is possible to use a token when using a ‘/’ (slash) login because of the OCI_TOKEN parameter we added to the connect string in the tnsnames.ora file in the previous lab. Using a token instead of a password is more secure since you’re not using and sending a password verifier to the database.
>**Note:** The IAM token is stored in a default location which is also known by the database client. A directory location can also be specified when retrieving and using the token.

```
<copy>oci iam db-token get</copy>
```

2. Connect to the database using your token. Notice that the **AUTHENTICATION\_METHOD** is now listed as **TOKEN\_GLOBAL**, rather than **PASSWORD\_GLOBAL**, which it is when you access the database with an IAM username and password.
2. Connect to the database using your token. Notice that the **AUTHENTICATION\_METHOD** is now listed as **TOKEN\_GLOBAL**, rather than **PASSWORD\_GLOBAL**, which it is when you access the database with an IAM username and IAM database password.

```
<copy>sql /@lltest_high <<EOF
Expand All @@ -160,7 +163,7 @@ This lab assumes that you have completed the previous labs and successfully enab
```

```
<copy>SYS_CONTEXT('SYS_SESSION_ROLES','SR_DBA_ROLE')
SYS_CONTEXT('SYS_SESSION_ROLES','SR_DBA_ROLE')
_________________________________________________
TRUE

Expand Down Expand Up @@ -192,7 +195,7 @@ This lab assumes that you have completed the previous labs and successfully enab

SYS_CONTEXT('USERENV','NETWORK_PROTOCOL')
____________________________________________
tcps</copy>
tcps
```

You may now **proceed to the next lab.**
Expand All @@ -207,4 +210,4 @@ You may now **proceed to the next lab.**
* Richard Evans, Database Security Product Management
* Miles Novotny, Solution Engineer, North America Specialist Hub
* Noah Galloso, Solution Engineer, North America Specialist Hub
* **Last Updated By/Date** - Miles Novotny, December 2022
* **Last Updated By/Date** - Miles Novotny, April 2023
12 changes: 8 additions & 4 deletions oci-adb-iam/introduction/introduction.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Introduction

### Why use Identity and Access Management with Autonomous Database
## About this Workshop

Managing users on a database-by-database basis is cumbersome, especially when working with a large number of databases. It can lead to mistakes where database user accounts exist long after the user has left the organization. Additionally, users within organizations change teams or are promoted but often never have their privileges from their previous role revoked. This causes them to end up overprivileged for their current responsibilities. Integrating database users with Oracle Identity and Access Management (IAM) is a quick and easy way to simplify user management across multiple ADBs and improve security.
Managing users on a database-by-database basis is cumbersome, especially when working with a large number of databases. It can lead to mistakes where database user accounts exist long after the user has left the organization. Additionally, users within organizations change teams or are promoted but often never have their privileges from their previous role revoked. This causes them to end up overprivileged for their current responsibilities. Integrating database users with Oracle Identity and Access Management (IAM) is a quick and easy way to simplify user management across OCI managed databases such as the Autonomous Database, ExaCS, Base DBS and ExaCC.

Estimated Workshop Time: 1 hour

Expand All @@ -12,7 +12,7 @@ In this workshop, you will learn how to:
* Provision an Autonomous Database
* Set IAM as the identity provider of your ADB
* Grant IAM users access to your ADB
* Access and interact with your ADB using IAM credentials
* Access and interact with your ADB using IAM database password
* Access and interact with your ADB using a token

### Prerequisites
Expand All @@ -21,6 +21,10 @@ In order to do this workshop, you need

* An Oracle Free Tier, Always Free, Paid or LiveLabs Cloud Account

### Note

Some screenshots and videos may be different than what you see. These screenshots and videos were with a tenancy with IAM and not using IAM with Identity Domains. However, the functionality remains the same. Only use the default (root) domain when working with IAM with Identity Domains.

## Learn More

* [Oracle Identity and Access Management](https://www.oracle.com/security/identity-management/)
Expand All @@ -31,4 +35,4 @@ In order to do this workshop, you need
* Richard Evans, Database Security Product Management
* Miles Novotny, Solution Engineer, North America Specalist Hub
* Noah Galloso, Solution Engineer, North America Specalist Hub
* **Last Updated By/Date** - Miles Novotny, December 2022
* **Last Updated By/Date** - Miles Novotny, April 2023
39 changes: 26 additions & 13 deletions oci-adb-iam/oci-wallet-and-enable-iam/oci-wallet-and-enable-iam.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ This lab assumes that you have completed the previous labs and have created all
<copy>oci db autonomous-database generate-wallet --autonomous-database-id $ADB_OCID --password Oracle123+ --file $HOME/adb_wallet/lltest_wallet.zip</copy>
```

3. Navigate to the adb_wallet directory.
## Task 2: Enable OCI IAM as the identity provider and provision global schema and role

1. Navigate to the adb_wallet directory.

```
<copy>cd $HOME/adb_wallet</copy>
```

## Task 2: Enable OCI IAM as the identity provider

1. Open the SQL command line, then connect to the database using the wallet file.
2. Open the SQL command line, then connect to the database using the wallet file.
>**Note:** This command only works from inside the adb_wallet folder. Insure that you have navigated to it as shown in the previous steps.

>**Note:** When using SQL, do not paste commands using Crtl-V as hidden characters will also be inserted resulting in an error of unknown command. You can use Crtl-Shift-V as a substitute if using a keyboard to insert copied code.
Expand All @@ -54,33 +54,33 @@ This lab assumes that you have completed the previous labs and have created all
conn admin/Oracle123+Oracle123+@lltest_high</copy>
```

2. Query to select the identity provider, and see that it is **NONE** by default.
3. Query to select the identity provider, and see that it is **NONE** by default.

```
<copy>select name, value from v$parameter where name ='identity_provider_type';</copy>
```


```
<copy>NAME VALUE
NAME VALUE
_________________________ ________
identity_provider_type NONE</copy>
identity_provider_type NONE
```

3. Now enable IAM as the identity provider. Query the idenity provider again to see it updated to **OCI_IAM**.
4. Now enable IAM as the identity provider. Query the idenity provider again to see it updated to **OCI_IAM**.

```
<copy>exec dbms_cloud_admin.enable_external_authentication('OCI_IAM');
select name, value from v$parameter where name ='identity_provider_type';</copy>
```

```
<copy>NAME VALUE
NAME VALUE
_________________________ __________
identity_provider_type OCI_IAM</copy>
identity_provider_type OCI_IAM
```

4. Create the **user\_shared** user and grant it permissions to create sessions. Create the **sr\_dba\_role** role and grant it permissions. Quit the SQL session.
5. Create the **user\_shared** user and grant it permissions to create sessions. Create the **sr\_dba\_role** role and grant it permissions. Quit the SQL session.

```
<copy>create user user_shared identified globally as 'IAM_GROUP_NAME=All_DB_Users';
Expand Down Expand Up @@ -117,14 +117,27 @@ This lab assumes that you have completed the previous labs and have created all
cat sqlnet.ora</copy>
```

4. Append the TOKEN_AUTH parameter to the ADB instance's tnsname.ora entry so that an authorization token can be used instead of a password.
The sqlnet.ora file should appear like this.

```
WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY=/home/{your OCI users directory}/adb_wallet)))
SSL_SERVER_DN_MATCH=yes
```

4. Append the TOKEN_AUTH parameter to the ADB instance's tnsnames.ora entry so that an authorization token can be used instead of a password.

```
<copy>head -1 tnsnames.ora.orig | sed -e 's/)))/)(TOKEN_AUTH=OCI_TOKEN)))/' > tnsnames.ora

cat tnsnames.ora</copy>
```

The tnsnames.ora file should appear like this. Some values may vary, depending on your region, for example.

```
lltest_high = (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.us-phoenix-1.oraclecloud.com))(connect_data=(service_name={your database service name}))(security=(ssl_server_cert_dn="CN=adwc.uscom-east-1.oraclecloud.com, OU=Oracle BMCS US, O=Oracle Corporation, L=Redwood City, ST=California, C=US")(TOKEN_AUTH=OCI_TOKEN)(TOKEN_AUTH=OCI_TOKEN)))
```

You may now **proceed to the next lab.**

## Learn More
Expand All @@ -137,4 +150,4 @@ You may now **proceed to the next lab.**
* Richard Evans, Database Security Product Management
* Miles Novotny, Solution Engineer, North America Specialist Hub
* Noah Galloso, Solution Engineer, North America Specialist Hub
* **Last Updated By/Date** - Miles Novotny, December 2022
* **Last Updated By/Date** - Miles Novotny, April 2023
Binary file not shown.
Loading