8
0
Fork 0
mirror of https://gitlab.federez.net/re2o/re2o synced 2024-07-04 13:14:06 +00:00

Merge branch 'commentaires' into 'master'

Commentaires

See merge request federez/re2o!67
This commit is contained in:
chirac 2018-01-21 20:15:24 +01:00
commit 891014babd
3 changed files with 74 additions and 18 deletions

View file

@ -28,14 +28,22 @@ setup_ldap() {
install_re2o_server() { install_re2o_server() {
echo "Installation de Re2o !
Cet utilitaire va procéder à l'installation initiale de re2o. Le serveur présent doit être vierge.
Preconfiguration..."
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
apt-get -y install sudo dialog apt-get -y install sudo dialog
HEIGHT=15
WIDTH=40
init=$(dialog --clear \
--title "Installation de Re2o !" \
--msgbox "Cet utilitaire va procéder à l'installation initiale de re2o. Le serveur présent doit être vierge de préférence. Preconfiguration..." \
$HEIGHT $WIDTH \
2>&1 >/dev/tty)
HEIGHT=15 HEIGHT=15
WIDTH=40 WIDTH=40
CHOICE_HEIGHT=4 CHOICE_HEIGHT=4
@ -145,7 +153,14 @@ ldap_is_local=$(dialog --clear \
"${OPTIONS[@]}" \ "${OPTIONS[@]}" \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
echo "Vous devrez fournir un login/host dans le cas où le ldap est non local"
HEIGHT=15
WIDTH=40
instal_ldap=$(dialog --clear \
--title "Installation de Re2o !" \
--msgbox "Vous devrez fournir un login/host dans le cas où le ldap est non local" \
$HEIGHT $WIDTH \
2>&1 >/dev/tty)
TITLE="Mot de passe ldap" TITLE="Mot de passe ldap"
ldap_password=$(dialog --title "$TITLE" \ ldap_password=$(dialog --title "$TITLE" \
@ -213,8 +228,14 @@ ldap_cn+=$ldap_dn
ldap_host="localhost" ldap_host="localhost"
fi fi
HEIGHT=15
WIDTH=40
install_base=$(dialog --clear \
--title "Installation de Re2o !" \
--msgbox "Installation des paquets de base" \
$HEIGHT $WIDTH \
2>&1 >/dev/tty)
echo "Installation des paquets de base"
apt-get -y install python3-django python3-dateutil texlive-latex-base texlive-fonts-recommended python3-djangorestframework python3-django-reversion python3-pip libsasl2-dev libldap2-dev libssl-dev apt-get -y install python3-django python3-dateutil texlive-latex-base texlive-fonts-recommended python3-djangorestframework python3-django-reversion python3-pip libsasl2-dev libldap2-dev libssl-dev
pip3 install django-bootstrap3 pip3 install django-bootstrap3
pip3 install django-ldapdb pip3 install django-ldapdb
@ -270,8 +291,14 @@ then
setup_ldap $ldap_password $ldap_dn setup_ldap $ldap_password $ldap_dn
else else
echo "Vous devrez manuellement effectuer les opérations de setup de la base ldap sur le serveurs distant.
Lancez la commande : ./install_re2o.sh ldap $ldap_password $ldap_dn" HEIGHT=15
WIDTH=40
ldap_setup=$(dialog --clear \
--title "Setup ldap" \
--msgbox "Vous devrez manuellement effectuer les opérations de setup de la base ldap sur le serveurs distant. Lancez la commande : ./install_re2o.sh ldap $ldap_password $ldap_dn" \
$HEIGHT $WIDTH \
2>&1 >/dev/tty)
fi fi
echo "Ecriture de settings_local" echo "Ecriture de settings_local"
@ -298,10 +325,22 @@ sed -i 's/example.org/'"$extension_locale"'/g' re2o/settings_local.py
sed -i 's/MY_EMAIL_HOST/'"$email_host"'/g' re2o/settings_local.py sed -i 's/MY_EMAIL_HOST/'"$email_host"'/g' re2o/settings_local.py
sed -i 's/MY_EMAIL_PORT/'"$email_port"'/g' re2o/settings_local.py sed -i 's/MY_EMAIL_PORT/'"$email_port"'/g' re2o/settings_local.py
echo "Application des migrations" HEIGHT=15
WIDTH=40
migrations=$(dialog --clear \
--title "Setup django" \
--msgbox "Application des migrations" \
$HEIGHT $WIDTH \
2>&1 >/dev/tty)
python3 manage.py migrate python3 manage.py migrate
echo "Collecte des statics" HEIGHT=15
WIDTH=40
static=$(dialog --clear \
--title "Setup django" \
--msgbox "Collecte des statiques" \
$HEIGHT $WIDTH \
2>&1 >/dev/tty)
python3 manage.py collectstatic python3 manage.py collectstatic
BACKTITLE="Fin de l'installation" BACKTITLE="Fin de l'installation"
@ -319,7 +358,7 @@ web_serveur=$(dialog --clear \
clear clear
TITLE="Url où servir le serveur web (ex : re2o.example.org)" TITLE="Url où servir le serveur web (ex : re2o.example.org). Assurez-vous que ce tld existe bien et répond auprès du DNS"
url_server=$(dialog --title "$TITLE" \ url_server=$(dialog --title "$TITLE" \
--backtitle "$BACKTITLE" \ --backtitle "$BACKTITLE" \
--inputbox "$TITLE" $HEIGHT $WIDTH \ --inputbox "$TITLE" $HEIGHT $WIDTH \
@ -365,11 +404,25 @@ sed -i 's|PATH|'"$current_path"'|g' /etc/apache2/sites-available/re2o.conf
a2ensite re2o a2ensite re2o
service apache2 reload service apache2 reload
else else
echo "Nginx non supporté, vous devrez installer manuellement" HEIGHT=15
WIDTH=40
web_server=$(dialog --clear \
--title "Setup serveur web" \
--msgbox "Nginx non supporté, vous devrez installer manuellement" \
$HEIGHT $WIDTH \
2>&1 >/dev/tty)
fi fi
python3 manage.py createsuperuser python3 manage.py createsuperuser
HEIGHT=15
WIDTH=40
end=$(dialog --clear \
--title "Installation terminée" \
--msgbox "Vous pouvez à présent vous rendre sur $url_server, et vous connecter. Votre utilisateur dispose des privilèges superuser" \
$HEIGHT $WIDTH \
2>&1 >/dev/tty)
} }
main_function() { main_function() {

View file

@ -53,12 +53,12 @@ DATABASES = {
} }
} }
# Security settings # Security settings, à activer une fois https en place
SECURE_CONTENT_TYPE_NOSNIFF = True SECURE_CONTENT_TYPE_NOSNIFF = False
SECURE_BROWSER_XSS_FILTER = True SECURE_BROWSER_XSS_FILTER = False
SESSION_COOKIE_SECURE = True SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = True CSRF_COOKIE_SECURE = False
CSRF_COOKIE_HTTPONLY = True CSRF_COOKIE_HTTPONLY = False
X_FRAME_OPTIONS = 'DENY' X_FRAME_OPTIONS = 'DENY'
SESSION_COOKIE_AGE = 60 * 60 * 3 SESSION_COOKIE_AGE = 60 * 60 * 3

View file

@ -143,9 +143,10 @@ class UserManager(BaseUserManager):
if not linux_user_check(pseudo): if not linux_user_check(pseudo):
raise ValueError('Username shall only contain [a-z0-9-]') raise ValueError('Username shall only contain [a-z0-9-]')
user = self.model( user = Adherent(
pseudo=pseudo, pseudo=pseudo,
surname=surname, surname=surname,
name=surname,
email=self.normalize_email(email), email=self.normalize_email(email),
) )
@ -824,6 +825,8 @@ class Adherent(User):
null=True null=True
) )
def get_instance(adherentid, *args, **kwargs): def get_instance(adherentid, *args, **kwargs):
"""Try to find an instance of `Adherent` with the given id. """Try to find an instance of `Adherent` with the given id.