Keycloak by Neodoo En » Histórico » Versión 3
Francisco Javier Solans Benedí, 2024-04-10 08:08
| 1 | 2 | Francisco Javier Solans Benedí | {{toc}} |
|---|---|---|---|
| 2 | 1 | Francisco Javier Solans Benedí | |
| 3 | 2 | Francisco Javier Solans Benedí | # Usage Instructions |
| 4 | 1 | Francisco Javier Solans Benedí | |
| 5 | 2 | Francisco Javier Solans Benedí | ## Getting started |
| 6 | 1 | Francisco Javier Solans Benedí | |
| 7 | 2 | Francisco Javier Solans Benedí | 1. Launch the product via 1-Click |
| 8 | 2. Use a web browser to access the Admin console at: https://[ec2-ip]:8443, where [ec2_ip] is the public ip provided by Amazon for your instance. |
||
| 9 | 3. Log in using the following credentials: |
||
| 10 | * Username: admin |
||
| 11 | * Password: the instance_id of the instance |
||
| 12 | 1 | Francisco Javier Solans Benedí | |
| 13 | 2 | Francisco Javier Solans Benedí | You can also access your instance via SSH using the username and your Amazon private key. |
| 14 | 1 | Francisco Javier Solans Benedí | |
| 15 | 2 | Francisco Javier Solans Benedí | The **username** depends on the operative system: |
| 16 | * Centos 9 Stream: 'ec2-user' |
||
| 17 | * Other Centos: 'centos' |
||
| 18 | * Ubuntu: 'ubuntu' |
||
| 19 | * Rocky Linux: 'rocky' |
||
| 20 | 1 | Francisco Javier Solans Benedí | |
| 21 | 2 | Francisco Javier Solans Benedí | ## Installation details |
| 22 | 1 | Francisco Javier Solans Benedí | |
| 23 | 2 | Francisco Javier Solans Benedí | ### Keycloak installed with wildfly distribution |
| 24 | 1 | Francisco Javier Solans Benedí | |
| 25 | In versions prior to 19.0.1, we install Keyckloak embedded within the wildfly application server |
||
| 26 | |||
| 27 | The configuration files are located inside the embedded WildFly, that is, in the directory $KEYCLOAK_HOME where KEYCLOAK_HOME is /usr/java/keycloak. |
||
| 28 | |||
| 29 | For more details on the installation, you can refer to the documentation at https://www.keycloak.org/docs/latest/server_installation/index.html |
||
| 30 | |||
| 31 | 2 | Francisco Javier Solans Benedí | ### Keycloak installed with the Quarkus distribution. |
| 32 | |||
| 33 | 1 | Francisco Javier Solans Benedí | From version 19.0.1, we install Keycloak with Quarkus as the distribution with WildFly is deprecated. |
| 34 | |||
| 35 | The configuration file is located in the directory $KEYCLOAK_HOME/conf/keycloak.conf where $KEYCLOAK_HOME is /usr/java/keycloak. |
||
| 36 | |||
| 37 | For more details on the installation, you can refer to the documentation at https://www.keycloak.org/docs/latest/server_installation/index.html |
||
| 38 | |||
| 39 | 2 | Francisco Javier Solans Benedí | ### TLS configuration in Keycloak |
| 40 | |||
| 41 | 1 | Francisco Javier Solans Benedí | By default, we have created a self-signed certificate using Java Keystore so it's not validated by any authority (by default, the Keycloak server looks for the file $KEYCLOAK_HOME/conf/server.keystore). |
| 42 | 2 | Francisco Javier Solans Benedí | |
| 43 | 1 | Francisco Javier Solans Benedí | If you want to obtain a valid certificate, you will need to request one from a certificate authority and make the necessary changes in Keycloak. |
| 44 | |||
| 45 | 2 | Francisco Javier Solans Benedí | ### Service configuration |
| 46 | |||
| 47 | 1 | Francisco Javier Solans Benedí | Server service is configured with systemd. |
| 48 | 2 | Francisco Javier Solans Benedí | |
| 49 | 1 | Francisco Javier Solans Benedí | The Keycloak service is in /etc/systemd/system/keycloak.service, which indicates whether to start Keycloak in development or production mode: |
| 50 | 2 | Francisco Javier Solans Benedí | * If you have chosen Keycloak with H2, the service will start in development mode: ExecStart=/usr/java/keycloak/bin/kc.sh start-dev |
| 51 | * If you have chosen Keycloak with MySQL or PostgreSQL, the service is started for production mode: ExecStart=/usr/java/keycloak/bin/kc.sh start |
||
| 52 | 1 | Francisco Javier Solans Benedí | |
| 53 | View status server: |
||
| 54 | 2 | Francisco Javier Solans Benedí | ``` shell |
| 55 | 1 | Francisco Javier Solans Benedí | [centos@ip-172-31-9-232 etc]$ sudo systemctl status keycloak |
| 56 | 2 | Francisco Javier Solans Benedí | ``` |
| 57 | 1 | Francisco Javier Solans Benedí | |
| 58 | 2 | Francisco Javier Solans Benedí | Stop server: |
| 59 | ``` shell |
||
| 60 | 1 | Francisco Javier Solans Benedí | [centos@ip-172-31-9-232 etc]$ sudo systemctl stop keycloak |
| 61 | 2 | Francisco Javier Solans Benedí | ``` |
| 62 | 1 | Francisco Javier Solans Benedí | |
| 63 | 2 | Francisco Javier Solans Benedí | Start server: |
| 64 | ``` shell |
||
| 65 | 1 | Francisco Javier Solans Benedí | [centos@ip-172-31-9-232 etc]$ sudo systemctl start keycloak |
| 66 | 2 | Francisco Javier Solans Benedí | ``` |
| 67 | 1 | Francisco Javier Solans Benedí | |
| 68 | Data persistence modes |
||
| 69 | |||
| 70 | H2 (Default) |
||
| 71 | |||
| 72 | Keycloak comes with its own embedded Java-based relational database called H2. Usually recommended for development environments, for production environments it is recommended to work with better relational databases. |
||
| 73 | |||
| 74 | We provide products with MySQL or PostgreSQL. |
||
| 75 | |||
| 76 | MySQL |
||
| 77 | |||
| 78 | Keycloak is configured with a MySQL database. |
||
| 79 | |||
| 80 | PostgreSQL |
||
| 81 | |||
| 82 | Keycloak is configured with a PostgreSQL database. |
||
| 83 | |||
| 84 | MySQL |
||
| 85 | 2 | Francisco Javier Solans Benedí | |
| 86 | 1 | Francisco Javier Solans Benedí | View service status: |
| 87 | 2 | Francisco Javier Solans Benedí | ``` shell |
| 88 | 1 | Francisco Javier Solans Benedí | $ sudo systemctl status mysql |
| 89 | 3 | Francisco Javier Solans Benedí | ``` |
| 90 | 1 | Francisco Javier Solans Benedí | |
| 91 | 2 | Francisco Javier Solans Benedí | Stop service: |
| 92 | ``` shell |
||
| 93 | 1 | Francisco Javier Solans Benedí | $ sudo systemctl stop mysql |
| 94 | 2 | Francisco Javier Solans Benedí | ``` |
| 95 | 3 | Francisco Javier Solans Benedí | |
| 96 | 1 | Francisco Javier Solans Benedí | Start service: |
| 97 | 2 | Francisco Javier Solans Benedí | ``` shell |
| 98 | 1 | Francisco Javier Solans Benedí | $ sudo systemctl start mysql |
| 99 | 2 | Francisco Javier Solans Benedí | ``` |
| 100 | |||
| 101 | 1 | Francisco Javier Solans Benedí | Access the MySQL console from your terminal: |
| 102 | 2 | Francisco Javier Solans Benedí | ``` shell |
| 103 | 1 | Francisco Javier Solans Benedí | $ sudo mysql |
| 104 | 2 | Francisco Javier Solans Benedí | ``` |
| 105 | |||
| 106 | 1 | Francisco Javier Solans Benedí | PostgreSQL |
| 107 | 2 | Francisco Javier Solans Benedí | |
| 108 | 1 | Francisco Javier Solans Benedí | View service status: |
| 109 | 2 | Francisco Javier Solans Benedí | ``` shell |
| 110 | 1 | Francisco Javier Solans Benedí | $ sudo systemctl status postgresql |
| 111 | 2 | Francisco Javier Solans Benedí | ``` |
| 112 | 1 | Francisco Javier Solans Benedí | |
| 113 | 2 | Francisco Javier Solans Benedí | Stop service: |
| 114 | ``` shell |
||
| 115 | 1 | Francisco Javier Solans Benedí | $ sudo systemctl stop postgresql |
| 116 | 2 | Francisco Javier Solans Benedí | ``` |
| 117 | 1 | Francisco Javier Solans Benedí | |
| 118 | 2 | Francisco Javier Solans Benedí | Start service: |
| 119 | ``` shell |
||
| 120 | 1 | Francisco Javier Solans Benedí | $ sudo systemctl start postgresql |
| 121 | 2 | Francisco Javier Solans Benedí | ``` |
| 122 | |||
| 123 | 1 | Francisco Javier Solans Benedí | Access the MySQL console from your terminal: |
| 124 | 2 | Francisco Javier Solans Benedí | ``` shell |
| 125 | 1 | Francisco Javier Solans Benedí | $ sudo -u postgres psql |
| 126 | 2 | Francisco Javier Solans Benedí | ``` |
| 127 | 1 | Francisco Javier Solans Benedí | |
| 128 | 2 | Francisco Javier Solans Benedí | ## Other useful data |
| 129 | |||
| 130 | **Location of sensitive information** |
||
| 131 | 1 | Francisco Javier Solans Benedí | All the information is saved in the database. |
| 132 | |||
| 133 | In MySQL the data folder is /var/lib/mysql |
||
| 134 | In PostgreSQL the data folder is /var/lib/pgsql/data |
||
| 135 | |||
| 136 | 2 | Francisco Javier Solans Benedí | **Encryption configuration** |
| 137 | 1 | Francisco Javier Solans Benedí | There is no encrypted data. |
| 138 | |||
| 139 | 2 | Francisco Javier Solans Benedí | **Changing system credentials** |
| 140 | 1 | Francisco Javier Solans Benedí | To change the Kecycloak credentials you have to go to the menu on the right, users, credentials and press the reset button. |
| 141 | |||
| 142 | 2 | Francisco Javier Solans Benedí | **Instructions on how the user interacts with Keycloak to decrypt necessary data** |
| 143 | 1 | Francisco Javier Solans Benedí | You can use the Keycloak management console to view all necessary data. |
| 144 | |||
| 145 | 2 | Francisco Javier Solans Benedí | **How to assess and monitor the health and proper function of the application.** |
| 146 | 1 | Francisco Javier Solans Benedí | 1. Navigate to your Amazon EC2 console and verify that you're in the correct region. |
| 147 | 2. Choose Instance and select your launched instance. |
||
| 148 | 3. Select the server to display your metadata page and choose the Status checks tab at the bottom of the page to review if your status checks passed or failed. |
||
| 149 | |||
| 150 | 2 | Francisco Javier Solans Benedí | ## Additional resources |
| 151 | 1 | Francisco Javier Solans Benedí | |
| 152 | 2 | Francisco Javier Solans Benedí | * https://www.keycloak.org/ |
| 153 | * https://www.keycloak.org/server/enabletls |
||
| 154 | * https://www.keycloak.org/server/configuration |