...
| Bloc de code | ||||
|---|---|---|---|---|
| ||||
systemctl stop tomcat10.service systemctl disable tomcat10.service |
Le paquet tomcat10 a ajouté au passage un utilisateur tomcat qui lancera nos instances de manière sécurisée avec des provilèges limitées.
Pour que les commandes bash lancées par esup-sgc fonctionne (commande chromium notamment) il faut que l'utilisateur tomcat est son home directory d'opérationnel : créez le et affectez le à l'utilisateur tomcaet si nécessaire.
| Bloc de code | ||
|---|---|---|
| ||
echo ~tomcat
-> /var/lib/tomcat
mkdir /var/lib/tomcat
chown tomcat /var/lib/tomcat |
On créé ensuite En tant qu'utilisateur esup précédemment créé, on créé les 2 instances des tomcat ainsi :
...
| Bloc de code | ||||
|---|---|---|---|---|
| ||||
cp /usr/lib/systemd/system/tomcat10.service /etc/systemd/system/tomcat-esup-sgc.service cp /usr/lib/systemd/system/tomcat10.service /etc/systemd/system/tomcat-esup-nfc-tag.service |
Pour Esup-SGC (TODO : à revoir) :
| Bloc de code | ||||
|---|---|---|---|---|
| ||||
cat > /etc/systemd/system/tomcat-esup-sgc.service <<EOF # # Systemd unit file for Apache Tomcat # [Unit] Description=Apache Tomcat ESUP-SGC Server Documentation=https://tomcat.apache.org/tomcat-10.0-doc/index.html After=network.target RequiresMountsFor=/var/log/tomcat10 /var/lib/tomcat10 /opt/tomcat-esup-sgc [Service] # Configuration Environment="CATALINA_HOME=/usr/share/tomcat10" Environment="CATALINA_BASE=/opt/tomcat-esup-sgc" Environment="CATALINA_TMPDIR=/opt/tomcat-esup-sgc/temp" Environment="JAVA_OPTS=-Djava.awt.headless=true" # Lifecycle Type=simple ExecStart=/bin/sh /usr/libexec/tomcat10/tomcat-start.sh SuccessExitStatus=143 Restart=on-abort # Logging SyslogIdentifier=tomcat-esup-sgc # Security User=tomcat Group=tomcat PrivateTmp=yes AmbientCapabilities=CAP_NET_BIND_SERVICE NoNewPrivileges=true CacheDirectory=tomcat-esup-sgc CacheDirectoryMode=750 ProtectSystem=strict ReadWritePaths=/opt/tomcat-esup-sgc/conf/ ReadWritePaths=/opt/tomcat-esup-sgc/work/ ReadWritePaths=/opt/tomcat-esup-sgc/webapps/ ReadWritePaths=/opt/tomcat-esup-sgc/logs/ ReadWritePaths=/opt/tomcat-esup-sgc/temp/ [Install] WantedBy=multi-user.target |
...
| Bloc de code | ||||
|---|---|---|---|---|
| ||||
cat > /etc/systemd/system/tomcat-esup-nfc-tag.service <<EOF
#
# Systemd unit file for Apache Tomcat
#
[Unit]
Description=Apache Tomcat Esu Nfc Tag Server
Documentation=https://tomcat.apache.org/tomcat-10.0-doc/index.html
After=network.target
RequiresMountsFor=/var/log/tomcat10 /var/lib/tomcat10 /opt/tomcat-esup-nfc-tag
[Service]
# Configuration
Environment="CATALINA_HOME=/usr/share/tomcat10"
Environment="CATALINA_BASE=/opt/tomcat-esup-nfc-tag"
Environment="CATALINA_TMPDIR=/opt/tomcat-esup-nfc-tag/temp"
Environment="JAVA_OPTS=-Djava.awt.headless=true"
# Lifecycle
Type=simple
ExecStart=/bin/sh /usr/libexec/tomcat10/tomcat-start.sh
SuccessExitStatus=143
Restart=on-abort
# Logging
SyslogIdentifier=tomcat-esup-nfc-tag
# Security
User=tomcat
Group=tomcat
PrivateTmp=yes
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
CacheDirectory=tomcat-esup-nfc-tag
CacheDirectoryMode=750
ProtectSystem=strict
ReadWritePaths=/opt/tomcat-esup-nfc-tag/conf/
ReadWritePaths=/opt/tomcat-esup-nfc-tag/work/
ReadWritePaths=/opt/tomcat-esup-nfc-tag/webapps/
ReadWritePaths=/opt/tomcat-esup-nfc-tag/logs/
ReadWritePaths=/opt/tomcat-esup-nfc-tag/temp/
[Install]
WantedBy=multi-user.target |
...
| Bloc de code | ||||
|---|---|---|---|---|
| ||||
<!--
<MetadataProvider type="XML" validate="true"
url="https://idp.univ-ville.fr/idp/shibboleth"
backingFilePath="idp.univ-ville.fr-metadata.xml">
</MetadataProvider>
-->
<MetadataProvider type="XML" url="https://metadata.federation.renater.fr/renater/main/main-idps-renater-metadata.xml" backingFilePath="/etc/shibboleth/metadatas/main-idps-renater-metadata.xml" reloadInterval="7200">
<MetadataFilter type="RequireValidUntil" maxValidityInterval="2419200"/>
<MetadataFilter type="Signature" certificate="renater-metadata-signing-cert-2016.pem"/>
<MetadataFilter type="Whitelist"> type="Whitelist">
<Include>urn:mace:cru.fr:federation:univ-rouen.fr</Include>
<Include>urn:mace:cru.fr:federation:univ-rouen.fr</Include>
<Include>https://shibboleth.insa-rouen.fr/idp/shibboleth</Include>
</MetadataFilter>
</MetadataProvider>
|
Et enfin, avant la fermeture de la balise ApplicationDefaults, rajoutez un ApplicationOverride. Dans notre cas, le VirtualHost esup-sgc.univ-ville.fr utilisera le default, on utilisera un id spécifique pour esup-nfc-tag:
| Bloc de code | ||||
|---|---|---|---|---|
| ||||
<ApplicationOverride <Include>https://shibboleth.insa-rouen.fr/idp/shibboleth</Include> </MetadataFilter> </MetadataProvider> id="esup-nfc-tag" entityID="https://esup-nfc-tag.univ-ville.fr/shibboleth"/> |
Les Metadata doivent à présent être téléchargeables à ces adresses:
https://Et enfin, avant la fermeture de la balise ApplicationDefaults, rajoutez un ApplicationOverride. Dans notre cas, le VirtualHost esup-sgc.univ-ville.fr utilisera le default, on utilisera un id spécifique pour /Shibboleth.sso/Metadata
https://esup-nfc-tag:
...
| language | xml |
|---|---|
| theme | RDark |
...
.univ-ville.fr/Shibboleth.sso/Metadata
Il reste donc à les intégrer à l'IDP, soit directement, soit en passant par la fédération d'identité.
Logs
Suivant votre installation et paramétrage, vous retrouvez les logs dans /opt/tomcat-esup-sgc/logs/ et /opt/tomcat-esup-nfc-tag
...
/logs/
En installant les tomcat comme décrits ici, et les lançant avec systemd, vous pourrez également consulter ces logs via journalct :
| Bloc de code | ||
|---|---|---|
| ||
journalctl -xeu tomcat-esup-sgc.service --follow |
Les Metadata doivent à présent être téléchargeables à ces adresses:
https://esup-sgc.univ-ville.fr/Shibboleth.sso/Metadata
https://esup-nfc-tag.univ-ville.fr/Shibboleth.sso/Metadata
...
Rotation des logs
Il est possible de mettre en place une rotation journalière des logs. La plupart des distributions fournissent logrotate. Il est donc possible de créer un fichier de config /etc/logrotate.d/esup-sgc avec, par exemple, le contenu suivant:
| Bloc de code | ||
|---|---|---|
| ||
/opt/tomcat-esup-sgc/logs/*log /opt/tomcat-esup-sgc/logs/catalina.out { copytruncate daily missingok rotate 30 compress delaycompress } /opt/tomcat-esup-nfc-tag/logs/*log /opt/tomcat-esup-nfc-tag/logs/catalina.out { copytruncate daily missingok rotate 30 compress delaycompress } |
...