[ English | English (United Kingdom) | 中文 (简体, 中国) | Indonesia | русский | français | नेपाली | Deutsch | Esperanto | português (Brasil) | español | 한국어 (대한민국) ]
Personnaliser et configurer le Dashboard¶
Lorsque le Dashboard est installé, vous pouvez personnaliser son apparence afin qu’il réponde aux besoins de votre environnement, de votre projet ou de votre entreprise.
Vous pouvez aussi configurer le Dashboard pour utiliser un déploiement HTTPS sécurisé ou un déploiement HTTP. L’installation OpenStack standard utilise un channel HTTP non chiffré, mais vous pouvez activer le support SSL pour le Dashboard.
Pour plus d’informations sur comment configurer HTTP ou HTTPS, voir Configurer le Dashboard.
Personnaliser le Dashboard¶
Le Dashboard OpenStack sur Ubuntu installe par défaut le paquet openstack-dashboard-ubuntu-theme
. Si vous ne voulez pas utiliser ce thème, effacez-le ainsi que ses dépendances:
# apt-get remove --auto-remove openstack-dashboard-ubuntu-theme
Note
Ce guide se concentre sur le fichier local_settings.py
.
Sur le Dashbord, le contenu suivant peut être personnalisé selon vos besoins:
Logo
Couleurs du site
Titre HTML
Lien du logo
URL d’aide
Logo et couleurs du site¶
Créer deux logos au format PNG avec fond transparent en utilisant les tailles suivantes:
Ecran de connexion : 365 x 50
Bannière de connexion : 216 x 35
Chargez vos nouvelles images dans
/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/img/
.Créez une feuille de style CSS dans
/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/scss/
.Changez les couleurs et les noms de fichiers comme désiré. Assurez-vous que les chemins relatifs vers les dossiers soient les mêmes. L’exemple suivant montre comment vous pouvez personnaliser votre fichier CSS:
/* * New theme colors for dashboard that override the defaults: * dark blue: #355796 / rgb(53, 87, 150) * light blue: #BAD3E1 / rgb(186, 211, 225) * * By Preston Lee <[email protected]> */ h1.brand { background: #355796 repeat-x top left; border-bottom: 2px solid #BAD3E1; } h1.brand a { background: url(../img/my_cloud_logo_small.png) top left no-repeat; } #splash .login { background: #355796 url(../img/my_cloud_logo_medium.png) no-repeat center 35px; } #splash .login .modal-header { border-top: 1px solid #BAD3E1; } .btn-primary { background-image: none !important; background-color: #355796 !important; border: none !important; box-shadow: none; } .btn-primary:hover, .btn-primary:active { border: none; box-shadow: none; background-color: #BAD3E1 !important; text-decoration: none; }
Ouvrez le modèle HTML suivant dans un éditeur de votre choix:
/usr/share/openstack-dashboard/openstack_dashboard/templates/_stylesheets.html
Ajoutez une ligne pour inclure la feuille de style que vous venez de créer. Par exemple le fichier
custom.css
:<link href='{{ STATIC_URL }}bootstrap/css/bootstrap.min.css' media='screen' rel='stylesheet' /> <link href='{{ STATIC_URL }}dashboard/css/{% choose_css %}' media='screen' rel='stylesheet' /> <link href='{{ STATIC_URL }}dashboard/css/custom.css' media='screen' rel='stylesheet' />
Redémarrez le service Apache.
Pour voir les changements, rechargez le Dashboard. Si nécessaire, revenir et modifier le fichier CSS de manière appropriée.
Titre HTML¶
Configurez le titre HTML qui apparaît en haut de votre fenêtre de navigateur en ajoutant la ligne suivante à
local_settings.py
:SITE_BRANDING = "Example, Inc. Cloud"
Redémarrez Apache pour que le changement soit effectif.
Lien du logo¶
Le logo se comporte aussi comme un hyperlien. Le comportement par défaut est une redirection vers
horizon:user_home
. Pour changer ce comportement, ajouter l’attribut suivant àlocal_settings.py
:SITE_BRANDING_LINK = "http://example.com"
Redémarrez Apache pour que le changement soit effectif.
URL d’aide¶
Par défaut l’URL d’aide pointe vers https://docs.openstack.org. Pour changer ceci, éditez l’attribut suivant dans
local_settings.py
:HORIZON_CONFIG["help_url"] = "http://openstack.mycompany.org"
Redémarrez Apache pour que le changement soit effectif.
Configurer le Dashboard¶
La section suivante, portant sur la configuration du Dashboard en utilisant un déploiement sécurisé par HTTPS ou un déploiement HTTP, utilise des exemples concrets pour s’assurer que la procédure est claire. Le chemin du fichier varie selon les distributions. Si besoin vous pouvez aussi configurer la taille de la fenêtre VNC dans le Dashboard.
Configurer le Dashboard pour HTTP¶
Vous pouvez configurer le tableau de bord pour un déploiement HTTP simple. L’installation standard utilise un canal HTTP non chiffré.
Précisez l’hôte pour le endpoint de votre service d’Identité dans le fichier
local_settings.py
avec le paramètreOPENSTACK_HOST
.L’exemple suivant montre cette configuration:
import os from django.utils.translation import gettext_lazy as _ DEBUG = False TEMPLATE_DEBUG = DEBUG PROD = True SITE_BRANDING = 'OpenStack Dashboard' # Ubuntu-specific: Enables an extra panel in the 'Settings' section # that easily generates a Juju environments.yaml for download, # preconfigured with endpoints and credentials required for bootstrap # and service deployment. ENABLE_JUJU_PANEL = True # Note: You should change this value SECRET_KEY = 'elj1IWiLoWHgryYxFT6j7cM5fGOOxWY0' # Specify a regular expression to validate user passwords. # HORIZON_CONFIG = { # "password_validator": { # "regex": '.*', # "help_text": _("Your password does not meet the requirements.") # } # } LOCAL_PATH = os.path.dirname(os.path.abspath(__file__)) CACHES = { 'default': { 'BACKEND' : 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION' : '127.0.0.1:11211' } } # Send email to the console by default EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' # Or send them to /dev/null #EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend' # Configure these for your outgoing email host # EMAIL_HOST = 'smtp.my-company.com' # EMAIL_PORT = 25 # EMAIL_HOST_USER = 'djangomail' # EMAIL_HOST_PASSWORD = 'top-secret!' # For multiple regions uncomment this configuration, and add (endpoint, title). # AVAILABLE_REGIONS = [ # ('http://cluster1.example.com/identity/v3', 'cluster1'), # ('http://cluster2.example.com/identity/v3', 'cluster2'), # ] OPENSTACK_HOST = "127.0.0.1" OPENSTACK_KEYSTONE_URL = "http://%s/identity/v3" % OPENSTACK_HOST OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member" # The OPENSTACK_KEYSTONE_BACKEND settings can be used to identify the # capabilities of the auth backend for Keystone. # If Keystone has been configured to use LDAP as the auth backend then set # can_edit_user to False and name to 'ldap'. # # TODO(tres): Remove these once Keystone has an API to identify auth backend. OPENSTACK_KEYSTONE_BACKEND = { 'name': 'native', 'can_edit_user': True } # OPENSTACK_ENDPOINT_TYPE specifies the endpoint type to use for the endpoints # in the Keystone service catalog. Use this setting when Horizon is running # external to the OpenStack environment. The default is 'internalURL'. #OPENSTACK_ENDPOINT_TYPE = "publicURL" # The number of Swift containers and objects to display on a single page before # providing a paging element (a "more" link) to paginate results. API_RESULT_LIMIT = 1000 # If you have external monitoring links, eg: # EXTERNAL_MONITORING = [ # ['Nagios','http://foo.com'], # ['Ganglia','http://bar.com'], # ] LOGGING = { 'version': 1, # When set to True this will disable all logging except # for loggers specified in this configuration dictionary. Note that # if nothing is specified here and disable_existing_loggers is True, # django.db.backends will still log unless it is disabled explicitly. 'disable_existing_loggers': False, 'handlers': { 'null': { 'level': 'DEBUG', 'class': 'logging.NullHandler', }, 'console': { # Set the level to "DEBUG" for verbose output logging. 'level': 'INFO', 'class': 'logging.StreamHandler', }, }, 'loggers': { # Logging from django.db.backends is VERY verbose, send to null # by default. 'django.db.backends': { 'handlers': ['null'], 'propagate': False, }, 'horizon': { 'handlers': ['console'], 'propagate': False, }, 'novaclient': { 'handlers': ['console'], 'propagate': False, }, 'keystoneclient': { 'handlers': ['console'], 'propagate': False, } } }
La configuration du catalogue de services dans le service d’Identité détermine si un service va apparaître dans le Dashboard. Pour une liste exhaustive voir Settings Reference.
Redémarrer le serveur Apache HTTP.
Redémarrer
memcached
.
Configurer le Dashboard pour HTTPS¶
Vous pouvez aussi configurer le Dashboard pour utiliser un déploiement HTTPS sécurisé ou un déploiement HTTP. L’installation OpenStack standard utilise un channel HTTP non chiffré, mais vous pouvez activer le support SSL pour le Dashboard.
Cet exemple utilise le domaine http://openstack.example.com
. Utiliser un domaine qui correspond à votre configuration.
Dans le fichier
local_settings.py
, mettez à jour les options suivantes:CSRF_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True SESSION_COOKIE_HTTPONLY = True
Les autres options demandent que HTTPS soit activé; ces options protègent contre le scripting cross-site.
Editer le fichier
openstack-dashboard.conf
comme montré dans Exemple Après:Exemple Avant
WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi.py WSGIDaemonProcess horizon user=www-data group=www-data processes=3 threads=10 Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static/ <Location /> <ifVersion >=2.4> Require all granted </ifVersion> <ifVersion <2.4> Order allow,deny Allow from all </ifVersion> </Location>
Exemple Après
<VirtualHost *:80> ServerName openstack.example.com <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} </IfModule> <IfModule !mod_rewrite.c> RedirectPermanent / https://openstack.example.com </IfModule> </VirtualHost> <VirtualHost *:443> ServerName openstack.example.com SSLEngine On # Remember to replace certificates and keys with valid paths in your environment SSLCertificateFile /etc/apache2/SSL/openstack.example.com.crt SSLCACertificateFile /etc/apache2/SSL/openstack.example.com.crt SSLCertificateKeyFile /etc/apache2/SSL/openstack.example.com.key SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown # HTTP Strict Transport Security (HSTS) enforces that all communications # with a server go over SSL. This mitigates the threat from attacks such # as SSL-Strip which replaces links on the wire, stripping away https prefixes # and potentially allowing an attacker to view confidential information on the # wire Header add Strict-Transport-Security "max-age=15768000" WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi.py WSGIDaemonProcess horizon user=www-data group=www-data processes=3 threads=10 Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static/ <Location /> Options None AllowOverride None # For Apache http server 2.4 and later: <ifVersion >=2.4> Require all granted </ifVersion> # For Apache http server 2.2 and earlier: <ifVersion <2.4> Order allow,deny Allow from all </ifVersion> </Location> </VirtualHost>
Dans cette configuration, le serveur Apache HTTP écoute sur le port 443 et redirige toutes les requêtes non sûres vers le protocoles HTTPS. La section sécurisé définit la clef privée, la clef publique et le certificat à utiliser.
Redémarrer le serveur Apache HTTP.
Redémarrer
memcached
.Si vous chercher à accéder au Dashboard par HTTP, le navigateur vous redirige vers la page HTTPS.
Note
Pour configurer le Dashboard pour HTTPS il faut autoriser SSL et le service de proxy noVNC. Sur le nœud contrôleur, ajouter les options additionnelles suivantes à la section
[DEFAULT]
du fichier/etc/nova/nova.conf
:[DEFAULT] # ... ssl_only = true cert = /etc/apache2/SSL/openstack.example.com.crt key = /etc/apache2/SSL/openstack.example.com.key
Sur les nœuds de compute, assurez-vous que l’option ``nonvncproxy_base_url``pointe vers une URL avce un schéma HTTPS:
[DEFAULT] # ... novncproxy_base_url = https://controller:6080/vnc_auto.html