Bienvenue sur la documentation de PaSSHport!

Votre admin sys quitte votre société. Êtes-vous sûrs que tous ses accès ssh sont révoqués ? Et les stagiaires ? Les prestataires ?... Réglons ça.

Table des matières :

Introduction à PaSSHport

Qu'est-ce que PaSSHport ?

PaSSHport est un logiciel qui vous permet de contrôler les accès SSH des briques de votre IT : serveurs Linux/Unix, switchs réseaux, routeurs, points d'accès Wi-Fi, ainsi que n'importe quelle brique accessible via SSH. En quelques mots : qui a accès à quoi ?

PaSSHport a été écrit avec les objectifs suivants :

  • Même principes que SSHgate
  • Deux types d'objets : targets et users (Nous verrons ça un peu plus bas)
  • Les objets peuvent être groupés
  • Enregistrer toutes les sessions des utilisateurs
  • Être entièrement configurable et utilisable depuis la ligne de commandes
  • Possibilité de faire des copies sécurisées (scp)
  • Des communications entre les composants basées sur une API REST, pour une intégration plus aisée dans un IT automatisé
  • Utiliser des technologies OpenSource

Pour comprendre les composants principaux, et comment ils interagissent entre eux, veuillez lire ce qui suit.

Composants

PaSSHport est composé de 3 programmes :

  • passhportd : le démon qui enregistre, et vérifie la configuration
  • passhport : le script qui reçoit les connexions (il ne remplace PAS un serveur SSH). Il faut le voir comme le shell sur lequel les utilisateurs arrivent quand ils se connectent à PaSSHport.
  • passhport-admin : le script qui permet de configurer passhportd. Les adminSys l'utilisent pour, par exemple, ajouter un user, une target, un usergroup, un targetgroup, et combiner ces derniers pour configurer les accès
_images/Composants_PaSSHport_EN.png

Et maintenant, passons à l'installation…

Installation and configuration

Ce chapitre décrit l'installation de PaSSHport sur différentes distributions Linux, et certains principes de configuration de base.

Installation on Debian 8, 9 or 10

The followings shows you how to install and run PaSSHport on Debian 8 (Jessie), 9 (Stretch) or 10 (Buster). We start from a minimal installation of Debian (available here), with openssh-server and curl packages installed.

La manière simple, et automatisée

You can review the installation script here.

Vous pouvez le lancer directement depuis la ligne de commande (assurez-vous une fois de plus que curl est bien installé : apt install curl ):

root@debian:~# bash <(curl -s https://raw.githubusercontent.com/librit/passhport/master/tools/passhport-install-script-debian.sh)

Une fois l'installation terminée, rendez-vous au chapitre Première configuration.

La manière longue, manuelle

Si vous voulez comprendre ce qui se passe sur votre système, quand vous installez PaSSHport, suivez les instruction suivantes, qui sont (grossièrement) les commandes, une à une, du script d'installation automatisé sus-mentionné.

Tout d'abord, on update les dépots :

root@debian:~# apt update

On installe python3-pip, et d'autre packages dont nous aurons besoin plus tard pour ce tuto (il y a environ 100Mo à récupérer sur les dépôts, donc soyer patient) :

root@debian:~# apt install python3-pip git openssl virtualenv libpython3-dev

Ensuite, nous aurons besoin d'ajouter un utilisateur appelé « passhport », et exécuter quelques commande en tant que lui :

root@debian:~# useradd --home-dir /home/passhport --shell /bin/bash --create-home passhport
root@debian:~# su - passhport
passhport@debian:~$

On récupère les sources de PaSSHport sur github :

passhport@debian:~$ git clone http://github.com/LibrIT/passhport.git
Clonage dans 'passhport'...
remote: Counting objects: 2713, done.
remote: Compressing objects: 100% (50/50), done.
remote: Total 2713 (delta 19), reused 0 (delta 0), pack-reused 2661
Réception d'objets: 100% (2713/2713), 482.76 KiB | 396.00 KiB/s, fait.
Résolution des deltas: 100% (1633/1633), fait.
passhport@debian:~$

On crée un environnement «virtuel-env» pour cette utilisateur passhport :

passhport@debian:~$ virtualenv -p python3 passhport-run-env

Maintenant que nous avons notre «virtual-env», on installe les modules python nécessaires au fonctionnement de PaSSHport :

passhport@debian:~$ /home/passhport/passhport-run-env/bin/pip install -r /home/passhport/passhport/requirements.txt

Commençons les choses sérieuses…

PaSSHport a besoin d'écrire des logs, il faut donc créer un répertoire dans «/var/log», et en attribuer la propriété à l'utilisateur «passhport» :

root@debian:~# mkdir -p /var/log/passhport/
root@debian:~# chown passhport:passhport /var/log/passhport/

On crée aussi le répertoire qui contiendra la configuration, et on copie les différents fichiers de configuration dedans :

root@debian:~# mkdir /etc/passhport
root@debian:~# cp /home/passhport/passhport/passhport/passhport.ini /etc/passhport/.
root@debian:~# cp /home/passhport/passhport/passhport-admin/passhport-admin.ini /etc/passhport/.
root@debian:~# cp /home/passhport/passhport/passhportd/passhportd.ini /etc/passhport/.

Nous devons faire quelques modifications dans ces fichiers de configurations, surtout si on souhaite séparer les composants sur différentes machines. On remplace ici l'adresse d'écoute par défaut (localhost), avec la vrai IP du serveur.

D'abord passhportd :

root@debian:~# vim /etc/passhport/passhportd.ini

On change la directive « LISTENING_IP », par l'adresse IP du serveur :

# Passhportd configuration file. You should copy it to
# /etc/passhport/passhportd.ini if you want to do modifications
[SSL]
SSL = True
SSL_CERTIFICAT = /home/passhport/certs/cert.pem
SSL_KEY = /home/passhport/certs/key.pem

[Network]
LISTENING_IP = 192.168.122.56
PORT = 5000

[Database]
SQLALCHEMY_TRACK_MODIFICATIONS = True
SQLALCHEMY_DATABASE_DIR = /var/lib/passhport/
SQLALCHEMY_MIGRATE_REPO = /var/lib/passhport/db_repository
# For SQLite
SQLALCHEMY_DATABASE_URI = sqlite:////var/lib/passhport/app.db

[Environment]
# SSH Keyfile path
SSH_KEY_FILE = /home/passhport/.ssh/authorized_keys
# Python and passhport paths
PASSHPORT_PATH = /home/passhport/passhport/passhport/passhport
PYTHON_PATH = /home/passhport/passhport-run-env/bin/python3

On change le paramètre suivante dans /etc/passhport/passhport.ini et /etc/passhport/passhport-admin.ini :

PASSHPORTD_HOSTNAME = 192.168.122.56

We’ll need ssh publickey, so we generate a 4096 bits RSA key (keys lengh can be longer):

root@debian:~# su - passhport
passhport@debian:~$ ssh-keygen -t rsa -b 4096 -N "" -f "/home/passhport/.ssh/id_rsa"
Generating public/private rsa key pair.
Your identification has been saved in /home/passhport/.ssh/id_rsa.
Your public key has been saved in /home/passhport/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:0o6jkepqr2Phz0AKmLGRZh6PeVexP2gf5CGNPd+ksQ passhport@debian
The key's randomart image is:
+---[RSA 4096]----+
| .    ....       |
|oo . o .+ +      |
|* + o ...= *     |
|.O   o oo + E    |
|=.    LibrIT .   |
|+.   .Rocks = .  |
|o.. o o .  . o   |
| =o. o .         |
|++B+.            |
+----[SHA256]-----+
passhport@debian:~$

Cette clé sera utilisé par passhport pour se connecter aux différents serveurs. On peut aussi générer une clef ECDSA si on veut :

passhport@debian:~$ ssh-keygen -t ecdsa -b 521 -N "" -f "/home/passhport/.ssh/id_ecdsa"

Une fois encore en tant que root, on crée le répertoire qui contiendra la base de données (parce qu'on utilise SQLite pour ce tuto) :

root@debian:~# mkdir -p /var/lib/passhport
root@debian:~# chown -R passhport:passhport /var/lib/passhport/

… on a alors 3 paramètres à changer dans le fichier de conf de passhportd (en tant que root, on édite «/etc/passhport/passhportd.ini») :

SQLALCHEMY_DATABASE_DIR        = /var/lib/passhport/
SQLALCHEMY_MIGRATE_REPO        = /var/lib/passhport/db_repository
SQLALCHEMY_DATABASE_URI        = sqlite:////var/lib/passhport/app.db

On peut maintenant créer la base de données, et vérifier que celle-ci a été correctement créé :

root@debian:~# su - passhport
passhport@debian:~$ /home/passhport/passhport-run-env/bin/python /home/passhport/passhport/passhportd/db_create.py
passhport@debian:~$ ls -la /var/lib/passhport/
total 172
drwxr-xr-x  3 passhport passhport   4096 févr. 28 16:10 .
drwxr-xr-x 25 root      root        4096 févr. 28 15:37 ..
-rw-r--r--  1 passhport passhport 159744 févr. 28 16:10 app.db
drwxr-xr-x  4 passhport passhport   4096 févr. 28 16:10 db_repository
passhport@debian:~$

On va maintenant créer un certificat pour sécuriser les échanges avec l'API. D'abord, on crée le répertoire dans lequel se trouveront la clé privée et le certificat. Il faut aussi attribué les droits rwx à l'utilisateur «passhport» seulement :

passhport@debian:~$ mkdir /home/passhport/certs
passhport@debian:~$ chmod 700 /home/passhport/certs

On crée la clé RSA :

[passhport@centos-7 ~]$ openssl genrsa -out "/home/passhport/certs/key.pem" 4096

Il y a un fichier de configuration pour OpenSSL fourni avec les sources de PaSSHport, pour générer un certificat minimal SSL correcte. Le fichier est :

/home/passhport/passhport/tools/openssl-for-passhportd.cnf

On l'édite, et on ajoute de nom DNS dont on se servira pour joindre l'API. Pour ce tuto, on utilisera deux noms d'hôtes :

[req]
distinguished_name      = req_distinguished_name
req_extensions          = v3_req
subjectKeyIdentifier    = hash
authorityKeyIdentifier  = keyid:always,issuer

[v3_req]
subjectAltName          = @alternate_names
basicConstraints        = CA:TRUE
subjectKeyIdentifier    = hash
authorityKeyIdentifier  = keyid:always,issuer

[req_distinguished_name]

[ alternate_names ]
DNS.1 = 127.0.0.1
DNS.2 = localhost
DNS.3 = passhport.librit.fr
DNS.4 = entry.passhport.org

On génère le certificat avec la commande suivante (on peut faire un copié/collé des lignes suivantes). Par contre, il faut bien entendu adapter la ligne du sujet (-subj) à votre installation :

openssl req -new -key "/home/passhport/certs/key.pem" \
-config "/home/passhport/passhport/tools/openssl-for-passhportd.cnf" \
-out "/home/passhport/certs/cert.pem" \
-subj "/C=FR/ST=Ile De France/L=Ivry sur Seine/O=LibrIT/OU=DSI/CN=passhport.librit.fr" \
-x509 -days 365 -sha256 \
-extensions v3_req

Une fois exécuté, vous aurez un certificat à côté d'une clé :

passhport@debian:~$ ls -la /home/passhport/certs/
total 16
drwx------ 2 passhport passhport 4096 févr. 28 18:00 .
drwxr-xr-x 8 passhport passhport 4096 févr. 28 17:46 ..
-rw-r--r-- 1 passhport passhport 2171 févr. 28 18:00 cert.pem
-rw------- 1 passhport passhport 3243 févr. 28 16:11 key.pem
passhport@debian:~$

En tant que root, on crée deux liens symboliques vers les deux principaux, passhportd et passhport-admin, pour ne plus avoir à besoin

root@debian:~# ln -s /home/passhport/passhport/tools/passhportd.sh /usr/bin/passhportd
root@debian:~# ln -s /home/passhport/passhport/tools/passhport-admin.sh /usr/bin/passhport-admin

On peut créer un service systemd, et activer passhportd au démarrage :

root@debian:~# cp /home/passhport/passhport/tools/passhportd.service /etc/systemd/system/passhportd.service
root@debian:~# systemctl daemon-reload
root@debian:~# systemctl enable passhportd

Il n'y a plus qu'à démarrer le démon passhportd :

root@debian:~# systemctl start passhportd

On peut maintenant vérifier que passhportd tourne correctement, en "curlant" l'IP qu'on a précédemment configurée dans /etc/passhport/passhportd.ini, sur le port 5000 :

root@debian:~# curl -s --insecure https://192.168.122.56:5000
passhportd is running, gratz!
root@debian:~#

Well done ! Vous avez installé PaSSHport. Vous pouvez maintenant lire le chapitre Première utilisation.

Installation sur CentOS 7

Les paragraphes suivant expliquent comment installer et faire tourner PaSSHport sur CentOS 7. On part d'une installation de minimal de CentOS 7 (disponible ici).

La manière simple, et automatisée

Le script d'installation est disponible pour relecture ici.

Vous pouvez le lancer directement depuis la ligne de commande :

root@centos7:~# bash <(curl -s https://raw.githubusercontent.com/librit/passhport/master/tools/passhport-install-script-centos7.sh)

Une fois l'installation terminée, rendez-vous au chapitre Première configuration.

La manière longue, manuelle

Si vous voulez comprendre ce qui se passe sur votre système, quand vous installez PaSSHport, suivez les instruction suivantes, qui sont (grossièrement) les commandes, une à une, du script d'installation automatisé sus-mentionné.

On installe le dépot EPEL :

yum install epel-release

Install python34-pip and other packages that we’ll need later for this tutorial (it will get ~100MB from the archives, so be patient) :

root@centos7:~# yum install python34-pip git openssl python34-devel gcc

On mets à jour pip :

root@centos7:~# pip3 install -U pip

On installe virtual-env, en utilisant pip :

root@centos7:~# pip3 install virtualenv

Ensuite, nous aurons besoin d'ajouter un utilisateur appelé « passhport », et exécuter quelques commande en tant que lui :

root@centos7:~# useradd --home-dir /home/passhport --shell /bin/bash --create-home passhport
root@centos7:~# su - passhport
passhport@centos7:~$

On crée un environnement «virtuel-env» pour cette utilisateur passhport :

passhport@centos7:~$ virtualenv -p python3 passhport-run-env

Maintenant que nous avons notre «virtual-env», on installe les modules python nécessaires au fonctionnement de PaSSHport :

passhport@centos7:~$ /home/passhport/passhport-run-env/bin/pip install sqlalchemy-migrate flask-migrate requests docopt configparser tabulate flask-login ldap3 psutil cryptography

Commençons les choses sérieuses…

On récupère les sources de PaSSHport sur github :

passhport@centos7:~$ git clone http://github.com/LibrIT/passhport.git
Clonage dans 'passhport'...
remote: Counting objects: 2713, done.
remote: Compressing objects: 100% (50/50), done.
remote: Total 2713 (delta 19), reused 0 (delta 0), pack-reused 2661
Réception d'objets: 100% (2713/2713), 482.76 KiB | 396.00 KiB/s, fait.
Résolution des deltas: 100% (1633/1633), fait.
passhport@centos7:~$

PaSSHport a besoin d'écrire des logs, il faut donc créer un répertoire dans «/var/log», et en attribuer la propriété à l'utilisateur «passhport» :

root@centos7:~# mkdir -p /var/log/passhport/
root@centos7:~# chown passhport:passhport /var/log/passhport/

On crée aussi le répertoire qui contiendra la configuration, et on copie les différents fichiers de configuration dedans :

root@centos7:~# mkdir /etc/passhport
root@centos7:~# cp /home/passhport/passhport/passhport/passhport.ini /etc/passhport/.
root@centos7:~# cp /home/passhport/passhport/passhport-admin/passhport-admin.ini /etc/passhport/.
root@centos7:~# cp /home/passhport/passhport/passhportd/passhportd.ini /etc/passhport/.

Nous devons faire quelques modifications dans ces fichiers de configurations, surtout si on souhaite séparer les composants sur différentes machines. On remplace ici l'adresse d'écoute par défaut (localhost), avec la vrai IP du serveur.

D'abord passhportd :

root@centos7:~# vim /etc/passhport/passhportd.ini

On change la directive « LISTENING_IP », par l'adresse IP du serveur :

# Passhportd configuration file. You should copy it to
# /etc/passhport/passhportd.ini if you want to do modifications
[SSL]
SSL = True
SSL_CERTIFICAT = /home/passhport/certs/cert.pem
SSL_KEY = /home/passhport/certs/key.pem

[Network]
LISTENING_IP = 192.168.122.56
PORT = 5000

[Database]
SQLALCHEMY_TRACK_MODIFICATIONS = True
SQLALCHEMY_DATABASE_DIR = /var/lib/passhport/
SQLALCHEMY_MIGRATE_REPO = /var/lib/passhport/db_repository
# For SQLite
SQLALCHEMY_DATABASE_URI = sqlite:////var/lib/passhport/app.db

[Environment]
# SSH Keyfile path
SSH_KEY_FILE = /home/passhport/.ssh/authorized_keys
# Python and passhport paths
PASSHPORT_PATH = /home/passhport/passhport/passhport/passhport
PYTHON_PATH = /home/passhport/passhport-run-env/bin/python3

On change le paramètre suivante dans /etc/passhport/passhport.ini et /etc/passhport/passhport-admin.ini :

PASSHPORTD_HOSTNAME = 192.168.122.56

Nous aurons besoin d'une clef SSH. On en génère donc une RSA de 4096 bits :

root@centos7:~# su - passhport
passhport@centos7:~$ ssh-keygen -t rsa -b 4096 -N "" -f "/home/passhport/.ssh/id_rsa"
Generating public/private rsa key pair.
Your identification has been saved in /home/passhport/.ssh/id_rsa.
Your public key has been saved in /home/passhport/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:0o6jkepqr2Phz0AKmLGRZh6PeVexP2gf5CGNPd+ksQ passhport@centos7
The key's randomart image is:
+---[RSA 4096]----+
| .    ....       |
|oo . o .+ +      |
|* + o ...= *     |
|.O   o oo + E    |
|=.    LibrIT .   |
|+.   .Rocks = .  |
|o.. o o .  . o   |
| =o. o .         |
|++B+.            |
+----[SHA256]-----+
passhport@centos7:~$

Cette clé sera utilisé par passhport pour se connecter aux différents serveurs. On peut aussi générer une clef ECDSA si on veut :

passhport@centos7:~$ ssh-keygen -t ecdsa -b 521 -N "" -f "/home/passhport/.ssh/id_ecdsa"

Une fois encore en tant que root, on crée le répertoire qui contiendra la base de données (parce qu'on utilise SQLite pour ce tuto) :

root@centos7:~# mkdir -p /var/lib/passhport
root@centos7:~# chown -R passhport:passhport /var/lib/passhport/

… on a alors 3 paramètres à changer dans le fichier de conf de passhportd (en tant que root, on édite «/etc/passhport/passhportd.ini») :

SQLALCHEMY_DATABASE_DIR        = /var/lib/passhport/
SQLALCHEMY_MIGRATE_REPO        = /var/lib/passhport/db_repository
SQLALCHEMY_DATABASE_URI        = sqlite:////var/lib/passhport/app.db

On peut maintenant créer la base de données, et vérifier que celle-ci a été correctement créé :

root@centos7:~# su - passhport
passhport@centos7:~$ /home/passhport/passhport-run-env/bin/python /home/passhport/passhport/passhportd/db_create.py
passhport@centos7:~$ ls -la /var/lib/passhport/
total 172
drwxr-xr-x  3 passhport passhport   4096 févr. 28 16:10 .
drwxr-xr-x 25 root      root        4096 févr. 28 15:37 ..
-rw-r--r--  1 passhport passhport 159744 févr. 28 16:10 app.db
drwxr-xr-x  4 passhport passhport   4096 févr. 28 16:10 db_repository
passhport@centos7:~$

On va maintenant créer un certificat pour sécuriser les échanges avec l'API. D'abord, on crée le répertoire dans lequel se trouveront la clé privée et le certificat. Il faut aussi attribué les droits rwx à l'utilisateur «passhport» seulement :

passhport@centos7:~$ mkdir /home/passhport/certs
passhport@centos7:~$ chmod 700 /home/passhport/certs

On crée la clé RSA :

[passhport@centos-7 ~]$ openssl genrsa -out "/home/passhport/certs/key.pem" 4096

Il y a un fichier de configuration pour OpenSSL fourni avec les sources de PaSSHport, pour générer un certificat minimal SSL correcte. Le fichier est :

/home/passhport/passhport/tools/openssl-for-passhportd.cnf

On l'édite, et on ajoute de nom DNS dont on se servira pour joindre l'API. Pour ce tuto, on utilisera deux noms d'hôtes :

[req]
distinguished_name      = req_distinguished_name
req_extensions          = v3_req
subjectKeyIdentifier    = hash
authorityKeyIdentifier  = keyid:always,issuer

[v3_req]
subjectAltName          = @alternate_names
basicConstraints        = CA:TRUE
subjectKeyIdentifier    = hash
authorityKeyIdentifier  = keyid:always,issuer

[req_distinguished_name]

[ alternate_names ]
DNS.1 = localhost
DNS.2 = passhport.librit.fr
DNS.3 = entry.passhport.org

On génère le certificat avec la commande suivante (on peut faire un copié/collé des lignes suivantes). Par contre, il faut bien entendu adapter la ligne du sujet (-subj) à votre installation :

openssl req -new -key "/home/passhport/certs/key.pem" \
-config "/home/passhport/passhport/tools/openssl-for-passhportd.cnf" \
-out "/home/passhport/certs/cert.pem" \
-subj "/C=FR/ST=Ile De France/L=Ivry sur Seine/O=LibrIT/OU=DSI/CN=passhport.librit.fr" \
-x509 -days 365 -sha256 \
-extensions v3_req

Une fois exécuté, vous aurez un certificat à côté d'une clé :

passhport@centos7:~$ ls -la /home/passhport/certs/
total 16
drwx------ 2 passhport passhport 4096 févr. 28 18:00 .
drwxr-xr-x 8 passhport passhport 4096 févr. 28 17:46 ..
-rw-r--r-- 1 passhport passhport 2171 févr. 28 18:00 cert.pem
-rw------- 1 passhport passhport 3243 févr. 28 16:11 key.pem
passhport@centos7:~$

En tant que root, on crée deux liens symboliques vers les deux principaux, passhportd et passhport-admin, pour ne plus avoir à besoin

root@centos7:~# ln -s /home/passhport/passhport/tools/passhportd.sh /usr/bin/passhportd
root@centos7:~# ln -s /home/passhport/passhport/tools/passhport-admin.sh /usr/bin/passhport-admin

On peut créer un service systemd, et activer passhportd au démarrage :

root@centos7:~# cp /home/passhport/passhport/tools/passhportd.service /etc/systemd/system/passhportd.service
root@centos7:~# systemctl daemon-reload
root@centos7:~# systemctl enable passhportd

Il n'y a plus qu'à démarrer le démon passhportd :

root@centos7:~# systemctl start passhportd

On peut maintenant vérifier que passhportd tourne correctement, en "curlant" l'IP qu'on a précédemment configurée dans /etc/passhport/passhportd.ini, sur le port 5000 :

root@centos7:~# curl -s --insecure https://192.168.122.56:5000
passhportd is running, gratz!
root@centos7:~#

Well done ! Vous avez installé PaSSHport. Vous pouvez maintenant lire le chapitre Première utilisation.

Utiliser PostgreSQL comme base de données

Installer le module python psycopg2 et psycopg2-binary

Si vous n'avez pas utilisé la version paqueté de PaSSHport (dep/rpm), procédez comme suit. Si vous avez utilisé la version packageé, aller directement à la section Configuration de PostgreSQL.

Before installing python libs, be sure to have pg_config in your $PATH and some postgres libraries.

For Debian, install postgresql-common and postgresql-server

# apt install postgresql-common postgresql-server

For CentOS, install postgresql :

# yum install postgresql

Si vous voulez utilisez PostgreSQL comme base de données, vous devez installer le module python psycopg2 et psycopg2-binary.

En tant qu'utilisateur passhport, on installe psycopg2 et psycopg2-binary :

$ /home/passhport/passhport-run-env/bin/pip install psycopg2 psycopg2-binary
Configuration de PostgreSQL

On créé un utilisateur passhport dans PostgreSQL (la méthode peut varier selon votre distribution) :

# su - postgres
$ createuser -D -S -R passhport && createdb -O passhport "passhport"

On ajoute un mot de passe à cet utilisateur :

$ psql
psql (9.2.18)
Type "help" for help.

postgres=# ALTER USER "passhport" WITH PASSWORD 'MySUpErp45sw0rD';
ALTER ROLE
postgres=# \q
$
Configuration de passhportd

On modifie le fichier de configuration *passhportd.ini*(/etc/passhport/passhportd.ini). On change le paramètre SQLALCHEMY_DATABASE_URI :

SQLALCHEMY_DATABASE_URI        = postgresql://passhport:MySUpErp45sw0rD@localhost/passhport

En tant qu'utilisateur passhport (celui du system, pas celui de PostgreSQL), on initialise la base de données :

$ /home/passhport/passhport-run-env/bin/python /home/passhport/passhport/passhportd/db_create.py

On lance alors passhportd (arrêtez le process s'il tourne) :

$ /home/passhport/passhport-run-env/bin/python /home/passhport/passhport/passhportd/passhportd

PaSSHport utilise maintenant la base de données PostgreSQL.

Utiliser MySQL comme base de données

Installer le module python PyMySQL

Si vous n'avez pas utilisé la version paqueté de PaSSHport (dep/rpm), procédez comme suit. Si vous avez utilisé la version packagée, aller directement à la section Configuration de MySQL.

Si vous voulez utilisez MySQL comme base de données, vous devez installer le module python PyMySQL.

En tant qu'utilisateur passhport, on installe PyMySQL :

$ /home/passhport/passhport-run-env/bin/pip install PyMySQL
Configuration de MySQL

Créez une base de données passhport dans MySQL (la méthode peut varier selon votre distribution) :

# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE passhport;
Query OK, 1 row affected (0.00 sec)

Créez ensuite un utilisateur qui aura tous les droits sur la base de données passhport :

MariaDB [(none)]> GRANT ALL PRIVILEGES ON passhport.* TO passhport@localhost IDENTIFIED BY 'iwetoh3oochieshaRei4';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> Bye

#
Configuration de passhportd

On modifie le fichier de configuration *passhportd.ini*(/etc/passhport/passhportd.ini). On change le paramètre SQLALCHEMY_DATABASE_URI :

SQLALCHEMY_DATABASE_URI        = mysql+pymysql://passhport:iwetoh3oochieshaRei4@localhost/passhport

En tant qu'utilisateur passhport (celui du system, pas celui de MySQL), on initialise la base de données :

$ /home/passhport/passhport-run-env/bin/python /home/passhport/passhport/passhportd/db_create.py

On relance passhportd (en tant que root) :

# systemctl restart passhportd

PaSSHport utilise désormais MySQL.

Ajouter les capacités de complétion de bash pour passhport-admin

Vous trouverez dans les sources un fichier bash_completion, qui permet d'utiliser la touche [TAB] pour auto-compléter les arguments de la commande passhport-admin.

En tant que root, copiez le fichier fourni (/home/passhport/passhport/tools/passhport-admin.bash_completion) dans le répertoire /etc/bash_completion.d/, puis sourcez-le :

# cp /home/passhport/passhport/tools/passhport-admin.bash_completion /etc/bash_completion.d/passhport-admin
# . /etc/bash_completion.d/passhport-admin

Vous pouvez maintenant avoir ce genre d’interaction :

# passhport-admin [TAB][TAB]
target user targetgroup usergroup
# passhport-admin t[TAB]
# passhport-admin target[TAB]
target targetgroup
# passhport-admin targetg[TAB]
# passhport-admin targetgroup [TAB][TAB]
list search show create edit adduser rmuser
addtarget rmtarget addusergroup rmusergroup
addtargetgroup rmtargetgroup delete


# passhport-admin user show [TAB][TAB]
john rachel alfred bruce kim jared
# passhport-admin user show j[TAB]
john jared
# passhport-admin user show ja[TAB]
# passhport-admin user show jared

Fin.

Ajout d'un servur M

PaSSHport is based on Flask, the builtin web server can handle only one request at a time. It means that you can't really use it in production environnement...

In order to handle more requests, we duplicate the PaSSHport process for every connection. Apache provides such a solution with WSGI... And it's quite easy to activate it.

Installation

On Debian :

apt install apache2 libapache2-mod-wsgi-py3
Configuration

Create a new apache vhost file with this content:

Listen 5000
<VirtualHost *:5000>
    ServerName passhport

    SSLEngine               on
    SSLCertificateFile      /home/passhport/certs/cert.pem
    SSLCertificatekeyFile   /home/passhport/certs/key.pem

    WSGIDaemonProcess passhport user=passhport group=passhport threads=5
    WSGIScriptAlias / /home/passhport/passhport/tools/passhportd.wsgi
    <Directory /home/passhport/ >
        WSGIProcessGroup passhport
        WSGIApplicationGroup %{GLOBAL}
        # passhportd don't provides authentication, please filter by IP
        Require ip 127.0.0.1/8 ::1/128
    </Directory>
</VirtualHost>
Activate

First kill the current passhport process

pkill passhportd

Deactivate default website and activate this one:

a2dissite 000-default
a2enmod ssl
a2ensite passhport.conf

systemctl restart apache2

and Voilà.

Premiers pas

Vous avez donc maintenant une toute nouvelle installation de PaSSHport, mais vous ne savez pas quoi faire ensuite…

Exemple d'architecture

Pour ce tutoriel, nous utiliserons les informations suivantes :

_images/PaSSHport-getting_started_1_EN.png
  • 1 serveur PaSSHport

Nous utiliserons une installation monolithique de PaSSHport : passhportd, passhport et passhport-admin sont sur la même machine.

3 utilisateurs

  • John, un administrateur linux/unix, qui doit accéder à l'ensemble des serveurs linux/unix
  • Vincent, un administrateur réseau, qui a besoin d'accéder à tous les périphériques réseaux
  • Alice, une administratrice généraliste, qui a besoin d'accéder à tous les périphériques tiers
  • Yann, un consultant qui est ici pour une mission temporaire sur l'infrastructure de stockage, qui a besoin d'accéder au server NAS et à la bas SAN

1 administrateur PaSSHport

  • Marc, le RSSI, qui configure PaSSHport, et qui contrôle les droits d'accès

3 type de targets (serveur cible)

  • Serveurs Linux/Unix :
  • 1 serveur web, Linux, www-server / 10.0.1.24
  • 1 serveur VPN, OpenBSD, vpn-srv1 / 10.0.23.51
  • 1 serveur NAS, FreeBSD, nas-srv1 / 10.0.12.87
  • Périphérique réseau
  • 1 point d'accès WiFi, net-AP9-23 / 172.22.9.23
  • 1 routeur, net-RO10-98 / 172.16.10.98
  • 1 commutateur réseau (switch), net-SW22-57 / 172.20.22.57
  • Autre périphériques
  • 1 IPBX (serveur voix sur IP), ipbx1 / 10.192.98.76
  • 1 imprimante réseau, prntr44 / 192.168.254.44
  • 1 bay SAN, san1 / 10.192.1.10

Configurer les targets

Tout d'abord, nous allons enregistrer les targets dans PaSSHport

On se connecte au serveur PaSSHport, et on ajout le serveur linux. On peut le faire en tant qu'utilisateur passhport :

passhport@passhport-server:~$ passhport-admin target create www-server 10.0.1.24
OK: "www-server" -> created
passhport@passhport-server:~$

On peut vérifier que la target a été correctement enregistrée :

passhport@passhport-server:~$ passhport-admin target list
www-server
passhport@passhport-server:~$

Maintenant, ajoutons les autres serveurs Linux/Unix :

passhport@passhport-server:~$ passhport-admin target create vpn-srv1 10.0.23.51
OK: "vpn-srv1" -> created
passhport@passhport-server:~$ passhport-admin target create nas-srv1 10.0.23.51
OK: "nas-srv1" -> created
passhport@passhport-server:~$

On fait la même chose avec les périphériques réseaux, et les autres :

passhport@passhport-server:~$ passhport-admin target create net-AP9-23 172.22.9.23
OK: "net-AP9-23" -> created
passhport@passhport-server:~$ passhport-admin target create net-RO10-98 172.16.10.98
OK: "net-RO10-98" -> created
passhport@passhport-server:~$ passhport-admin target create net-SW22-57 172.20.22.57
OK: "net-SW22-57" -> created
passhport@passhport-server:~$ passhport-admin target create ipbx1 10.192.98.76
OK: "ipbx1" -> created
passhport@passhport-server:~$ passhport-admin target create prntr44 192.168.254.44
OK: "prntr44" -> created
passhport@passhport-server:~$ passhport-admin target create san1 10.192.1.10
OK: "san1" -> created
passhport@passhport-server:~$

Nous avons désormais l'ensemble de nos targets configurées dans PaSSHport.

Target avec un login spécifique

Nous voulons être capable de nous connecter à la baie SAN, en tant un autre utilisateur que root, car Yann (le prestataire) ne doit accéder à cette baie en tant que root, mais en tant qu'utilisateur "admin" :

root@passhport-server:~# passhport-admin target create
Name: admin@san1
Hostname: 10.192.1.10
Login (default is root): admin
Port: 22
SSH Options:
Comment: SAN bay, login as admin user, not root.
OK: "admin@san1" -> created
root@passhport-server:~#

La baie SAN sera désormais accessible à travers deux targets : "san1" et "admin@san1".

Configuration des groupes de targets (targetgroup)

Nous groupons les targets que nous venons de créer dans trois groupes : unices, network, et autres.

Nous créons les groupes :

passhport@passhport-server:~$ passhport-admin targetgroup create unices
OK: "unices" -> created
passhport@passhport-server:~$ passhport-admin targetgroup create network
OK: "network" -> created
passhport@passhport-server:~$ passhport-admin targetgroup create others
OK: "others" -> created
passhport@passhport-server:~$

Maintenant nous mettons les targets dans les groupes correspondant :

passhport@passhport-server:~$ passhport-admin targetgroup addtarget www-server unices
OK: "www-server" added to "unices"
passhport@passhport-server:~$

Je suis paresseux, je vais donc "scripter" un peu tout ça :

passhport@passhport-server:~$ for UNICE in vpn-srv1 nas-srv1; do passhport-admin targetgroup addtarget ${UNICE} unices; done
OK: "vpn-srv1" added to "unices"
OK: "nas-srv1" added to "unices"
passhport@passhport-server:~$ for NETAPPLIANCE in net-AP9-23 net-RO10-98 net-SW22-57; do passhport-admin targetgroup addtarget ${NETAPPLIANCE} network; done
OK: "net-AP9-23" added to "network"
OK: "net-RO10-98" added to "network"
OK: "net-SW22-57" added to "network"
passhport@passhport-server:~$ for OTHERAPPLIANCE in ipbx1 prntr44 san1; do passhport-admin targetgroup addtarget ${OTHERAPPLIANCE} others; done
OK: "ipbx1" added to "others"
OK: "prntr44" added to "others"
OK: "san1" added to "others"
passhport@passhport-server:~$

Nous créons un dernier groupe, qui contiendra l'ensemble des targets (je vais encore le scripter) :

passhport@passhport-server:~$ passhport-admin targetgroup create all-targets
OK: "all-targets" -> created
passhport@passhport-server:~$ for TARGET in `passhport-admin target list`; do passhport-admin targetgroup addtarget ${TARGET} all-targets; done
OK: "ipbx1" added to "all-targets"
OK: "nas-srv1" added to "all-targets"
OK: "net-AP9-23" added to "all-targets"
OK: "net-RO10-98" added to "all-targets"
OK: "net-SW22-57" added to "all-targets"
OK: "prntr44" added to "all-targets"
OK: "san1" added to "all-targets"
OK: "vpn-srv1" added to "all-targets"
OK: "www-server" added to "all-targets"
passhport@passhport-server:~$

On en a terminé avec les targets et les targetgroups (au moins pour le moment)…

Configuration des utilisateurs

Nous partons du préalable que nos utilisateurs on déjà crée leur clé publique SSH (rsa, dsa ou ecdsa), et qu'il nous on donné leur clé publique. Nous avons les clés suivantes :

Alice, une clé RSA de 2048 bits :

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8JMsMgyRUEMoq31rPTIWpWKgGFQ7fxt5Kray8yzCPga2pohMLstjJeHpWjkVhH8FhRUwCFXOM8zBEykz1IVFjowzFqR9kPvV0fELuIeK/V/42j3izeRH5liXFwotxzfpqTijTxAfj/60IadcUSf5dE8WAiREarrV82ieU5eNZ4FoCH4W0xPS8pEYJDv6hQ8TFHYQCrwHloA3HgzEJgQSFWaS3niMDfNbgbJEOVhXuT2l7pWgSnp1l5jewAq5CB71mMiUyF+zG8FRAYqUKd4VNRN+3/tp+9FEAqGCH3kTuFhFnWCgguQxDxH4XiIj7n2w79ARPzMbn2vTtd+6N0or7 alice@myfirm.com

John, une clé ECDSA de 521 bits :

ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAHTlnhl23T9NiHn06wWaDpT1aJqEY0aOW7E4dfu7kQJsmRqg2SWMld6H8Q+bggwCLSkRKubOWyoJkprAfwOP8OArAGPCIr9PeQfC581EVqaev/yJYbKwwPQEaHpiQoHMaBfsgA2BYS5cNVcrOpLk8nHgKSJGEcdYipbZZxqDrLaeX3lBA== john@myfirm.com

Marc, une clé RSA de 4096 bits :

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDFOU5Saf+epkm79BeSniE7VtYMexJeL6BvXUsKUb7m8W4gnD3YTBW93uykO/6ovi9TfYdm+4nKQ9gUGUgzNyD8o7zW8w6wKogoL24UbJKmkZOCU1IgHJSt1QYIs/qHQZ2MR6S6K2f/1J1joYINPtGpQJ475OZfYQbP79fEdRdylupC8L+fvxkka4C0Uxj0I1VjDCVJCjO0md5oXzN75I2aw+RFWuiiL5P/gHRu+2iff2rdhebJZs4ux8u76LQLzYsG9a85Xlagw6N7/aXWnUZ/9gqoF/qVUHfS8ggesTwEJyNnY7EpPcKRUcwnlonn5CIS++Yo8iqjLd93RjFxShUqXlw9Cct4hdh/clW/QYsJRMfN9860mZ9v9dEitM2X1w8HCCD5NAHGqRRrtONM99kZRxmkCQ/Tb+jXvJ+VAl4qffuPPdxY+Bev7wygm4rVnjF2Ac5ioWb4Zd+zIb712VTQDQlRxsu73yWtHSodeSgPpgCWTjCwW/841QbPGkclnE6DKIwQ/vxC0ggSXouc5G6j0gHu90eQ24XL6Gurqr2C11w9saRyzrYRRlS0Ihkp3rMSteVcvrb1Qi4UGmJCHHSBhvP8jRFH4mbdkSGyzsxtjr8puJc8DiQ1UKG3O9X12m8nbOYeNdIofTw615k0YitoQ/60fdEELQyX+kNFQ2VoCw== marc@myfirm.com

Vincent, une clé ECDSA de 521 bits :

ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAHJk+qDLEi283+rUmSek3eEF4PqXYMmQlPTj352w0XO75EGJzfavEDFe0h+Bu39XN/xVc+ypwOb2vv6pcjVsvuHTwHgXR2ElyfE8gGV7mITyXMdDyoWP5N8Ly3s7njNChSL9z3NiG38lg3E4Vg10nbmmoZZCA3WCffV4ugp3lYPnFmtfA== vincent@myfirm.com

Et Yann, une clé RSA de 2048 bits :

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs9YpOfP9vgViYa1SSntrydEBLGyWGAr9nvEjqHcMwHQb9JEmhIjvk1ctb8+Kns3/52F0hBrxic6k6UPvvvjbtJX33muFv5dd0k1W4lLcYe4ONTFwLOqCph4Is5r9lbZ5KXxhN/8YC/08jBJow0CoYdc+Yr7MlA51+tEQFwPbuB5vHMUteye0IgmaH9MLzXes/j5BUhnBjDscWVQSvNHY4/PKtHvIdvoI1uKAplstuHI6CDqnb0aJ5P9wME3P1lhRwcVDTm48/AMcfmpp5s+DwOmyDGfGXf+hE0cu7ulAkwHBhR6ciJJg1pz4DqraglxyVyrt+PFq6KDeV/7WwoNEP yann@otherfirm.com

Avec ces clés, nous pouvons ajouter les utilisateurs, des manières suivantes…

  • De manière interactive :
passhport@passhport-server:~$ passhport-admin user create
Email (user name): alice@myfirm.com
SSH Key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8JMsMgyRUEMoq31rPTIWpWKgGFQ7fxt5Kray8yzCPga2pohMLstjJeHpWjkVhH8FhRUwCFXOM8zBEykz1IVFjowzFqR9kPvV0fELuIeK/V/42j3izeRH5liXFwotxzfpqTijTxAfj/60IadcUSf5dE8WAiREarrV82ieU5eNZ4FoCH4W0xPS8pEYJDv6hQ8TFHYQCrwHloA3HgzEJgQSFWaS3niMDfNbgbJEOVhXuT2l7pWgSnp1l5jewAq5CB71mMiUyF+zG8FRAYqUKd4VNRN+3/tp+9FEAqGCH3kTuFhFnWCgguQxDxH4XiIj7n2w79ARPzMbn2vTtd+6N0or7 alice@myfirm.com
Comment: Alice is the general applicance admin
OK: "alice@myfirm.com" -> created
passhport@passhport-server:~$
  • Sur une seule ligne, en un coup :
passhport@passhport-server:~$ passhport-admin user create john@myfirm.com "ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAHTlnhl23T9NiHn06wWaDpT1aJqEY0aOW7E4dfu7kQJsmRqg2SWMld6H8Q+bggwCLSkRKubOWyoJkprAfwOP8OArAGPCIr9PeQfC581EVqaev/yJYbKwwPQEaHpiQoHMaBfsgA2BYS5cNVcrOpLk8nHgKSJGEcdYipbZZxqDrLaeX3lBA== john@myfirm.com" --comment="John is the Unices admin. He rocks."
OK: "john@myfirm.com" -> created
passhport@passhport-server:~$

Nous ajoutons les autres :

passhport@passhport-server:~$ passhport-admin user create marc@myfirm.com "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDFOU5Saf+epkm79BeSniE7VtYMexJeL6BvXUsKUb7m8W4gnD3YTBW93uykO/6ovi9TfYdm+4nKQ9gUGUgzNyD8o7zW8w6wKogoL24UbJKmkZOCU1IgHJSt1QYIs/qHQZ2MR6S6K2f/1J1joYINPtGpQJ475OZfYQbP79fEdRdylupC8L+fvxkka4C0Uxj0I1VjDCVJCjO0md5oXzN75I2aw+RFWuiiL5P/gHRu+2iff2rdhebJZs4ux8u76LQLzYsG9a85Xlagw6N7/aXWnUZ/9gqoF/qVUHfS8ggesTwEJyNnY7EpPcKRUcwnlonn5CIS++Yo8iqjLd93RjFxShUqXlw9Cct4hdh/clW/QYsJRMfN9860mZ9v9dEitM2X1w8HCCD5NAHGqRRrtONM99kZRxmkCQ/Tb+jXvJ+VAl4qffuPPdxY+Bev7wygm4rVnjF2Ac5ioWb4Zd+zIb712VTQDQlRxsu73yWtHSodeSgPpgCWTjCwW/841QbPGkclnE6DKIwQ/vxC0ggSXouc5G6j0gHu90eQ24XL6Gurqr2C11w9saRyzrYRRlS0Ihkp3rMSteVcvrb1Qi4UGmJCHHSBhvP8jRFH4mbdkSGyzsxtjr8puJc8DiQ1UKG3O9X12m8nbOYeNdIofTw615k0YitoQ/60fdEELQyX+kNFQ2VoCw== marc@myfirm.com"
OK: "marc@myfirm.com" -> created
passhport@passhport-server:~$ passhport-admin user create vincent@myfirm.com "ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAHJk+qDLEi283+rUmSek3eEF4PqXYMmQlPTj352w0XO75EGJzfavEDFe0h+Bu39XN/xVc+ypwOb2vv6pcjVsvuHTwHgXR2ElyfE8gGV7mITyXMdDyoWP5N8Ly3s7njNChSL9z3NiG38lg3E4Vg10nbmmoZZCA3WCffV4ugp3lYPnFmtfA== vincent@myfirm.com" --comment="Vincent is the network admin."
OK: "vincent@myfirm.com" -> created
passhport@passhport-server:~$ passhport-admin user create yann@otherfirm.com "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs9YpOfP9vgViYa1SSntrydEBLGyWGAr9nvEjqHcMwHQb9JEmhIjvk1ctb8+Kns3/52F0hBrxic6k6UPvvvjbtJX33muFv5dd0k1W4lLcYe4ONTFwLOqCph4Is5r9lbZ5KXxhN/8YC/08jBJow0CoYdc+Yr7MlA51+tEQFwPbuB5vHMUteye0IgmaH9MLzXes/j5BUhnBjDscWVQSvNHY4/PKtHvIdvoI1uKAplstuHI6CDqnb0aJ5P9wME3P1lhRwcVDTm48/AMcfmpp5s+DwOmyDGfGXf+hE0cu7ulAkwHBhR6ciJJg1pz4DqraglxyVyrt+PFq6KDeV/7WwoNEP yann@otherfirm.com" --comment="Yann is an external consultant, for a temporary mission bout storage infrastructure."
OK: "yann@otherfirm.com" -> created
passhport@passhport-server:~$

Comme vous pouvez le voir ci-dessus, nous avons oublié de mettre un commentaire pour l'utilisateur "marc@myfirm.com". Ajoutons-en un :

passhport@passhport-server:~$ passhport-admin user edit marc@myfirm.com --newcomment="Marc is the ISSM. He access all."
OK: "marc@myfirm.com" -> edited
passhport@passhport-server:~$

Les utilisateurs sont maintenant créer. Mettons les dans des groupes d'utilisateur (usergroup)…

Configuration des usergroups

Même si dans ce tutoriel, nous n'avons qu'un utilisateur pour chaque type de machine à administrer, il est généralement conseillé de créer un groupe pour chaque type de compétence.

Ajoutons ces groupes :

passhport@passhport-server:~# passhport-admin usergroup create unices_admins
OK: "unices_admins" -> created
passhport@passhport-server:~# passhport-admin usergroup create network_admins
OK: "network_admins" -> created
passhport@passhport-server:~# passhport-admin usergroup create appliance_admins
OK: "appliance_admins" -> created
passhport@passhport-server:~# passhport-admin usergroup create super_admins
OK: "super_admins" -> created
passhport@passhport-server:~#

Nous ajoutons chaque utilisateur au groupe lui correspondant :

passhport@passhport-server:~$ passhport-admin usergroup adduser john@myfirm.com unices_admins
OK: "john@myfirm.com" added to "unices_admins"
passhport@passhport-server:~$ passhport-admin usergroup adduser vincent@myfirm.com network_admins
OK: "vincent@myfirm.com" added to "network_admins"
passhport@passhport-server:~$ passhport-admin usergroup adduser alice@myfirm.com appliance_admins
OK: "alice@myfirm.com" added to "appliance_admins"
passhport@passhport-server:~$ passhport-admin usergroup adduser marc@myfirm.com super_admins
OK: "marc@myfirm.com" added to "super_admins"
passhport@passhport-server:~$

Mise en ralation des groupe

Nous pouvons maintenant connecter chaque usergroup à son targetgroup :

passhport@passhport-server:~# passhport-admin targetgroup addusergroup unices_admins unices
OK: "unices_admins" added to "unices"
passhport@passhport-server:~# passhport-admin targetgroup addusergroup network_admins network
OK: "network_admins" added to "network"
passhport@passhport-server:~# passhport-admin targetgroup addusergroup appliance_admins others
OK: "appliance_admins" added to "others"
passhport@passhport-server:~# passhport-admin targetgroup addusergroup super_admins all-targets
OK: "super_admins" added to "all-targets"
passhport@passhport-server:~#

Configuration spécifique pour le prestataire Yann :

Comme Yann n'est ici que pour une courte mission, et qu'il a besoin d'accéder à différentes targets qui n'ont pas vocations à être groupée au sein d'un targetgroup, nous connectons directement l'utilisateur à ses targets :

passhport@passhport-server:~$ passhport-admin target adduser yann@otherfirm.com nas-srv1
OK: "yann@otherfirm.com" added to "nas-srv1"
passhport@passhport-server:~# passhport-admin target adduser yann@otherfirm.com admin@san1
OK: "yann@otherfirm.com" added to "admin@san1"
passhport@passhport-server:~#

Comme vous pouvez le voir ci-dessus, nous n'avons pas donné à Yann l'accès a la baie SAN san1 en tant que root, mais en tant qu'utilisateur admin, grâce à la target admin@san1 précédemment configurée.

Vérification des droits d'accès :

On peut vérifier ce que nous avons configuré avec la sous-commande "show" de passhport-admin :

passhport@passhport-server:~$ passhport-admin user show marc@myfirm.com
Email: marc@myfirm.com
SSH key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDFOU5Saf+epkm79BeSniE7VtYMexJeL6BvXUsKUb7m8W4gnD3YTBW93uykO/6ovi9TfYdm+4nKQ9gUGUgzNyD8o7zW8w6wKogoL24UbJKmkZOCU1IgHJSt1QYIs/qHQZ2MR6S6K2f/1J1joYINPtGpQJ475OZfYQbP79fEdRdylupC8L+fvxkka4C0Uxj0I1VjDCVJCjO0md5oXzN75I2aw+RFWuiiL5P/gHRu+2iff2rdhebJZs4ux8u76LQLzYsG9a85Xlagw6N7/aXWnUZ/9gqoF/qVUHfS8ggesTwEJyNnY7EpPcKRUcwnlonn5CIS++Yo8iqjLd93RjFxShUqXlw9Cct4hdh/clW/QYsJRMfN9860mZ9v9dEitM2X1w8HCCD5NAHGqRRrtONM99kZRxmkCQ/Tb+jXvJ+VAl4qffuPPdxY+Bev7wygm4rVnjF2Ac5ioWb4Zd+zIb712VTQDQlRxsu73yWtHSodeSgPpgCWTjCwW/841QbPGkclnE6DKIwQ/vxC0ggSXouc5G6j0gHu90eQ24XL6Gurqr2C11w9saRyzrYRRlS0Ihkp3rMSteVcvrb1Qi4UGmJCHHSBhvP8jRFH4mbdkSGyzsxtjr8puJc8DiQ1UKG3O9X12m8nbOYeNdIofTw615k0YitoQ/60fdEELQyX+kNFQ2VoCw== marc@myfirm.com
Comment: Marc is the ISSM. He access all.
Accessible target list: ipbx1 nas-srv1 net-AP9-23 net-RO10-98 net-SW22-57 prntr44 san1 vpn-srv1 www-server

Details in access:
Accessible directly:
Accessible through usergroups:
super_admins: www-server ; vpn-srv1 ; nas-srv1 ; net-AP9-23 ; net-RO10-98 ; net-SW22-57 ; ipbx1 ; prntr44 ; san1 ;
Accessible through targetgroups:
passhport@passhport-server:~$

Comme on peut le voir, la sous commande "show" montre comment un utilisateur à accès à une target. Nous pouvons voir ci-dessus que Marc a accès à toutes targets configurées, parce que nous l'avons placé dans le usergroup "super_admins".

Voici l'exemple de Yann :

passhport@passhport-server:~$ passhport-admin user show yann@otherfirm.com
Email: yann@otherfirm.com
SSH key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs9YpOfP9vgViYa1SSntrydEBLGyWGAr9nvEjqHcMwHQb9JEmhIjvk1ctb8+Kns3/52F0hBrxic6k6UPvvvjbtJX33muFv5dd0k1W4lLcYe4ONTFwLOqCph4Is5r9lbZ5KXxhN/8YC/08jBJow0CoYdc+Yr7MlA51+tEQFwPbuB5vHMUteye0IgmaH9MLzXes/j5BUhnBjDscWVQSvNHY4/PKtHvIdvoI1uKAplstuHI6CDqnb0aJ5P9wME3P1lhRwcVDTm48/AMcfmpp5s+DwOmyDGfGXf+hE0cu7ulAkwHBhR6ciJJg1pz4DqraglxyVyrt+PFq6KDeV/7WwoNEP yann@otherfirm.com
Comment: Yann is an external consultant, for a temporary mission bout storage infrastructure.
Accessible target list: nas-srv1 san1

Details in access:
Accessible directly: nas-srv1 ; san1 ;
Accessible through usergroups:
Accessible through targetgroups:
passhport@passhport-server:~$

On peut voir ci-dessus que Yann à un accès direct aux target, sans passer par des usergroup, ou des targetgroup.

Connectons-nous !

Mettons nous maintenant dans la peau de John : je me connect à PaSSHport, en utilisant la clé id_ecdsa que j'ai envoyé à l'administrateur de PaSSHport :

john@my-desktop:~$ ssh passhport@passhport-server
Welcome john@myfirm.com.
Here is the list of servers you can access:
1  www-server  10.0.1.24
2  vpn-srv1    10.0.23.51
3  nas-srv1    10.0.12.87
Type the number, name or hostname of the server you want to connect to :

En tant que John, je constate que je peux accéder à trois serveurs : www-server, vpn-srv1, et nas-srv1. Je peux maintenant accéder à chacun de ces serveurs, selon les méthodes suivantes :

  • Le numéro situé dans la première colonne;
  • le nom du serveur (www-server…);
  • l'adresse IP.
john@my-desktop:~$ ssh passhport@passhport-server
Welcome john@myfirm.com.
Here is the list of servers you can access:
1  www-server  10.0.1.24
2  vpn-srv1    10.0.23.51
3  nas-srv1    10.0.12.87
Type the number, name or hostname of the server you want to connect to : 1
Linux www-server 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) x86_64
root@www-server:~#

John est maintenant sur le serveur www-server.

Je suis maintenant dans la peau d'Alice, dont le poste de travail est sous Windows. Je vais utiliser l'outil Putty pour me connecter à PaSSHport. Voilà comment le configurer :

On lance Putty (téléchargable ici), et sur la partie gauche, on clique sur Connection -> SSH -> Auth, pour selectionner la clé PPK qu'Alice a créé (avec l'outil puttygen par exemple) :

_images/putty02-circle.PNG

Ensuite nous allons dans Connection -> SSH -> Data , et mettons le username à passhport :

_images/putty03-circle.PNG

Pour finir, on retourne à la racine de l'arbre de configuration, dans la section Session :

  • on entre le nom d'hôte ou l'IP du serveur PaSSHport
  • on entre le port du serveur SSH (généralement 22)
  • on sélectionne SSH comme type de connexion
  • on entre le nom sous lequel sauver la configuration que nous venons de mettre en place

Pour débugger une connexion défaillante, il est souvent utile de sélectionner l'option Never dans la section Close window on exit, et ce, afin de voir la raison de déconnexion.

On sauve, et on clique le bouton Open, pour lancer la connexion !

_images/putty01-circle.PNG

Si c'est la première fois qu'on se connecte sur le serveur PaSSHport, une fenêtre indiquant qu'il faut vérifier l'empreinte du serveur, et si on doit l'accepter… On l'accepte en cliquant le bouton Oui :

_images/putty04-circle.PNG

Nous avons ensuite le prompt de PaSSHport, et comme nous voulons nous connecter à l'IPBX, on sélection l'entrée 1 :

_images/putty06-circle.PNG

On est désormais sur notre serveur cible.

Dernier exemple intéressant, Yann, qui accède au serveur nas-srv1 et san1. Il utilise un ordinateur portable sous linux :

yann@my-laptop:~$ ssh passhport@passhport-server
Welcome yann@otherfirm.com.
Here is the list of servers you can access:
1  nas-srv1    10.0.12.87
2  admin@san1  10.192.1.10  SAN bay, login as admin user, not root.
Type the number, name or hostname of the server you want to connect to :

Il peut désormais accéder au deux serveurs relatifs à sa mission.

Suppression d'un utilisateur

Yann a désormais fini sa mission, et a quitté la société. On peut révoquer ses droits de deux manières :

  • en enlevant les liaisons de son compte (que ce soit une target, un targetgroup, ou un usergroup) ;
  • en supprimant l'utilisateur.

Il parfois plus judicieux d'utiliser la première méthode, quand on sait par exemple que l'utilisateur est susceptible de revenir plus tard, et ne pas avoir à le recréer (et devoir récupérer sa clef, et ses informations…). Voici comment procéder :

Premièrement, on liste ses droits :

passhport@passhport-server:~$ passhport-admin user show yann@otherfirm.com
Email: yann@otherfirm.com
SSH key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs9YpOfP9vgViYa1SSntrydEBLGyWGAr9nvEjqHcMwHQb9JEmhIjvk1ctb8+Kns3/52F0hBrxic6k6UPvvvjbtJX33muFv5dd0k1W4lLcYe4ONTFwLOqCph4Is5r9lbZ5KXxhN/8YC/08jBJow0CoYdc+Yr7MlA51+tEQFwPbuB5vHMUteye0IgmaH9MLzXes/j5BUhnBjDscWVQSvNHY4/PKtHvIdvoI1uKAplstuHI6CDqnb0aJ5P9wME3P1lhRwcVDTm48/AMcfmpp5s+DwOmyDGfGXf+hE0cu7ulAkwHBhR6ciJJg1pz4DqraglxyVyrt+PFq6KDeV/7WwoNEP yann@otherfirm.com
Comment: Yann is an external consultant, for a temporary mission bout storage infrastructure.
Accessible target list: admin@san1 nas-srv1

Details in access:
Accessible directly: nas-srv1 ; admin@san1 ;
Accessible through usergroups:
Accessible through targetgroups:
passhport@passhport-server:~$

On peut voir qu'il a accès aux targets nas-srv1 et admin@san1, directement. Révoquons ces droits :

passhport@passhport-server:~$ passhport-admin target rmuser yann@otherfirm.com admin@san1
OK: "yann@otherfirm.com" removed from "admin@san1"
passhport@passhport-server:~$ passhport-admin target rmuser yann@otherfirm.com nas-srv1
OK: "yann@otherfirm.com" removed from "nas-srv1"
passhport@passhport-server:~$

Yann n'aura désormais plus accès à ces targets :

passhport@passhport-server:~$ passhport-admin user show yann@otherfirm.com
Email: yann@otherfirm.com
SSH key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs9YpOfP9vgViYa1SSntrydEBLGyWGAr9nvEjqHcMwHQb9JEmhIjvk1ctb8+Kns3/52F0hBrxic6k6UPvvvjbtJX33muFv5dd0k1W4lLcYe4ONTFwLOqCph4Is5r9lbZ5KXxhN/8YC/08jBJow0CoYdc+Yr7MlA51+tEQFwPbuB5vHMUteye0IgmaH9MLzXes/j5BUhnBjDscWVQSvNHY4/PKtHvIdvoI1uKAplstuHI6CDqnb0aJ5P9wME3P1lhRwcVDTm48/AMcfmpp5s+DwOmyDGfGXf+hE0cu7ulAkwHBhR6ciJJg1pz4DqraglxyVyrt+PFq6KDeV/7WwoNEP yann@otherfirm.com
Comment: Yann is an external consultant, for a temporary mission bout storage infrastructure.
Accessible target list:

Details in access:
Accessible directly:
Accessible through usergroups:
Accessible through targetgroups:
passhport@passhport-server:~$

La seconde option est de supprimer cet utilisateur :

passhport@passhport-server:~$ passhport-admin user delete yann@otherfirm.com
Email: yann@otherfirm.com
SSH key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs9YpOfP9vgViYa1SSntrydEBLGyWGAr9nvEjqHcMwHQb9JEmhIjvk1ctb8+Kns3/52F0hBrxic6k6UPvvvjbtJX33muFv5dd0k1W4lLcYe4ONTFwLOqCph4Is5r9lbZ5KXxhN/8YC/08jBJow0CoYdc+Yr7MlA51+tEQFwPbuB5vHMUteye0IgmaH9MLzXes/j5BUhnBjDscWVQSvNHY4/PKtHvIdvoI1uKAplstuHI6CDqnb0aJ5P9wME3P1lhRwcVDTm48/AMcfmpp5s+DwOmyDGfGXf+hE0cu7ulAkwHBhR6ciJJg1pz4DqraglxyVyrt+PFq6KDeV/7WwoNEP yann@otherfirm.com
Comment: Yann is an external consultant, for a temporary mission bout storage infrastructure.
Accessible target list:

Details in access:
Accessible directly:
Accessible through usergroups:
Accessible through targetgroups:
Are you sure you want to delete yann@otherfirm.com? [y/N] y
OK: "yann@otherfirm.com" -> deleted
passhport@passhport-server:~$

Conclusion

Vous devriez être désormais capable d'utiliser les fonctions basiques de PaSSHport.

Utilisation de passhport-admin

Ce chapitre décrit l'utilisation de passhport-admin

Un chapitre par sous-module :

Utilisation de la CLI

Vous pouvez lancer passhport-admin en ligne de commande interactive, en utilisant l'option -i.

Vous pouvez configurer passhportd à travers ce mode interactif. Référez-vous à la bonne section de la documentation du module correspondant.

user

Usages

passhport-admin user list
passhport-admin user search [<pattern>]
passhport-admin user show [<name>]
passhport-admin user create [((<name> <sshkey>) [--comment=<comment>])]
passhport-admin user edit [(<name> [--newname=<name>] [--newsshkey=<sshkey>] [--newcomment=<comment>])]
passhport-admin user delete [([-f | --force] <name>)]
list

passhport-admin target list affiche l'ensemble des users configurées.

Exemple :

admin@bastion:~$ passhport-admin user list
admin1@compagny.com
admin2@compagny.com
alice@compagny.com
bob@compagny.com
admin@bastion:~$
show

passhport-admin target show <NAME> affiche toutes les informations au sujet d'un user nommé <NAME>.

Exemple :

admin@bastion:~# passhport-admin user show alice@compagny.com
Email: alice@compagny.com
SSH key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDFOU5Saf+epkm79BeSniE7VtYMexJeL6BvXUsKUb7m8W4gnD3YTBW93uykO/6ovi9TfYdm+4nKQ9gUGUgzNyD8o7zW8w6wKogoL24UbJKmkZOCU1IgHJSt1QYIs/qHQZ2MR6S6K2f/1J1joYINPtGpQJ475OZfYQbP79fEdRdylupC8L+fvxkka4C0Uxj0I1VjDCVJCjO0md5oXzN75I2aw+RFWuiiL5P/gHRu+2iff2rdhebJZs4ux8u76LQLzYsG9a85Xlagw6N7/aXWnUZ/9gqoF/qVUHfS8ggesTwEJyNnY7EpPcKRUcwnlonn5CIS++Yo8iqjLd93RjFxShUqXlw9Cct4hdh/clW/QYsJRMfN9860mZ9v9dEitM2X1w8HCCD5NAHGqRRrtONM99kZRxmkCQ/Tb+jXvJ+VAl4qffuPPdxY+Bev7wygm4rVnjF2Ac5ioWb4Zd+zIb712VTQDQlRxsu73yWtHSodeSgPpgCWTjCwW/841QbPGkclnE6DKIwQ/vxC0ggSXouc5G6j0gHu90eQ24XL6Gurqr2C11w9saRyzrYRRlS0Ihkp3rMSteVcvrb1Qi4UGmJCHHSBhvP8jRFH4mbdkSGyzsxtjr8puJc8DiQ1UKG3O9X12m8nbOYeNdIofTw615k0YitoQ/60fdEELQyX+kNFQ2VoCw== alice@compagny.com
Comment:
Accessible target list:

Details in access:
Accessible directly:
Accessible through usergroups:
Accessible through targetgroups:
admin@bastion:~#

Si aucun modèle (PATTERN), l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~# passhport-admin user show
Name: alice@compagny.com
Email: alice@compagny.com
SSH key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDFOU5Saf+epkm79BeSniE7VtYMexJeL6BvXUsKUb7m8W4gnD3YTBW93uykO/6ovi9TfYdm+4nKQ9gUGUgzNyD8o7zW8w6wKogoL24UbJKmkZOCU1IgHJSt1QYIs/qHQZ2MR6S6K2f/1J1joYINPtGpQJ475OZfYQbP79fEdRdylupC8L+fvxkka4C0Uxj0I1VjDCVJCjO0md5oXzN75I2aw+RFWuiiL5P/gHRu+2iff2rdhebJZs4ux8u76LQLzYsG9a85Xlagw6N7/aXWnUZ/9gqoF/qVUHfS8ggesTwEJyNnY7EpPcKRUcwnlonn5CIS++Yo8iqjLd93RjFxShUqXlw9Cct4hdh/clW/QYsJRMfN9860mZ9v9dEitM2X1w8HCCD5NAHGqRRrtONM99kZRxmkCQ/Tb+jXvJ+VAl4qffuPPdxY+Bev7wygm4rVnjF2Ac5ioWb4Zd+zIb712VTQDQlRxsu73yWtHSodeSgPpgCWTjCwW/841QbPGkclnE6DKIwQ/vxC0ggSXouc5G6j0gHu90eQ24XL6Gurqr2C11w9saRyzrYRRlS0Ihkp3rMSteVcvrb1Qi4UGmJCHHSBhvP8jRFH4mbdkSGyzsxtjr8puJc8DiQ1UKG3O9X12m8nbOYeNdIofTw615k0YitoQ/60fdEELQyX+kNFQ2VoCw== alice@compagny.com
Comment:
Accessible target list:

Details in access:
Accessible directly:
Accessible through usergroups:
Accessible through targetgroups:
admin@bastion:~#
create

passhport-admin user create [((<name> <sshkey>) [--comment=<comment>])] crée un nouveau user

Argument Description
<name> Nom du user à éditer
<sshkey> La clef SSH du user (bien utiliser des apostrophes pour entourer la clé)
--comment Commentaire concernant le user (optionnel)

Exemple :

admin@bastion:~$ passhport-admin user create bob@compagny.com "ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAHTlnhl23T9NiHn06wWaDpT1aJqEY0aOW7E4dfu7kQJsmRqg2SWMld6H8Q+bggwCLSkRKubOWyoJkprAfwOP8OArAGPCIr9PeQfC581EVqaev/yJYbKwwPQEaHpiQoHMaBfsgA2BYS5cNVcrOpLk8nHgKSJGEcdYipbZZxqDrLaeX3lBA== bob@mydesktop"
OK: "bob@compagny.com" -> created
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin user create bob@compagny.com "ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAHTlnhl23T9NiHn06wWaDpT1aJqEY0aOW7E4dfu7kQJsmRqg2SWMld6H8Q+bggwCLSkRKubOWyoJkprAfwOP8OArAGPCIr9PeQfC581EVqaev/yJYbKwwPQEaHpiQoHMaBfsgA2BYS5cNVcrOpLk8nHgKSJGEcdYipbZZxqDrLaeX3lBA== bob@mydesktop"
OK: "bob@compagny.com" -> created
admin@bastion:~$ passhport-admin user create
Email (user name): john@ext-compagny.com
SSH Key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs9YpOfP9vgViYa1SSntrydEBLGyWGAr9nvEjqHcMwHQb9JEmhIjvk1ctb8+Kns3/52F0hBrxic6k6UPvvvjbtJX33muFv5dd0k1W4lLcYe4ONTFwLOqCph4Is5r9lbZ5KXxhN/8YC/08jBJow0CoYdc+Yr7MlA51+tEQFwPbuB5vHMUteye0IgmaH9MLzXes/j5BUhnBjDscWVQSvNHY4/PKtHvIdvoI1uKAplstuHI6CDqnb0aJ5P9wME3P1lhRwcVDTm48/AMcfmpp5s+DwOmyDGfGXf+hE0cu7ulAkwHBhR6ciJJg1pz4DqraglxyVyrt+PFq6KDeV/7WwoNEP yann@mylaptop.com
Comment: John is a extern expert.
OK: "john@ext-compagny.com" -> created
admin@bastion:~$
edit

passhport-admin user edit [(<name> [--newname=<name>] [--newsshkey=<sshkey>] [--newcomment=<comment>])] édite un user existant.

Argument Description
<name> Nom du user à éditer
--newname Nouveau nom du user que l'on souhaite renommer (optionnel)
--newsshkey La nouvelle clef SSH du user (bien utiliser des apostrophes pour entourer la clé)
--newcomment Nouveau commentaire concernant le user (optionel)

Exemple :

admin@bastion:~$ passhport-admin user edit john@ext-compagny.com --newname=john.doe@ext-compagny.com --newcomment="John is a extern expert, he'll be here until january 18th."
OK: "john@ext-compagny.com" -> edited
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif. Un tableau montrant l'ensemble des paramètre de configuration est d'abord affiché, puis, ligne par ligne, chaque argument modifiable est affiché. L'utilisateur peut conserver chaque paramètre présenté au dessus en appuyant sur "Entrer". La seule exception est pour le champs "comment" : si l'utilisateur souhaite enlever le commentaire, il tape alors "Entrer", puis il lui sera demandé s'il veut supprimer le commentaire, ou non.

Exemple :

admin@bastion:~$ passhport-admin user edit
Name of the user you want to modify: john.doe@ext-compagny.com
Email: john.doe@ext-compagny.com
SSH key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs9YpOfP9vgViYa1SSntrydEBLGyWGAr9nvEjqHcMwHQb9JEmhIjvk1ctb8+Kns3/52F0hBrxic6k6UPvvvjbtJX33muFv5dd0k1W4lLcYe4ONTFwLOqCph4Is5r9lbZ5KXxhN/8YC/08jBJow0CoYdc+Yr7MlA51+tEQFwPbuB5vHMUteye0IgmaH9MLzXes/j5BUhnBjDscWVQSvNHY4/PKtHvIdvoI1uKAplstuHI6CDqnb0aJ5P9wME3P1lhRwcVDTm48/AMcfmpp5s+DwOmyDGfGXf+hE0cu7ulAkwHBhR6ciJJg1pz4DqraglxyVyrt+PFq6KDeV/7WwoNEP yann@mylaptop.com
Comment: John is a extern expert, he'll be here until january 18th.
Accessible target list:

Details in access:
Accessible directly:
Accessible through usergroups:
Accessible through targetgroups:
New name:
New SSH key:
New comment: John is a extern expert, he'll be here until february 2nd
OK: "john.doe@ext-compagny.com" -> edited
admin@bastion:~$

Comme montré ci-dessus, seule l'entrée "New comment" a été modifiée. Si une entrée est simplement remplie par "Entrer", la valeur précédente est conservée.

delete

passhport-admin target delete [([-f | --force] <name>)] supprime un user.

Argument Description
<name> Nom du user à supprimer
-f ou --force Si utilisé, aucune confirmation ne sera demandé à l'utilisateur

Exemple :

admin@bastion:~$ passhport-admin user delete john.doe@ext-compagny.com
Email: john.doe@ext-compagny.com
SSH key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs9YpOfP9vgViYa1SSntrydEBLGyWGAr9nvEjqHcMwHQb9JEmhIjvk1ctb8+Kns3/52F0hBrxic6k6UPvvvjbtJX33muFv5dd0k1W4lLcYe4ONTFwLOqCph4Is5r9lbZ5KXxhN/8YC/08jBJow0CoYdc+Yr7MlA51+tEQFwPbuB5vHMUteye0IgmaH9MLzXes/j5BUhnBjDscWVQSvNHY4/PKtHvIdvoI1uKAplstuHI6CDqnb0aJ5P9wME3P1lhRwcVDTm48/AMcfmpp5s+DwOmyDGfGXf+hE0cu7ulAkwHBhR6ciJJg1pz4DqraglxyVyrt+PFq6KDeV/7WwoNEP yann@mylaptop.com
Comment: John is a extern expert, he'll be here until february 2nd
Accessible target list:

Details in access:
Accessible directly:
Accessible through usergroups:
Accessible through targetgroups:
Are you sure you want to delete john.doe@ext-compagny.com? [y/N] y
OK: "john.doe@ext-compagny.com" -> deleted
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin user delete
Name: bob@compagny.com
Email: bob@compagny.com
SSH key: ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAHTlnhl23T9NiHn06wWaDpT1aJqEY0aOW7E4dfu7kQJsmRqg2SWMld6H8Q+bggwCLSkRKubOWyoJkprAfwOP8OArAGPCIr9PeQfC581EVqaev/yJYbKwwPQEaHpiQoHMaBfsgA2BYS5cNVcrOpLk8nHgKSJGEcdYipbZZxqDrLaeX3lBA== bob@mydesktop
Comment:
Accessible target list:

Details in access:
Accessible directly:
Accessible through usergroups:
Accessible through targetgroups:
Are you sure you want to delete bob@compagny.com? [y/N] y
OK: "bob@compagny.com" -> deleted
admin@bastion:~$

target

Usages :

passhport-admin target list
passhport-admin target search [<pattern>]
passhport-admin target checkaccess [<pattern>]
passhport-admin target show [<name>]
passhport-admin target create [((<name> <hostname>) [--login=<login>] [--type=<ssh>] [--comment=<comment>] [--sshoptions=<sshoptions>] [--port=<port>])]
passhport-admin target edit [(<name> [--newname=<name>] [--newhostname=<hostname>] [--newlogin=<login>] [--newcomment=<comment>] [--newsshoptions=<sshoptions>] [--newport=<port>])]
passhport-admin target (adduser | rmuser) [(<username> <targetname>)]
passhport-admin target (addusergroup | rmusergroup) [(<usergroupname> <targetname>)]
passhport-admin target delete [([-f | --force] <name>)]
list

passhport-admin target list affiche l'ensemble des targets configurées.

Exemple :

admin@bastion:~$ passhport-admin target list
srv1.compagny.com
srv2.compagny.com
srv3.compagny.com
websrv.ext.client.com
webbackend.ext.client.com
admin@bastion:~$
checkaccess

passhport-admin target checkaccess [<PATTERN>] verifie que PaSSHport a bien accès à toutes les targets qui correspondent au modèle (<PATTERN>) donné.

Exemple :

admin@bastion:~$ passhport-admin target checkaccess web
OK:    132.123.45.67   websrv.ext.client.com
OK:    132.234.56.78   webbackend.ext.client.com
admin@bastion:~$

Si aucun modèle (PATTERN), l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin target checkaccess
Pattern: web
OK:    132.123.45.67   websrv.ext.client.com
OK:    132.234.56.78   webbackend.ext.client.com
admin@bastion:~$
show

passhport-admin target show <NAME> affiche toutes les informations au sujet d'une target nommée <NAME>.

Exemple :

admin@bastion:~$ passhport-admin target show websrv.ext.client.com
Name: websrv.ext.client.com
Hostname: 132.123.45.67
Server Type : ssh
Login: root
Port: 22
SSH options:
Comment:
Attached users:
Usergroup list:
Users who can access this target: admin1@compagny.com admin2@compagny.com
All usergroups:
Member of the following targetgroups: all-targets
admin@bastion:~$

Si aucun modèle (PATTERN), l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin target show
Name: websrv.ext.client.com
Name: websrv.ext.client.com
Hostname: 132.123.45.67
Server Type : ssh
Login: root
Port: 22
SSH options:
Comment:
Attached users:
Usergroup list:
Users who can access this target: admin1@compagny.com admin2@compagny.com
All usergroups:
Member of the following targetgroups: all-targets
admin@bastion:~$
create

passhport-admin target create [((<name> <hostname>) [--login=<login>] [--type=<ssh>] [--comment=<comment>] [--sshoptions=<sshoptions>] [--port=<port>])] creates a new target.

Argument Description
<name> Nom de la target à supprimer
hostname Nom d'hôte ou IP de la target
--login Login à utiliser lors de la connexion à une target (optionnel)
--type The type of the target (for the commercial version only). It can be ssh, postgresql, mysql, oracle.<br/> This is used to know which hook to launch, depending on the server<br/> type. If type is something else than ssh, the server won't be <br/> accessible via SSH. If the target is a PostGreSQL server and you <br/> want to lauch the corresponding hook (usually a proxy to log user <br/> actions, use postgresql type). Same explanations for mysql and <br/> oracle.<br/> Use the default ssh, unless you have the commercial version.<br/>
--comment Commentaire concernant la target (optionnel)
--sshoptions Options SSH à utiliser pour se connecter à la target (optionnel)
--port Port SSH à utiliser pour se connecter à la target (optionnel)

Exemple :

admin@bastion:~# passhport-admin target create firewall.compagny.com 87.65.43.219 --login=root --comment="Client 1 web server number 1"
OK: "firewall.compagny.com" -> created
admin@bastion:~#

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~# passhport-admin target create
Name: firewall2.compagny.com
Hostname: 87.65.43.220
Type (default is ssh):
Login (default is root):
Port: 22
SSH Options:
Comment: Client 1 FireWall 2 (Cisco)
OK: "firewall1.compagny.com" -> created
admin@bastion:~#

Pensez à copier une clé public de passhport sur la target et à tester avec "checkaccess" les accès à votre nouvelle target.

edit

passhport-admin target edit [(<name> [--newname=<name>] [--newhostname=<hostname>] [--newtype=<ssh>] [--newlogin=<login>] [--newcomment=<comment>] [--newsshoptions=<sshoptions>] [--newport=<port>])] edits an existing target.

Argument Description
<name> Nom de la target à éditer
--newname Nouveau nom de la target que l'on souhaite renommer (optionnel)
--newhostname Nouveau nom d'hôte ou IP de la target (optionnel)
--newtype The type of the target (for the commercial version only). It can be ssh, postgresql, mysql, oracle.<br/> This is used to know which hook to launch, depending on the server<br/> type. If type is something else than ssh, the server won't be <br/> accessible via SSH. If the target is a PostGreSQL server and you <br/> want to lauch the corresponding hook (usually a proxy to log user <br/> actions, use postgresql type). Same explanations for mysql and <br/> oracle.<br/> Use the default ssh, unless you have the commercial version.<br/>
--newlogin Nouveau login à utiliser lors de la connexion à une target (optionnel)
--newcomment Nouveau commentaire concernant la target (optionel)
--newsshoptions Nouvelles options SSH à utiliser pour se connecter à la target (optionnel)
--newport Nouveau port SSH à utiliser pour se connecter à la target (optionnel)

Exemple :

admin@bastion:~# passhport-admin target edit firewall.compagny.com --newname=firewall1.compagny.com --newcomment="Client 1 FireWall 1 (Cisco)" --newlogin="admin"
OK: "firewall.compagny.com" -> edited
admin@bastion:~#

Si aucun argument n'est donné, l'utilisateur entre en mode interactif. Un tableau montrant l'ensemble des paramètre de configuration est d'abord affiché, puis, ligne par ligne, chaque argument modifiable est affiché. L'utilisateur peut conserver chaque paramètre présenté au dessus en appuyant sur "Entrer". La seule exception est pour le champs "comment" : si l'utilisateur souhaite enlever le commentaire, il tape alors "Entrer", puis il lui sera demandé s'il veut supprimer le commentaire, ou non.

Exemple :

admin@bastion:~# passhport-admin target edit
Name of the target you want to modify: firewall2.compagny.com
Name: firewall2.compagny.com
Hostname: 87.65.43.220
Server Type : ssh
Login: root
Port: 22
SSH options:
Comment: Client 1 FireWall 2 (Cisco)
Attached users:
Usergroup list:
Users who can access this target:
All usergroups:
Member of the following targetgroups:
New name:
New hostname:
New Login: admin
New port:
New SSH options:
New comment:
Remove original comment? [y/N]N
OK: "firewall2.compagny.com" -> edited
admin@bastion:~#

Comme montré ci-dessus, seule l'entrée "New Login" a été modifié. Si une entrée est simplement rempli par "Entrer", la valeur précédent est conservée.

adduser

passhport-admin target adduser [(<username> <targetname>)] connecte directement une target avec un user.

Argument Description
<username> Nom du user que l'on connecte directement à la target
<targetname> Nom de la target à laquelle on connecte directement au user

Exemple :

admin@bastion:~# passhport-admin target adduser admin1@compagny.com firewall1.compagny.com
OK: "admin1@compagny.com" added to "firewall1.compagny.com"
admin@bastion:~#

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~# passhport-admin target adduser
Username: admin2@compagny.com
Targetname: firewall2.compagny.com
OK: "admin2@compagny.com" added to "firewall2.compagny.com"
admin@bastion:~#
rmuser

passhport-admin target adduser [(<username> <targetname>)] supprime le lien direct entre une target et un user.

Argument Description
<username> Nom du user que l'on délie de la target
<targetname> Nom de la target de laquelle on délie le user

Exemple :

admin@bastion:~# passhport-admin target rmuser admin1@compagny.com firewall1.compagny.com
OK: "admin1@compagny.com" removed from "firewall1.compagny.com"
admin@bastion:~#

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~# passhport-admin target rmuser
Username: admin2@compagny.com
Targetname: firewall2.compagny.com
OK: "admin2@compagny.com" removed from "firewall2.compagny.com"
admin@bastion:~#
addusergroup

passhport-admin target addusergroup [(<usergroupname> <targetname>)] connecte directement une target à un usergroup.

Argument Description
<usergroupname> Nom du usergroup à connecter directement à la target
<targetname> Nom de la target à laquelle on connecte directement le usergroup

Exemple :

admin@bastion:~# passhport-admin target addusergroup firewall-admins firewall1.compagny.com
OK: "firewall-admins" added to "firewall1.compagny.com"
admin@bastion:~#

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~# passhport-admin target addusergroup
Usergroupname: firewall-admins
Targetname: firewall2.compagny.com
OK: "firewall-admins" added to "firewall2.compagny.com"
admin@bastion:~#
rmusergroup

passhport-admin target delusergroup [(<usergroupname> <targetname>)] supprime le lien direct entre une target et un usergroup.

Argument Description
<usergroupname> Nom du usergroup à delier de la target
<targetname> Nom de la target de laquelle on délie le usergroup

Exemple :

admin@bastion:~# passhport-admin target addusergroup firewall-admins firewall1.compagny.com
OK: "firewall-admins" added to "firewall1.compagny.com"
admin@bastion:~#

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~# passhport-admin target addusergroup
Usergroupname: firewall-admins
Targetname: firewall2.compagny.com
OK: "firewall-admins" added to "firewall2.compagny.com"
admin@bastion:~#
delete

passhport-admin target delete [([-f | --force] <name>)] supprime une target.

Argument Description
<name> Nom de la target à supprimer
-f ou --force Si utilisé, aucune confirmation ne sera demandé à l'utilisateur

Exemple :

admin@bastion:~# passhport-admin target delete firewall1.compagny.com
Name: firewall1.compagny.com
Hostname: firewall1.compagny.com
Server Type : ssh
Login: admin
Port: 22
SSH options:
Comment: Client 1 FireWall 1 (Cisco)
Attached users:
Usergroup list: firewall-admins
Users who can access this target:
All usergroups: firewall-admins
Member of the following targetgroups:
Are you sure you want to delete firewall1.compagny.com? [y/N] y
OK: "firewall1.compagny.com" -> deleted
admin@bastion:~#

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~# passhport-admin target delete
Name: firewall2.compagny.com
Name: firewall2.compagny.com
Hostname: 87.65.43.220
Server Type : ssh
Login: admin
Port: 22
SSH options:
Comment: Client 1 FireWall 2 (Cisco)
Attached users:
Usergroup list: firewall-admins network-admins
Users who can access this target:
All usergroups: firewall-admins network-admins
Member of the following targetgroups:
Are you sure you want to delete firewall2.compagny.com? [y/N] y
OK: "firewall2.compagny.com" -> deleted
admin@bastion:~#

usergroup

Usages :

passhport-admin usergroup list
passhport-admin usergroup search [<pattern>]
passhport-admin usergroup show [<name>]
passhport-admin usergroup create [(<name> [--comment=<comment>])]
passhport-admin usergroup edit [(<name> [--newname=<name>] [--newcomment=<comment>])]
passhport-admin usergroup (adduser | rmuser) [(<username> <usergroupname>)]
passhport-admin usergroup (addusergroup | rmusergroup) [(<subusergroupname> <usergroupname>)]
passhport-admin usergroup delete [([-f | --force] <name>)]
list

passhport-admin usergroup list affiche l'ensemble des usergroups configurées.

Exemple :

admin@bastion:~$ passhport-admin usergroup list
admins
database-admins
external
network-admins
admin@bastion:~$
show

passhport-admin usergroup show <NAME> affiche toutes les informations au sujet d'un usergroup nommé <NAME>.

Exemple :

admin@bastion:~$ passhport-admin usergroup show admins
Name: admins
Comment:
User list: john@compagny.com vincent@compagny.com
Usergroup list:
All users: john@compagny.com vincent@compagny.com
All usergroups:
admin@bastion:~$

Si aucun modèle (PATTERN), l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin usergroup show
Name: admins
Name: admins
Comment:
User list: john@compagny.com vincent@compagny.com
Usergroup list:
All users: john@compagny.com vincent@compagny.com
All usergroups:
admin@bastion:~$
create

passhport-admin usergroup create [((<name> [--comment=<comment>])] crée un nouveau usergroup.

Argument Description
<name> Nom de la usergroup à créer
--comment Commentaire concernant le usergroup (optionnel)

Exemple :

admin@bastion:~$ passhport-admin usergroup create external
OK: "external" -> created
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin usergroup delete database-admins
Name: database-admins
Comment:
User list:
Usergroup list:
All users:
All usergroups:
Are you sure you want to delete database-admins? [y/N] y
OK: "database-admins" -> deleted
admin@bastion:~$
edit

passhport-admin usergroup edit [(<name> [--newname=<name>] [--newcomment=<comment>])] édite un usergroup existant.

Argument Description
<name> Nom du usergroup à éditer
--newname Nouveau nom du usergroup que l'on souhaite renommer (optionnel)
--newcomment Nouveau commentaire concernant le usergroup (optionel)

Exemple :

admin@bastion:~$ passhport-admin usergroup edit admins --newname=linux-admins
OK: "admins" -> edited
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif. Un tableau montrant l'ensemble des paramètre de configuration est d'abord affiché, puis, ligne par ligne, chaque argument modifiable est affiché. L'utilisateur peut conserver chaque paramètre présenté au dessus en appuyant sur "Entrer". La seule exception est pour le champs "comment" : si l'utilisateur souhaite enlever le commentaire, il tape alors "Entrer", puis il lui sera demandé s'il veut supprimer le commentaire, ou non.

Exemple :

admin@bastion:~$ passhport-admin usergroup edit
Name of the usergroup you want to modify: external
Name: external
Comment:
User list:
Usergroup list:
All users:
All usergroups:
New name: external-admins
New comment:
Remove original comment? [y/N]
OK: "external" -> edited
admin@bastion:~$

Comme montré ci-dessus, seule l'entrée "New name" a été modifiée. Si une entrée est simplement remplie par "Entrer", la valeur précédente est conservée.

adduser

passhport-admin usergroup adduser [(<username> <usergroupname>)] ajoute un user dans un usergroup.

Argument Description
<username> Nom du user ajouter dans un usergroup
<usergroupname> Nom du usergroup dans lequel on ajoute l'utilisateur

Exemple :

admin@bastion:~$ passhport-admin usergroup adduser vincent@compagny.com network-admins
OK: "vincent@compagny.com" added to "network-admins"
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin usergroup adduser
Username: yann@ext-compagny.com
Usergroupname: external-admins
OK: "yann@ext-compagny.com" added to "external-admins"
admin@bastion:~$
rmuser

passhport-admin usergroup rmuser [(<username> <usergroupname>)] enlève un user d'un usergroup.

Argument Description
<username> Nom du user que l'on souhaite enlever d'un usergroup
<usergroupname> Nom du usergroup duquel on souhaite enlever le user

Exemple :

admin@bastion:~$ passhport-admin usergroup rmuser vincent@compagny.com linux-admins
OK: "vincent@compagny.com" removed from "linux-admins"
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin usergroup rmuser
Username: yann@ext-compagny.com
Usergroupname: external-admins
OK: "yann@ext-compagny.com" removed from "external-admins"
admin@bastion:~$
addusergroup

passhport-admin usergroup addusergroup [(<subusergroupname> <usergroupname>)] ajoute un usergroup dans un autre usergroup.

Argument Description
<subusergroupname> Nom du usergroup à ajouter dans un autre usergroup
<usergroupname> Nom du usergroup dans lequel on ajoute l'autre usergroup

Exemple :

admin@bastion:~$ passhport-admin usergroup addusergroup linux-admins admins
OK: "linux-admins" added to "admins"
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin usergroup addusergroup
Subusergroupname: network-admins
Usergroupname: admins
OK: "network-admins" added to "admins"
admin@bastion:~$
rmusergroup

passhport-admin usergroup delusergroup [(<usergroupname> <usergroupname>)] supprime un usergroup d'un autre usergroup.

Argument Description
<subusergroupname> Nom du usergroup que l'on souhaite enlever d'un autre usergroup
<usergroupname> Nom du usergroup duquel on souhaite enlever l'autre usergroup

Exemple :

admin@bastion:~$ passhport-admin usergroup rmusergroup linux-admins admins
OK: "linux-admins" removed from "admins"
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin usergroup rmusergroup
Subsergroupname: network-admins
Usergroupname: admins
OK: "network-admins" removed from "admins"
admin@bastion:~$
delete

passhport-admin usergroup delete [([-f | --force] <name>)] supprime un usergroup.

Argument Description
<name> Nom du usergroup à supprimer
-f ou --force Si utilisé, aucune confirmation ne sera demandé à l'utilisateur

Exemple :

admin@bastion:~$ passhport-admin usergroup delete network-admins
Name: network-admins
Comment:
User list: vincent@compagny.com
Usergroup list:
All users: vincent@compagny.com
All usergroups:
Are you sure you want to delete network-admins? [y/N] y
OK: "network-admins" -> deleted
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin usergroup delete
Name: linux-admins
Name: linux-admins
Comment:
User list: john@compagny.com
Usergroup list:
All users: john@compagny.com
All usergroups:
Are you sure you want to delete linux-admins? [y/N] y
OK: "network-admins" -> deleted
admin@bastion:~$

targetgroup

Usages :

passhport-admin targetgroup list
passhport-admin targetgroup search [<pattern>]
passhport-admin targetgroup show [<name>]
passhport-admin targetgroup create [(<name> [--comment=<comment>])]
passhport-admin targetgroup edit [(<name> [--newname=<name>] [--newcomment=<comment>])]
passhport-admin targetgroup (adduser | rmuser) [(<username> <targetgroupname>)]
passhport-admin targetgroup (addtarget | rmtarget) [(<targetname> <targetgroupname>)]
passhport-admin targetgroup (addusergroup | rmusergroup) [(<usergroupname> <targetgroupname>)]
passhport-admin targetgroup (addtargetgroup | rmtargetgroup) [(<subtargetgroupname> <targetgroupname>)]
passhport-admin targetgroup delete [([-f | --force] <name>)]
list

passhport-admin targetgroup list affiche l'ensemble des targetgroups configurées.

Exemple :

admin@bastion:~$ passhport-admin targetgroup list
linux-servers
network-appliances
phone-appliance
admin@bastion:~$
show

passhport-admin targetgroup show <NAME> affiche toutes les informations au sujet d'un targetgroup nommé <NAME>.

Exemple :

admin@bastion:~$ passhport-admin targetgroup show linux-servers
Name: linux-servers
Comment:
User list:
Target list: linux-7892 linux-7239 linux-1398
Usergroup list:
Targetgroup list:
All users:
All targets: linux-1398 linux-7239 linux-7892
All usergroups:
All targetgroups:
admin@bastion:~$

Si aucun modèle (PATTERN), l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin targetgroup show
Name: linux-servers
Name: linux-servers
Comment:
User list:
Target list: linux-7892 linux-7239 linux-1398
Usergroup list:
Targetgroup list:
All users:
All targets: linux-1398 linux-7239 linux-7892
All usergroups:
All targetgroups:
admin@bastion:~$
create

passhport-admin targetgroup create [((<name> [--comment=<comment>])] crée un nouveau targetgroup.

Argument Description
<name> Nom de la targetgroup à créer
--comment Commentaire concernant le targetgroup (optionnel)

Exemple :

admin@bastion:~$ passhport-admin targetgroup create linux-servers
OK: "linux-servers" -> created
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin targetgroup create
Name: phone-appliance
Comment: Phones and IPBX appliances group.
OK: "phone-appliance" -> created
admin@bastion:~$
edit

passhport-admin targetgroup edit [(<name> [--newname=<name>] [--newcomment=<comment>])] édite un targetgroup existant.

Argument Description
<name> Nom du targetgroup à éditer
--newname Nouveau nom de la targetgroup (optionnel)
--newcomment Nouveau commentaire concernant le targetgroup (optionnel)

Exemple :

admin@bastion:~$ passhport-admin targetgroup edit linux-servers --newcomment="Linux servers group."
OK: "linux-servers" -> edited
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif. Un tableau montrant l'ensemble des paramètre de configuration est d'abord affiché, puis, ligne par ligne, chaque argument modifiable est affiché. L'utilisateur peut conserver chaque paramètre présenté au dessus en appuyant sur "Entrer". La seule exception est pour le champs "comment" : si l'utilisateur souhaite enlever le commentaire, il tape alors "Entrer", puis il lui sera demandé s'il veut supprimer le commentaire, ou non.

Exemple :

admin@bastion:~$ passhport-admin targetgroup edit
Name of the targetgroup you want to modify: network-appliances
Name: network-appliances
Comment:
User list:
Target list:
Usergroup list:
Targetgroup list:
All users:
All targets:
All usergroups:
All targetgroups:
New name:
New comment: Network appliance group.
OK: "network-appliances" -> edited
admin@bastion:~$

Comme montré ci-dessus, seule l'entrée "New comment" a été modifié. Si une entrée est simplement rempli par "Entrer", la valeur précédent est conservée.

adduser

passhport-admin targetgroup adduser [(<username> <targetname>)] connecte un user directement à un targetgroup.

Argument Description
<username> Nom du user que l'on connecte directement au targetgroup
<targetname> Nom du targetgroup auquel on connecte directement un user

Exemple :

admin@bastion:~$ passhport-admin targetgroup adduser john@compagny.com linux-servers
OK: "john@compagny.com" added to "linux-servers"
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin targetgroup adduser
Username: vincent@compagny.com
Targetgroupname: network-appliances
OK: "vincent@compagny.com" added to "network-appliances"
admin@bastion:~$
rmuser

passhport-admin targetgroup rmuser [(<username> <targetname>)] supprime le lien direct entre un targetgroup et un user.

Argument Description
<username> Nom du user que l'on connecte directement au targetgroup
<targetname> Nom du targetgroup duquel on déconnecte un user

Exemple :

admin@bastion:~$ passhport-admin targetgroup rmuser vincent@compagny.com network-appliances
OK: "vincent@compagny.com" removed from "network-appliances"
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin targetgroup rmuser
Username: john@compagny.com
Targetgroupname: linux-servers
OK: "john@compagny.com" removed from "linux-servers"
admin@bastion:~$
addusergroup

passhport-admin targetgroup addusergroup [(<usergroupname> <targetname>)] connecte directement un targetgroup à un usergroup.

Argument Description
<usergroupname> Nom du usergroup à connecter directement à un targetgroup
<targetname> Nom du targetgroup auquel on connecte directement le usergroup

Exemple :

admin@bastion:~$ passhport-admin targetgroup addusergroup linux-admins linux-servers
OK: "linux-admins" added to "linux-servers"
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin targetgroup addusergroup
Usergroupname: network-admins
Targetgroupname: network-appliances
OK: "network-admins" added to "network-appliances"
admin@bastion:~$
rmusergroup

passhport-admin targetgroup delusergroup [(<usergroupname> <targetgroupname>)] supprime le lien direct entre un targetgroup et un usergroup.

Argument Description
<usergroupname> Nom du usergroup que l'on souhaite déconnecter du targetgroup
<targetname> Nom du targetgroup duquel on déconnecte un usergroup

Exemple :

admin@bastion:~$ passhport-admin targetgroup rmusergroup linux-admins linux-servers
OK: "linux-admins" removed from "linux-servers"
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin targetgroup rmusergroup
Usergroupname: network-admins
Targetgroupname: network-appliances
OK: "network-admins" removed from "network-appliances"
admin@bastion:~$
addtargetgroup

passhport-admin targetgroup addusergroup [(<subusergroupname> <targetgroupname>)] connecte directement un targetgroup à un autre targetgroup.

Argument Description
<subtargetgroupname> Nom du targetgroup à connecter directement à un autre targetgroup
<targetname> Nom du targetgroup à connecter directement à un autre targetgroup

Exemple :

admin@bastion:~$ passhport-admin targetgroup addtargetgroup linux-servers all-servers
OK: "linux-servers" added to "all-servers"
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin targetgroup addtargetgroup
Subtargetgroupname: network-appliances
Targetgroupname: all-servers
OK: "network-appliances" added to "all-servers"
admin@bastion:~$
rmtargetgroup

passhport-admin targetgroup deltargetgroup [(<subtargetgroupname> <targetgroupname>)] supprime le lien direct entre un targetgroup et un autre targetgroup.

Argument Description
<subtargetgroupname> Nom du targetgroup que l'on souhaite déconnecter d'un autre targetgroup
<targetname> Nom du targetgroup duquel on déconnecte l'autre targetgroup

Exemple :

admin@bastion:~$ passhport-admin targetgroup rmtargetgroup linux-servers all-servers
OK: "linux-servers" removed from "all-servers"
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin targetgroup rmtargetgroup
Subtargetgroupname: network-appliances
Targetgroupname: all-servers
OK: "network-appliances" removed from "all-servers"
admin@bastion:~$
delete

passhport-admin targetgroup delete [([-f | --force] <name>)] supprime une target.

Argument Description
<name> Nom du targetgroup à supprimer
-f ou --force Si utilisé, aucune confirmation ne sera demandé à l'utilisateur

Exemple :

admin@bastion:~$ passhport-admin targetgroup delete linux-servers
Name: linux-servers
Comment: Linux servers group.
User list:
Target list: linux-7892 linux-7239 linux-1398
Usergroup list:
Targetgroup list:
All users:
All targets: linux-1398 linux-7239 linux-7892
All usergroups:
All targetgroups:
Are you sure you want to delete linux-servers? [y/N] y
OK: "linux-servers" -> deleted
admin@bastion:~$

Si aucun argument n'est donné, l'utilisateur entre en mode interactif.

Exemple :

admin@bastion:~$ passhport-admin targetgroup delete
Name: network-appliances
Name: network-appliances
Comment: Network appliance group.
User list:
Target list:
Usergroup list:
Targetgroup list:
All users:
All targets:
All usergroups:
All targetgroups:
Are you sure you want to delete network-appliances? [y/N] y
OK: "linux-servers" -> deleted
admin@bastion:~$

User-side usage

This chapter shows how to connect to a target, through PaSSHport, from key generation, to SCP.

Generate private keys

On Windows :

To generate the private key that you'll give to your PaSSHport admin, use puttygen that you can download from here (search for puttygen.exe).

Start puttygen, and on the main windows, select the type of key you want to generate (1), the key length (2), then click Generate button (3). Here, we selected RSA and a key length of 4096 (2048 is a considered as a minimum for RSA) :

_images/doc-passhport-puttygen-0.png

Move your mouse in the blank space, until the key is generated :

_images/doc-passhport-puttygen-1.png

Once generated, insert a comment (1), a strong passphrase (2), then save your private key (3).

_images/doc-passhport-puttygen-2.png

You now have to send your RSA public key to your PaSSHport admin. Select your public key as shown in this screen capture, and copy/paste it into a mail to your PaSSHport admin :

_images/doc-passhport-puttygen-3.png

You now have to wait until your PaSSHport admin add your key to your account into PaSSHport.

On Linux / Unix :

Simply open a terminal, and use the ssh-keygen command. Here we generate à 4096bits length RSA key :

user@host:~$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Created directory '/home/user/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:1r28XcYMIclivAHSSqmzH5Dh1LJ+IMsQMhl2Ds1HtXQ user@passhport-debian9-dev
The key's randomart image is:
+---[RSA 4096]----+
|.=o..oo=.E       |
|* +o+.=.+o . .   |
|.o +.B o  = + .  |
|. . O .  o = . . |
| o + =  S o . .  |
|  o o o.   . . + |
|     o .    o   =|
|      .      o o |
|            . .  |
+----[SHA256]-----+
user@host:~$

Display your newly created public key :

user@host:~$ cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDmcmVG6uGW3BvOkHN7M7ubITihVwL9glc7jilZvzgDJL4CzCXG2VwjdxHaCBfW82HsgoUcwqKm1gMfYv/TEZw/tgUWSSo7TOmldFmEs4TmZc9n0lhCgGT/XtShqtwyYAxeAw419Uc+L/unXKPRtulLjNqdp62GW68CTQ7GzJosDWLYWZfNrhRoMvw6K6j/vLbVcoktY+RNoNdFjYhgPcKzP0p73pvlh9uIKohBkh3vh5pOfVEu6L9J4VvjM3dACScPJORG05N7MB4rJ3FpSy9fgfMwaT99Xm7/IVKXZxoUjB9z2EBkKYK+Hlj5Oopwgas6AvcrJIdZo1tsbdUYqcbQKoX7TeSwjbxESygFuCLMgs4SuMy8/1+pPIlJQY7XzdCCDzkEp/s12Ca5xPSUpFGdWKKIf1jzZzjS5BeUzm63ldFoN+HHKuU7FRpPNSXrlWNkqkwHnpa1SbhT3yOlu6BdnxMcaRNAeQ+cfxyykUSdoPQWBiJ9QSd796PgMSJG135ZrZrBj86l7FbKHnnSbfcwoRaaejsaD9Pj0KuZ9l9Aiy69pobkAvzm4oCeORjIVeQo1k8mFPVPli9C5yM7iQzYahJDP9SGG4sZPsONFVsm2cugVqT3jaYBBQH5PWsZJN46mz6vqzkPTYO/toXNiXpyhrg3RT35Pj96cx7nwg9CrQ== user@passhport-debian9-dev
user@host:~$

And send this content to your PaSSHport admin. You now have to wait until your PaSSHport admin add your key to your account into PaSSHport.

Connect to PaSSHport

On Windows

You can use Putty to connect to the passhport bastion indicating your private key.

On Linux / *nix

Use your standard SSH client and connect to the bastion as passhport user: .. code-block:: none

If you want to be directly connected, you have to specify the target name in the command AND to activate the -t option: .. code-block:: none

ssh -t passhport@bastion.tld targetname

If you want to launch a command directly, you can use the same syntax adding the command at the end .. code-block:: none

ssh -t passhport@bastion.tld targetname cat /proc/cpuinfo

scp through PaSSHport

Using CLI

To use SCP throug PaSSHport, use one of the following syntax...

From target to local :

$ scp passhport@my-passhport-server:TARGET_NAME//etc/fstab /tmp/.

From local to target :

$ scp /etc/passwd passhport@my-passhport-server:TARGET_NAME//tmp/.

For Windows, you have to consider using "pscp" command. You can find it here: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html Be aware that you will need a private key file in "ppk" format. You can use puttygen to generate one or converrt your current private key. Pscp command tries to use SFTP protocol leading to this error:

FATAL ERROR: Received unexpected end-of-file from server

In order to use pscp with PaSSHport, consider using this syntax including "-scp" flag:

pscp -scp -i "C:\path\to\sshkeys\my_private_key.ppk"  "C:\path\to\file\totransfer.txt" passhport@my-passhport-server:TARGET_NAME//pah/to/copy

Quelques liens :