Ldap config

Former-commit-id: cb3c99de60
This commit is contained in:
Elie 2014-08-12 21:21:47 -04:00
parent c9bb0d708a
commit 32cb33d553
4 changed files with 35 additions and 17 deletions

View file

@ -5,11 +5,12 @@ location PATHTOCHANGE {
}
client_max_body_size 10G;
fastcgi_pass 127.0.0.1:SEAHUB_PORT;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
@ -20,6 +21,8 @@ location PATHTOCHANGE {
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS on;
access_log /var/log/nginx/seahub.access.log;
error_log /var/log/nginx/seahub.error.log;
}
location ~* ^PATHTOCHANGE/media/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt|woff|ttf))$ {

View file

@ -38,20 +38,12 @@
"default": "Seafile"
},
{
"name": "admin_email",
"name": "admin",
"ask": {
"en": "Choose an email"
"en": "Choose a user"
},
"example": "admin@domain.com",
"default": "admin@domain.com"
},
{
"name": "admin_password",
"ask": {
"en": "Choose a password"
},
"example": "123456",
"default": "123456"
"example": "homer",
"default": "elie"
}
]
}

View file

@ -2,8 +2,8 @@
domain=$1
path=$2
server_name=$3
admin_email=$4
admin_password=$5
admin=$4
admin_password=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
final_path=/var/www/seafile
seafile_data=$final_path/seafile-data
seafile_version=3.1.1
@ -14,6 +14,14 @@ if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Check if admin exists
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
if [[ ! $? -eq 0 ]]; then
echo "Wrong admin"
exit 1
fi
sudo yunohost app setting seafile admin -v $admin
# Check dependencies
sudo apt-get install -y python2.7 python-setuptools python-simplejson python-imaging python-mysqldb sqlite3
@ -48,7 +56,7 @@ sed -i "s@CCNET_PORT@$ccnet_port@g" ../sources/setup-seafile.sh
sed -i "s@SEAFILE_DATA@$seafile_data@g" ../sources/setup-seafile.sh
sed -i "s@SEAFILE_PORT@$seafile_port@g" ../sources/setup-seafile.sh
sed -i "s@SEAFILE_FILESERVER_PORT@$seafile_fileserver_port@g" ../sources/setup-seafile.sh
sed -i "s/ADMIN_EMAIL/$admin_email/g" ../sources/check_init_admin.py
sed -i "s/ADMIN_EMAIL/$admin/g" ../sources/check_init_admin.py
sed -i "s/ADMIN_PASSWORD/$admin_password/g" ../sources/check_init_admin.py
# Run install script
@ -64,6 +72,13 @@ echo 'MEDIA_URL = "'$path'/media/"' | sudo tee -a $final_path/seahub_settings.py
echo 'SITE_ROOT = "'$path'/"' | sudo tee -a $final_path/seahub_settings.py
echo 'FILE_SERVER_ROOT = "http://'$domain$path'"' | sudo tee -a $final_path/seahub_settings.py
# LDAP configuration
echo '[LDAP]' | sudo tee -a $final_path/ccnet/ccnet.conf
echo 'HOST = ldap://localhost:389' | sudo tee -a $final_path/ccnet/ccnet.conf
echo 'BASE = ou=users,dc=yunohost,dc=org' | sudo tee -a $final_path/ccnet/ccnet.conf
echo 'LOGIN_ATTR = uid' | sudo tee -a $final_path/ccnet/ccnet.conf
# Symlink for media ( because only $path is accessible, not /seahub )
sudo ln -s $final_path/seafile-server-$seafile_version/seahub/media/ $final_path/seafile-server-$seafile_version/seafile/media
@ -91,3 +106,8 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/seafile.conf
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app ssowatconf
# Open port
#sudo yunohost firewall allow $ccnet_port
#sudo yunohost firewall allow $seafile_port

View file

@ -8,4 +8,7 @@ sudo ./seahub.sh stop
sudo rm -rf /var/www/seafile
sudo rm -f /etc/nginx/conf.d/$domain.d/seafile.conf
sudo rm -f /etc/init.d/seafile-server
sudo rm -f /etc/init/seafile-server.conf
sudo rm -f /etc/init/seafile-server.conf
#sudo yunohost firewall deny $ccnet_port
#sudo yunohost firewall deny $seafile_port