SPInstall
Versión 1 (Emilio Penna, Martes, 5 de Enero de 2016 12:36:13 -0300)
| 1 | 1 | h1. Instalación Shibboleth SP |
|
|---|---|---|---|
| 2 | 1 | ||
| 3 | 1 | h1. Instalación ShibbolethSP |
|
| 4 | 1 | ||
| 5 | 1 | En esta guia se describe la instalación de Shibboleth SP en un equipo con Debian8 y Apache 2.4. La instalación se realizó en el host sp1.seciu.edu.uy, se debe ajustar el nombre al que corresponda. |
|
| 6 | 1 | ||
| 7 | 1 | ||
| 8 | 1 | h3. 1. Agregar repositorio |
|
| 9 | 1 | ||
| 10 | 1 | La version de Shibboleth SP disponible en los repositorios de debian es bastante obsoleta. El repositorio de SWITCH tiene una version mas actualizada. |
|
| 11 | 1 | ||
| 12 | 1 | <pre> |
|
| 13 | 1 | apt-get install curl |
|
| 14 | 1 | curl -k -O http://pkg.switch.ch/switchaai/SWITCHaai-swdistrib.asc |
|
| 15 | 1 | apt-key add SWITCHaai-swdistrib.asc |
|
| 16 | 1 | apt-get install shibboleth |
|
| 17 | 1 | </pre> |
|
| 18 | 1 | ||
| 19 | 1 | ||
| 20 | 1 | h3. 2. Habilitar un Virtual Host con HTTPS |
|
| 21 | 1 | ||
| 22 | 1 | En forma obligatoria un SP debe ejecutar con HTTPS. Si no se tiene hablitado se puede crear un Virtual Host de la siguiente manera: |
|
| 23 | 1 | ||
| 24 | 1 | <pre> |
|
| 25 | 1 | a2enmod ssl |
|
| 26 | 1 | cp default-ssl shibsp1 |
|
| 27 | 1 | a2ensite shibsp1 |
|
| 28 | 1 | </pre> |
|
| 29 | 1 | ||
| 30 | 1 | ||
| 31 | 1 | h3. 3. Verificacion de estado |
|
| 32 | 1 | ||
| 33 | 1 | El SP tiene una pagina de estado |
|
| 34 | 1 | ||
| 35 | 1 | Para verificar el estado se puede correr el siguiente comando: |
|
| 36 | 1 | ||
| 37 | 1 | <pre> |
|
| 38 | 1 | curl -k https://127.0.0.1/Shibboleth.sso/Status |
|
| 39 | 1 | </pre> |
|
| 40 | 1 | ||
| 41 | 1 | ||
| 42 | 1 | Por defecto solo permite el acceso a la pagina de estado desde localhost. Para habilitar el acceso desde otro equipo, se puede agregar la IP desde la que se quiere acceder. Para esto, editar /etc/shibboleth/shibboleth2.xml, y agregar la ip en el elemento Handler. Ejemplo: |
|
| 43 | 1 | ||
| 44 | 1 | <pre> |
|
| 45 | 1 | <code class="xml"> |
|
| 46 | 1 | <Handler type="Status" Location="/Status" acl="127.0.0.1 ::1 164.73.129.60"/> |
|
| 47 | 1 | </code> |
|
| 48 | 1 | </pre> |
|
| 49 | 1 | ||
| 50 | 1 | ||
| 51 | 1 | Ante cualquier cambio en la configuración de Shibboleth se debe reiniciar el proceso con los siguientes comando: |
|
| 52 | 1 | ||
| 53 | 1 | <pre> |
|
| 54 | 1 | service shibd stop |
|
| 55 | 1 | service shibd start |
|
| 56 | 1 | </pre> |
|
| 57 | 1 | ||
| 58 | 1 | Luego accediendo a la dirección https://sp1.seciu.edu.uy/Shibboleth.sso/Status se puede ver una página xml con información del SP. |
|
| 59 | 1 | ||
| 60 | 1 | ||
| 61 | 1 | h3. 4. Genero claves |
|
| 62 | 1 | ||
| 63 | 1 | <pre> |
|
| 64 | 1 | shib-keygen -f -u _shibd -h sp1.seciu.edu.uy -y 3 -e https://sp1.seciu.edu.uy/shibboleth -o /etc/shibboleth/ |
|
| 65 | 1 | </pre> |
|
| 66 | 1 | ||
| 67 | 1 | h3. 5. Configuracion de entityID |
|
| 68 | 1 | ||
| 69 | 1 | en shibboleth2.xml |
|
| 70 | 1 | ||
| 71 | 1 | Setear identificador de la entidad: entityID. Ejemplo: |
|
| 72 | 1 | ||
| 73 | 1 | <pre><code class="xml"> |
|
| 74 | 1 | <ApplicationDefaults entityID="https://sp1.seciu.edu.uy/shibboleth" |
|
| 75 | 1 | REMOTE_USER="eppn persistent-id targeted-id"> |
|
| 76 | 1 | </code></pre> |
|
| 77 | 1 | ||
| 78 | 1 | Ajustes en elemento Sessions: |
|
| 79 | 1 | ||
| 80 | 1 | Poner handlerSSL="true", y agregar propiedades seguras para cookies en cookieProps. Ejemplo: |
|
| 81 | 1 | ||
| 82 | 1 | <pre><code class="xml"> |
|
| 83 | 1 | <Sessions lifetime="28800" timeout="3600" relayState="ss:mem" |
|
| 84 | 1 | checkAddress="false" handlerSSL="true" cookieProps="; path=/; secure; HttpOnly"> |
|
| 85 | 1 | </code></pre> |
|
| 86 | 1 | ||
| 87 | 1 | Luego se debe reiniciar el proceso de Shibboleth. |
|
| 88 | 1 | ||
| 89 | 1 | Para verificar la configuración se puede ejecutar el siguiente comando: |
|
| 90 | 1 | ||
| 91 | 1 | <pre> |
|
| 92 | 1 | shibd -t. |
|
| 93 | 1 | </pre> |
|
| 94 | 1 | ||
| 95 | 1 | La salida esperada es la siguiente: |
|
| 96 | 1 | ||
| 97 | 1 | <pre> |
|
| 98 | 1 | overall configuration is loadable, check console for non-fatal problems |
|
| 99 | 1 | </pre> |
|
| 100 | 1 | ||
| 101 | 1 | ||
| 102 | 1 | h3. 6. Definir y cargar una fuente de metadata |
|
| 103 | 1 | ||
| 104 | 1 | Obtener metadata del IdP, ej: |
|
| 105 | 1 | ||
| 106 | 1 | https://login.udelar.edu.uy/idp/shibboleth |
|
| 107 | 1 | ||
| 108 | 1 | Se adjunta al final la metadata del IdP de Udelar. |
|
| 109 | 1 | ||
| 110 | 1 | Guardarla en el directorio metadata, si no exsite crearlo. |
|
| 111 | 1 | ||
| 112 | 1 | /etc/shibboleth/metadata/metadata-idp1.xml |
|
| 113 | 1 | ||
| 114 | 1 | Registrarla en el SP, para esto referenciar en shibboleth2.xml |
|
| 115 | 1 | ||
| 116 | 1 | <pre> <code class="xml"> |
|
| 117 | 1 | <MetadataProvider type="XML" path="/etc/shibboleth/metadata/metadata.xml" ></MetadataProvider> |
|
| 118 | 1 | </code> </pre> |
|
| 119 | 1 | ||
| 120 | 1 | ||
| 121 | 1 | h3. 7. Configurar Inicio de Sesión |
|
| 122 | 1 | ||
| 123 | 1 | Se debe configurar elemento SSO dentro del archivo shibboleth2.xml para que use el provedor de identidad: |
|
| 124 | 1 | ||
| 125 | 1 | <pre> <code class="xml"> |
|
| 126 | 1 | <SSO entityID="https://cas2.seciu.edu.uy/idp/shibboleth" |
|
| 127 | 1 | </code></pre> |
|
| 128 | 1 | ||
| 129 | 1 | h3. 8. Configuración del archivo attribute-map.xml |
|
| 130 | 1 | ||
| 131 | 1 | Shibboleth SP extrae los atributos del Assertion SAML que le envia el IdP, y almacena los valores en variables del servidor web. El mapeo entre los atributos recibidos y las variables se define en el archivo attribute-map.xml. |
|
| 132 | 1 | ||
| 133 | 1 | Se puede utilizar el que viene por defecto, luego se van descomentando o agregando los atributos que se utilicen. |
|
| 134 | 1 | Al final se adjunta un ejemplo de archivo attribute-map.xml |
|
| 135 | 1 | ||
| 136 | 1 | ||
| 137 | 1 | h3. 9. Enviar Metadata de su SP para registro |
|
| 138 | 1 | ||
| 139 | 1 | Debe obtener su metadata y contactarse con Seciu para su registro. |
|
| 140 | 1 | ||
| 141 | 1 | La metadata del SP se puede obtener de: https://sp1.seciu.edu.uy/Shibboleth.sso/Metadata |
|
| 142 | 1 | ||
| 143 | 1 | ||
| 144 | 1 | h3. 10. Configuracion de Apache para proteger un recurso |
|
| 145 | 1 | ||
| 146 | 1 | En Apache, se recomienda setear correctamente el ServerName y también setear "UseCanonicalName On". |
|
| 147 | 1 | Tambien se recomienda fuertemente utilizar el "worker" MPM. |
|
| 148 | 1 | ||
| 149 | 1 | Referencia: https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPApacheConfig |
|
| 150 | 1 | ||
| 151 | 1 | Al instalar el modulo, se agrega mods-available/shib2.load, donde se carga el modulo. |
|
| 152 | 1 | ||
| 153 | 1 | Luego se debe crear el archivo conf-enabled/shib.conf con las directivas apropiadas: |
|
| 154 | 1 | ||
| 155 | 1 | <pre> <code class="xml"> |
|
| 156 | 1 | ||
| 157 | 1 | # Ensures handler will be accessible. |
|
| 158 | 1 | # |
|
| 159 | 1 | <Location /Shibboleth.sso> |
|
| 160 | 1 | Satisfy Any |
|
| 161 | 1 | Allow from all |
|
| 162 | 1 | </Location> |
|
| 163 | 1 | ||
| 164 | 1 | # |
|
| 165 | 1 | # Used for example style sheet in error templates. |
|
| 166 | 1 | # |
|
| 167 | 1 | <IfModule mod_alias.c> |
|
| 168 | 1 | <Location /shibboleth-sp> |
|
| 169 | 1 | Satisfy Any |
|
| 170 | 1 | Allow from all |
|
| 171 | 1 | </Location> |
|
| 172 | 1 | Alias /shibboleth-sp/main.css /usr/share/shibboleth/main.css |
|
| 173 | 1 | </IfModule> |
|
| 174 | 1 | ||
| 175 | 1 | </code> </pre> |
|
| 176 | 1 | ||
| 177 | 1 | Para agregar un recurso (Location) protegido, agregar en shib.conf o en el virtual host: |
|
| 178 | 1 | ||
| 179 | 1 | <pre> <code class="xml"> |
|
| 180 | 1 | ||
| 181 | 1 | # You MUST enable AuthType shibboleth for the module to process |
|
| 182 | 1 | # any requests, and there MUST be a require command as well. |
|
| 183 | 1 | ||
| 184 | 1 | <Location /secure> |
|
| 185 | 1 | AuthType shibboleth |
|
| 186 | 1 | ShibRequestSetting requireSession 1 |
|
| 187 | 1 | require shib-session |
|
| 188 | 1 | </Location> |
|
| 189 | 1 | </code> </pre> |
|
| 190 | 1 | ||
| 191 | 1 | ||
| 192 | 1 | Ejemplos de reglas para control de acceso: |
|
| 193 | 1 | https://www.switch.ch/aai/guides/sp/access-rules/ |
|
| 194 | 1 | ||
| 195 | 1 | Por ultimo se debe habilitar la configuracion con el siguiente comando: |
|
| 196 | 1 | ||
| 197 | 1 | <pre> |
|
| 198 | 1 | a2enconf shib |
|
| 199 | 1 | </pre> |