Post

my_webapp

my_webapp

2017-04-30-my_webapp

Custom Webapp (my_webapp)

Cette application vous permet d’installer facilement une application Web personnalisée, fournissant des fichiers accès avec SFTP.
Il peut également créer une base de données MySQL - qui sera sauvegardée et restaurée avec votre application.
Les détails de connexion seront stockés dans le db_accesss.txt de fichier situé dans le répertoire racine.

Une fois installé, aller à l’URL choisie pour connaître l’utilisateur, le domaine et le port, vous aurez à utiliser pour l’accès SFTP - le mot de passe est celui que vous donnez à l’installation.
Sous le répertoire Web, vous verrez un dossier www qui est public. Vous pouvez mettre tous les fichiers de votre application Web personnalisée à l’intérieur.

Installation
sudo -s
yunohost app install https://github.com/YunoHost-Apps/my_webapp_ynh

1
2
3
4
5
6
7
Choisissez un domaine pour votre Webapp : ouestline.net
Choisissez un chemin pour votre Webapp (default: /site) : 
Définissez le mot de passe pour l'accès SFTP : 
Est-ce un site public ? [0 | 1] (default: 1) : 
Avez-vous besoin d'une base de données MySQL ? [0 | 1] (default: 0) : 1
Succès ! La configuration de SSOwat a été générée
Succès ! Installation terminée

Site publique https://ouestline.net/site/ avec base de données Mysql et accès SFTP (ouestline.net, port : 55022, Utilisateur : webapp1 ,Mot de passe : gu5xwvqCtF )

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
root@yunoyan:/home/yann# ls -la /var/www/my_webapp/
total 16
drwxr-xr-x  3 root    root     4096 sept. 29 14:02 .
drwxr-xr-x 15 root    root     4096 sept. 29 14:02 ..
-rw-r--r--  1 webapp1 www-data   80 sept. 29 14:02 db_access.txt
drwxr-xr-x  2 webapp1 www-data 4096 sept. 29 14:02 www
root@yunoyan:/home/yann# ls -la /var/www/my_webapp/www/
total 12
drwxr-xr-x 2 webapp1 www-data 4096 sept. 29 14:02 .
drwxr-xr-x 3 root    root     4096 sept. 29 14:02 ..
-rw-r--r-- 1 webapp1 www-data  914 sept. 29 14:02 index.html
root@yunoyan:/home/yann# cat /var/www/my_webapp/db_access.txt 
# MySQL Database
name: my_webapp
user: my_webapp
pass: EmSj4JhrGUR4NqOjo3xs5uHg
root@yunoyan:/home/yann# 


#Ajout au fichier /etc/ssh/sshd_config 
##-> my_webapp
# Hardening user connection
Match User webapp1
  ChrootDirectory %h
  ForceCommand internal-sftp
  AllowTcpForwarding no
  PermitTunnel no
  X11Forwarding no
##<- my_webapp

et modifier  
AuthorizedKeysFile      /home/yann/.ssh/authorized_keys

chmod g+r /home/yann/.ssh/authorized_keys

usermod -a -G yann webapp1

Pour accéder au dossier , il faut créer un dossier .ssh  
sudo mkdir /var/www/my_webapp/.ssh  
Dupliquer la clé publique autorisée  
sudo cp /home/yann/.ssh/authorized_keys /var/www/my_webapp/.ssh/authorized_keys2  
Relancer ssh  
sudo systemctl restart ssh

Cet article est sous licence CC BY 4.0 par l'auteur.