2592000
true
true
Mass import users
Create a json file containing, for example (password is dkPK62wdofPEK56-_&SO) :
{
"realm": "master",
"users" : [
{
"username" : "test1",
"email" : "test1@mail.ext",
"firstName" : "Toto1",
"lastName" : "Titi1",
"enabled" : true,
"emailVerified" : true,
"credentials" : [ {
"type" : "password",
"hashedSaltedValue" : "IhS5rpj4PV20PURXYtQktPAYDbI5ATQdafxquCWs1mKwJtuvxhW2DQ0QGNuaQV42MXLSkrLeAyjf4UzlIxm04g==",
"salt" : "wue854XfHBduqKFcgm9tNQ==",
"hashIterations" : 100000,
"algorithm" : "pbkdf2-sha256"
} ],
"realmRoles" : [ "offline_access", "uma_authorization" ]
},
{
"username" : "test2",
"email" : "test2@mail.ext",
"firstName" : "Toto2",
"lastName" : "Titi2",
"enabled" : true,
"emailVerified" : true,
"credentials" : [ {
"type" : "password",
"hashedSaltedValue" : "IhS5rpj4PV20PURXYtQktPAYDbI5ATQdafxquCWs1mKwJtuvxhW2DQ0QGNuaQV42MXLSkrLeAyjf4UzlIxm04g==",
"salt" : "wue854XfHBduqKFcgm9tNQ==",
"hashIterations" : 100000,
"algorithm" : "pbkdf2-sha256"
} ],
"realmRoles" : [ "offline_access", "uma_authorization" ]
}
]
}
And import it in the admin user interface (Manage -> Import)
Create a new client
Infos : https://domain.ext:8443/auth/realms/master/.well-known/openid-configuration
More info :
https://www.infoq.com/fr/articles/introduction-openid-connect
http://www.keycloak.org/docs-api/3.2/rest-api/
The Reaml X.509 Certificate can be found in Realm settings -> Keys -> Certificate
Logout URL : https://domain.ext:8443/auth/realms/master/protocol/openid-connect/logout?redirect_uri=encodedURL
OpenId Connect
Client Protocol : openid-connect
Access Type : confidential
Standard Flow Enabled : ON
Implicit Flow Enabled : OFF
Direct Access Grants Enabled : ON
Service Accounts Enabled : OFF
Authorization Enabled : OFF
Root URL : htts://domain.ext
Valid Redirect URIs : htts://domain.ext/*
Fine Grain OpenID Connect Configuration :
User Info Signed Response Algorithm : unsigned
Request Object Signature Algorithm : any
Wordpress OpenID Connect Login
Create an OpenId Connect client
Install OpenId Connect Generic plugin
Configure :
copy/paste the examples (For "OpenID Scope" (more info here)
for the URLs : https://domain.ext:8443/auth/realms/master/.well-known/openid-configuration (Login Endpoint URL = .../auth)
check "Identify with User Name, "Link Existing Users", "Redirect Back to Origin Page" and "Alternate Redirect URI"
for "Identity Key" : if you connect with a username, use preferred_username otherwise use Keyclok id : sub for the Identity Key
Go to "Settings" -> "Permalinks" and save again the configuration (even if no changes)
Add the button : [openid_connect_generic_login_button]
In openid-connect-generic-client-wrapper.php : replace the pattern of preg_replace by '/[^a-zA-Z\-\_0-9]/'
In openid-connect-generic-login-form.php : replace Login with OpenID Connect by Login / Sign up
in openid-connect-generic-client.php :
remove all the if after // check the client request state
replace : $id_token_claim = json_decode( base64_decode( $tmp[1] ), TRUE ); by :
$id_token_claim = json_decode(
base64_decode(
str_replace( // because token is encoded in base64 URL (and not just base64)
array('-', '_'),
array('+', '/'),
$tmp[1]
)
)
, TRUE
);
If doesn't work because of "cURL connection refused" see this workaround
If you want users to connect to Wordpress throw an iframe, add this in the theme function.php :
// Allow to connect from an iframe
remove_action( 'login_init', 'send_frame_options_header' );
remove_action( 'admin_init', 'send_frame_options_header' );
Wordpress SAML OneLogin plugin
Change "master" with your Realm name if different, and 8443 with your custom port if different
In OneLogin settings :
IdP Identity id : https://URL:8443/auth/realms/master
Single Sign On Service Url : https://URL:8443/auth/realms/master/protocol/saml
X.509 Certificate : Keycloak -> Realm settings -> Keys -> Certificate
ATTRIBUTE MAPPING :
Username : username
E-mail : email
First Name : first_name
Last Name : last_name
Role : Role
ROLE PRECEDENCE : Administrator : 1, Editor : 2, etc.
Service Provider Entity Id : Keycloak -> Client -> Client ID
Sign AuthnRequest : Checked
Sign LogoutRequest : Checked
Sign LogoutResponse : Checked
NameIDFormat : ... SAML:2.0 ... persistent
Service Provider X.509 Certificate & Service Provider Private Key : put a temporary cerficificate
Signature Algorithm & Digest Algorithm: RSA_SHA256
Click on "Go to the metadata of this SP" (top right) : download in a XML file
In KeyCloak : add a new client
Select file : the XML file and save
If you need to configure manually :
Client Id : give any custom name
Save
Client protocol : SAML
Include AuthnStatement : ON
Sign Documents : ON
Signature Algorithm : RSA_SHA256
Canonicalization Method : EXCLUSIVE
Client Signature Required : ON
Force POST Binding : ON
Front Channel Logout : ON
Name ID Format : persistent
Valid Redirect URIs : https://wordpress_URL/wp-login.php?saml_acs
Fine Grain SAML Endpoint Configuration :
Assertion Consumer Service POST Binding URL : https://wordpress_URL/wp-login.php?saml_acs
Logout Service Redirect Binding URL : https://wordpress_URL/wp-login.php?saml_sls
Tab Mappers
Roles list -> edit :
Role attribute name : Role
SAML Attribute NameFormat : unspecified
Single Role Attribute : ON
Create :
Name : username
Mapper Type : User Property
Property : username
Friendly Name : username
SAML Attribute Name : username
SAML Attribute NameFormat : unspecified
Create again for : email, first_name, last_name
Keycloak -> Client -> Client Id -> SAML Keys -> Generate new keys
Copy values in Onelogin plugin -> Service Provider X.509 Certificate & Service Provider Private Key
OpenID-Connect-PHP
OpenID-Connect-PHP GitHub repository
It's a simple library that allows an application to authenticate a user through the basic OpenID Connect flow.
Install :
composer require jumbojett/openid-connect-php
Create a test script test.php
authenticate();
$userInfo = $oidc->requestUserInfo();
$name = $userInfo->preferred_username; // see KeyCloak client Mappers tab (field "Token Claim Name")
?>
Example OpenID Connect Client Use
Yii2 OpenIdConnect
Install
Source
composer require --prefer-dist yiisoft/yii2-authclient "~2.1.0"
Edit config/web.php and add in 'compenents' :
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'YourName' => [
'class' => 'yii\authclient\clients\Keycloak',
'issuerUrl' => 'https://domain.ext:8443/auth/realms/master',
'clientId' => 'KeycloakClientId',
'clientSecret' => '*************',
],
],
],
Start
Source
Open the file controllers/SiteController.php, add use app\components\AuthHandler; at the beginning of the file, and theses 2 functions inside class SiteController extends Controller :
public function actions()
{
return [
'auth' => [
'class' => 'yii\authclient\AuthAction',
'successCallback' => [$this, 'onAuthSuccess'],
],
];
}
public function onAuthSuccess($client)
{
(new AuthHandler($client))->handle();
}
The class class AuthHandler must be in components/AuthHandler.php (create components folder if not exist) and create the file AuthHandler.php containing the implementation describe here
Add the widget in a view file (eg. views/site/login.php) :
= yii\authclient\widgets\AuthChoice::widget([
'baseAuthUrl' => ['site/auth'],
'popupMode' => false,
]) ?>
Install OpenId Connect
Source
sudo apt update;
sudo apt install libgmp-dev php-gmp;
sudo service apache2 reload;
composer require --prefer-dist "spomky-labs/jose:~5.0.6"
The class OpenIdConnect extends OAuth2 See OpenId Connect specifications
Create the Auth.php file if not exist
nano models/Auth.php :
255]
];
}
public function attributeLabels()
{
return [
'id' => 'ID',
'user_id' => 'User ID',
'source' => 'Source',
'source_id' => 'Source ID',
];
}
public function getUser()
{
return $this->hasOne(User::className(), ['id' => 'user_id']);
}
}
Create a Keycloak client
Create the file vendor/yiisoft/yii2-authclient/clients/Keycloak.php containing :
getData();
$data['Authorization'] = 'Bearer ' . $accessToken->getToken();
$request->setHeaders($data);
}
protected function defaultName()
{
return 'keycloak';
}
protected function defaultTitle()
{
return 'Centralized authentification';
}
}
Debug
vendor/yiisoft/yii2-authclient/OpenIdConnect.php
At the end of function requestTokens($code) :
$return = parent::fetchAccessToken($authCode, $params);
file_put_contents("/var/www/test.make.social/public_html/test.txt", serialize($return));
return $return;
cat /var/www/test.make.social/public_html/test.txt
Copy and paste the token (just after access_token";s:1746:") in https://jwt.io/
Node.Js with Oauth2
https://adodson.com/hello.js
Symfony OpenIdConnect
Install Symfony 2.8 demo
Install OpenId Connect Relying Party Bundle but replace "gree/jose": "0.1.7" with "gree/jose" : "~2.0"
Example of config for :
base_url: "https://sso-synfony.marc.fun"
client_id: "sso-symfony-marc-fun" #OpenID Connect client id given by the OpenId Connect Provider
client_secret: "xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxx" #OpenID Connect client secret given by the OpenId Connect Provider
issuer: "https://login.lescommuns.org:8443/auth/realms/master/protocol/openid-connect" #URL of the OpenID Connect Provider
endpoints_url: #Part of the URL of the OpenID Connect Provider
authorization: "/auth"
token: "/token"
userinfo: "/userinfo"
logout: "/logout"
display: "page" #How the authentication form will be display to the enduser
scope: "email profile openid offline_access" #List of the scope you need
authentication_ttl: 300 #Maximum age of the authentication
token_ttl: 300 #Maximum age for tokenID
jwk_url: "https://login.lescommuns.org:8443/auth/realms/master/protocol/openid-connect/certs" #URL to the Json Web Key of OpenID Connect Provider
jwk_cache_ttl: 86400 #Validity periods in second where the JWK store in cache is valid
enabled_state: true #Enable the use of the state value. This is useful for mitigate replay attack
enabled_nonce: true #Enable the use of the nonce value. This is useful for mitigate replay attack
enduserinfo_request_method: "POST" #Define the method (POST, GET) used to request the Enduserinfo Endpoint of the OIDC Provider
redirect_after_logout: "https://sso-synfony.marc.fun" #URI or route name used for redirect user after a logout
Edit vendor/waldo/openid-connect-relying-party-bundle/Waldo/OpenIdConnect/RelyingPartyBundle/OpenIdConnect/Constraint/IDTokenValidator.php and comment $this->errors[] = "Issuer are not the same"; because Keycloak return "https://login.lescommuns.org:8443/auth/realms/master" and the script is comparing to the value of the issuer in config.yml wich is "https://login.lescommuns.org:8443/auth/realms/master/protocol/openid-connect"
To show the result of SSO, edit vendor/waldo/openid-connect-relying-party-bundle/Waldo/OpenIdConnect/RelyingPartyBundle/OpenIdConnect/ResourceOwner/AbstractGenericOICResourceOwner.php and after $oicToken->setRawTokenData($content); add :
echo ''; print_r($content); echo '
'; exit;
The logout URL is Logout
Upgrading
https://www.keycloak.org/docs/latest/release_notes/ https://www.keycloak.org/docs/latest/upgrading
Prepare an other instance of Keycloak (see above), including Widfly and MySQL adaptors. Do not add users.
Copy database (to a new one), standalone directory (update standalone.xml with new database name) and custom theme from the old Keycloak.
Stop the old server to avoid ports conflicts.
When the new server is lunched, standalone.xml file and database are - automatically updated for the new version.
Links to explore
http://blog.keycloak.org/2015/04/running-keycloak-cluster-with-docker.html
http://rhelblog.redhat.com/2016/03/22/red-hat-federation-story-ipsilon-keycloak-a-clash-of-the-titans/
http://rhelblog.redhat.com/2016/04/26/why-use-sssd-instead-of-a-direct-ldap-configuration-for-applications/
https://keycloak.gitbooks.io/server-adminstration-guide/content/topics/user-federation/sssd.html
https://keycloak.gitbooks.io/securing-client-applications-guide/content/topics/oidc/javascript-adapter.html
https://github.com/keycloak/keycloak-js-bower
https://keycloak.gitbooks.io/securing-client-applications-guide/content/topics/oidc/nodejs-adapter.html
https://github.com/keycloak/keycloak-nodejs-connect
https://github.com/keycloak/keycloak-nodejs-auth-utils
http://blog.keycloak.org/2015/08/improved-ldap-integration-with-keycloak.html
http://keycloak-user.88327.x6.nabble.com/keycloak-user-Create-user-from-keycloak-UI-with-FreeIPA-backend-td1653.html
CodiMD
Install and configuration of HackMd
Based on node.js
Installation with docker
Pre-requisites
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
sudo apt install docker-compose
Installing docker
sudo su
mkdir /var/www/docker
cd /var/www/docker
git clone https://github.com/hackmdio/docker-hackmd.git
cd docker-hackmd
docker-compose up
Configuring reverse proxy with apache :
ProxyPass / http://83.166.144.90:3000/
ProxyPassReverse / http://83.166.144.90:3000/
ProxyRequests Off
ProxyPreserveHost Off
Launch at machine startup
sudo nano /etc/rc.local
Add this line :
docker-compose -f /var/www/docker/docker-hackmd/docker-compose.yml up &
In short, my unsuccessful attempt to install without docker
To complete this notice : https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04 And replace everything that is nvm install 6.0.0 then with 6.11.1 (not the latest version)
su ubuntu cd /var/www/wiki.communecter.org
git clone https://github.com/hackmdio/hackmd.git cd hackmd
sudo npm install -g node-gyp; sudo npm link node-gyp sudo npm install -g webpack; sudo npm link webpack sudo npm install -g common-chunks-webpack-plugin; sudo npm link common-chunks-webpack-plugin sudo npm install -g extract-text-webpack-plugin; sudo npm link extract-text-webpack-plugin sudo npm install -g i18n-webpack-plugin; sudo npm link i18n-webpack-plugin sudo npm install -g compression-webpack-plugin; sudo npm link compression-webpack-plugin sudo npm install -g html-webpack-plugin; sudo npm link html-webpack-plugin sudo npm install -g copy-webpack-plugin; sudo npm link copy-webpack-plugin
sudo ./bin/setup
nano config.json "domain": "test.make.social", "db": { "username": "hackmd", "password": "NSx^1SeT@byuTfYoOXBd", "database": "hackmd", "host": "localhost", "port": "3306", "dialect": "mysql"
NODE_ENV=production HMD_PROTOCOL_USESSL=true DEBUG=false HMD_ALLOW_ORIGIN=localhost,wiki.communecter.org,test.make.social HMD_DB_URL=mysql://localhost:3306/hackmd
sudo npm run build
sudo ufw allow 3000
sudo nodejs app.js
http://test.make.social:3000/
After that add it at server startup :
NODE_ENV=production HMD_PROTOCOL_USESSL=true DEBUG=false HMD_ALLOW_ORIGIN=localhost,wiki.communecter.org,test.make.social HMD_DB_URL=mysql://localhost:3306/hackmd nodejs /var/www/test.make.social/public_html/app.js
https://github.com/hackmdio/hackmd/issues/86
This is the Google cache of https://blog.matuni.xyz/archives/2017/05. This is a snapshot of the page as it was posted on May 10, 2017 07:45:36 GMT. The current page may have changed since that date. Learn more Version
Version intégraleVersion in text seulAfficher the sourceAstuce : For finding your search term on this page, press on Ctrl+F or on ⌘+F (Mac), then use the search bar. Archives may 2017 Set up Hackmd on its own server
Written by Mathias B. / 09 may 2017 / no commentsHello to all,
I wrote this article "Block Notes" because I just finished installing Hackmd for Unixcorn, that by experience I know that it is not a simple software to install and that it will do a little documentation French (the origianl source of the translation is French).
Preparing the server for Hackmd
Here it will be what you want, a VPS (virtual private server), a container on your hypervisor or a similar dedicated server. Please note that once the installation is complete Hackmd does not consume very few resources. Two cores, 2 GB of RAM and a bit of bandwidth will be enough to meet its needs.
Here I created a non-privileged LXC container Debian 8 Jessie, on which I installed NodeJs.
Installation of NodeJs
To do this in the most comfortable way, it is good to go through the official deposits of the project. To do this launch this small script proposes :
curl -sL https://deb.nodesource.com/setup_7.x | bash -
It adds you the deposits, the signature key of the packages and reloads the cache. You just have to launch the installation :
apt install nodejs build-essential
For information the build-essential package is required for installing project dependencies which will be realized a little later.
Preparing the database
I use the PostgreSQL database server here. It runs on another container to which the, created previously, connects via a virtual local network. Let's create the necessary user, his database and assign him a password :
su - postgres psql CREATE USER hackmd; ALTER USER hackmd WITH PASSWORD 'tonsupermotdepasse'; CREATE DATABASE hackmd; \q
To allow access to this database through the network 26/5000 you must adapt the file pb_hba.conf by adding the following line :
host hackmd hackmd adresse.ip.de.hackmd/0 md5
Once done do not forget to relaunch PostgreSQL with a small :
service postgresql restart
Installing Dependencies
Hackmd's developer did it right, the installation itself is very simple. Clone the repository and run the installation script provided, which is summarized in the following steps :
git clone https://github.com/hackmdio/hackmd.git cd hackmd ./bin/setup
Configuring Hackmd
Here comes the time to put the nose in the configuration files. Edit the config.json file and make sure to fill in the following lines correctly :
"production": { "domain": "pad.unixcorn.org", "db": { "username": "hackmd", "password": "votresupermotdepasee", "database": "hackmd", "host": "adresse.ip.de.postgresql", "port": "5432", "dialect": "postgres" },
You should then note the environment variables needed to launch the NodeJs directives, here are the ones I use : NODE_ENV=production HMD_PROTOCOL_USESSL=true
Build and start of the server
We generate the assets with the following command :
NODE_ENV=production HMD_PROTOCOL_USESSL=true npm run build
The operation can take a long time depending on the hardware configuration of your machine, be patient. Once completed you can start the server with the following command :
NODE_ENV=production HMD_PROTOCOL_USESSL=true nodejs app.js
More than configuring your reverse proxy, here I would give the example of configuration of Nginx. Proxy Nginx
The following example takes into account a redirection to HTTPS by default, the integration of Let's Encrypt certificates provided by the acme.sh utility as well as advanced TLS settings (cyphers, HSTS (HTTP Strict Transport Security)...).
server {
listen 80;
listen [::]:80;
server_name votresuper.nomdedomaine.lol;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name votresuper.nomdedomaine.lol;
# certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
ssl_certificate /root/.acme.sh/pad.unixcorn.org_ecc/fullchain.cer;
ssl_certificate_key /root/.acme.sh/pad.unixcorn.org_ecc/pad.unixcorn.org.key;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
# Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
ssl_dhparam /etc/ssl/certs/dhparam.pem;
# modern configuration. tweak to your needs.
ssl_protocols TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
ssl_prefer_server_ciphers on;
# HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
add_header Strict-Transport-Security max-age=15768000;
# OCSP Stapling --- # fetch OCSP records from URL in ssl_certificate and cache them
ssl_stapling on;
ssl_stapling_verify on;
## verify chain of trust of OCSP response using Root CA and Intermediate certs
ssl_trusted_certificate /root/.acme.sh/pad.unixcorn.org_ecc/ca.cer;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_pass http://votre.ip.serveur.hackmd:3000;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
}
Test your configuration, reload it and pop its done!CryptPad
Source : https://github.com/xwiki-labs/cryptpad
CryptPad - Installation & configuration
Install
Source : https://github.com/xwiki-labs/cryptpad/wiki/Installation-guide
Adapt v0.33.6 with the number here
sudo su
mkdir /var/www/cryptpad.co.tools
mkdir /var/www/cryptpad.co.tools/home-user
adduser cryptpad --home /var/www/cryptpad.co.tools/home-user
chown -R cryptpad:cryptpad /var/www/cryptpad.co.tools
ufw allow 2016
su cryptpad
cd /var/www/cryptpad.co.tools
git clone https://github.com/xwiki-labs/cryptpad.git cryptpad
cd cryptpad
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
nvm install --lts
npm install bower
npm install
bower install
cp config.example.js config.js
Edit config.js :
var domain = ' https://pad.co.tools/';
httpPort: 2016,
httpSafePort: 2017,
myDomain: 'pad.co.tools',
adminEmail: 'contact@communecter.org',
create start-server.sh file and make it executable :
#!/bin/bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
cd /var/www/cryptpad.co.tools/cryptpad
node server &
sudo nano /etc/rc.local :
su cryptpad -c "/var/www/cryptpad.co.tools/cryptpad/start-server.sh" &
Install with docker
Source : https://hub.docker.com/r/arno0x0x/docker-cryptpad/
sudo su
ufw allow 2016
docker pull arno0x0x/docker-cryptpad
docker run -d -p 2016:3000 -v /var/www/cryptpad.co.tools/datastore/ arno0x0x/docker-cryptpad
Apache
Source : https://github.com/xwiki-labs/cryptpad/wiki/Apache
ServerName pad.co.tools
ServerAlias cryptopad.co.tools
ServerAdmin webmaster@co.tools
ProxyPass / http://83.166.144.90:2016/
ProxyPassReverse / http://83.166.144.90:2016/
ProxyRequests Off
ProxyPreserveHost Off
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule .* ws://83.166.144.90:2016%{REQUEST_URI} [P]
Weblate
Install and configuration of Weblate
Docker install
Following steps in:
https://docs.weblate.org/en/latest/admin/deployments.html#docker
Steps done:
sudo su weblate
sudo mkdir /var/www/weblate.co.tools
cd /var/www/weblate.co.tools
git clone https://github.com/WeblateOrg/docker-compose.git weblate-docker
cd weblate-docker
echo "version: '2'
services:
weblate:
environment:
- WEBLATE_EMAIL_HOST=smtp.co.tools
- WEBLATE_EMAIL_HOST_USER=wave
- WEBLATE_EMAIL_HOST_PASSWORD=pass
- WEBLATE_SERVER_EMAIL=wave@communecter.org
- WEBLATE_DEFAULT_FROM_EMAIL=wave@communecter.org
- WEBLATE_ALLOWED_HOSTS=weblate.co.tools,localhost
- WEBLATE_SITE_TITLE=Plateforme de traduction de Communecter
- WEBLATE_ADMIN_PASSWORD=pass
- WEBLATE_ADMIN_EMAIL=wave@communecter.org
- WEBLATE_ADMIN_NAME="Administrateur"
- WEBLATE_IP_PROXY_HEADER=HTTP_X_FORWARDED_FOR
- WEBLATE_REGISTRATION_OPEN=1
- WEBLATE_ENABLE_HTTPS=1
- WEBLATE_SOCIAL_AUTH_GITLAB_KEY=application id
- WEBLATE_SOCIAL_AUTH_GITLAB_SECRET=secret
- WEBLATE_SOCIAL_AUTH_GITLAB_API_URL=https://weblate.co.tools/accounts/complete/gitlab/
" > docker-compose.override.yml
With values according to mail server.
And finally:
sudo docker-compose up
Configure apache : /etc/apache2/sites-enabled/weblate.co.tools.conf :
ServerName weblate.co.tools
ServerAdmin webmaster@make.social
ProxyPass / http://localhost:10080/
ProxyPassReverse / http://localhost:10080/
ProxyRequests Off
ProxyPreserveHost On
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Configure lets encrypt :
certbot --apache -d weblate.co.tools
Et on repasse sur les fichiers de conf Apache weblate.co.tools-le-ssl.conf :
ServerName weblate.co.tools
ServerAdmin webmaster@make.social
ProxyPass / http://localhost:10080/
ProxyPassReverse / http://localhost:10080/
ProxyRequests Off
ProxyPreserveHost On
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RequestHeader set X-Forwarded-Proto "https"
SSLCertificateFile /etc/letsencrypt/live/weblate.co.tools/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/weblate.co.tools/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
Ainsi que : weblate.co.tools.conf
ServerName weblate.co.tools
ServerAdmin webmaster@make.social
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Redirect permanent / https://weblate.co.tools/
Weblate configuration (pixel-humain project)
In weblate, a project is made of components. Each component has one translation file per language. If your source code uses many files for a given language, you will have to create a new component for each file.
Hopefully, weblate has a Component discovery addon. Using this addon, Weblate automatically discovers sources files for a given language. To use this addon, you have to :
Add a first component to your project. This component should translate a file that will not move in the future (for example, I chose the common.php file for pixel-humain project).
Then, enable the component discovery addon to automatically generate components. The translations of these components will be committed in the repo of the first component you created (common.php in my example). To push to Weblate repository, use the Repository management menu of the main component.
Gitlab configuration (co2-bot)
In weblate, when creating a new project, you have to create a first component to set the repository of the source code. You have to use two URLs : the source code repository, and the push repository. Select the main repository as the Source code Repository, and the fork repository as the Push URL.
On Gitlab :
the weblate user is co2-bot. To use Weblate properly on Gitlab, you should fork the repo you want to integrate to Weblate using co2-bot user. For example co2-bot forked pixel-humain.
set a webhook in the main repository to the weblate URL : https://weblate.co.tools/hooks/gitlab/
The workflow should be like below :
As Developers, you will have to initialize empty translation files (with keys but no values). When you push to the source code repository, weblate will automatically pull the new files and update the translations accordingly.
As Translators, you work on the translations. When you are ready, you can push to the push repository using Weblate interface.
As Developers or Translators, when you have a major release, you should create a Merge Request between co2-bot fork repository and the main repository. Check the consistency of the files and do a squashed merge once you are ready.
Nextcloud and Collabora online
Nextcloud and Collabora online installation & configuration
Prerequisite
Ubuntu 16.04 server + LAMP + sudo apt install smbclient
Installation of NextCloud
Fetch Nextcloud
su web
mkdir ~/www/cloud.communecter.org
cd ~/www/cloud.communecter.org
wget https://download.nextcloud.com/server/releases/nextcloud-xxx.zip
unzip nextcloud-xxx.zip -d .
mv nextcloud/ public_html
mkdir data
Add the icons of external applications in nextcloud/apps/external/img which are in the zip file
Configure apache
Go to https://cloud.communecter.org to configure it
Edit the file config/config.php :
array (
0 => 'localhost',
1 => 'cloud.communecter.org',
2 => 'cloud.co.tools',
3 => 'nextcloud.co.tools',
4 => '83.166.144.90',
),
Installation of Collabora
Follow these instructions : https://nextcloud.com/collaboraonline/ Docker alternative : https://hub.docker.com/r/thedarkknight/libreoffice-online-unlimited/
Configure apache in /etc/apache2/site-availables :
ServerName collabora.co.tools
SSLHonorCipherOrder on
# Encoded slashes need to be allowed
AllowEncodedSlashes NoDecode
# Container uses a unique non-signed certificate
SSLProxyEngine On
SSLProxyVerify None
SSLProxyCheckPeerCN Off
SSLProxyCheckPeerName Off
# keep the host
ProxyPreserveHost On
# static html, js, images, etc. served from loolwsd
# loleaflet is the client part of LibreOffice Online
ProxyPass /loleaflet https://127.0.0.1:9980/loleaflet retry=0
ProxyPassReverse /loleaflet https://127.0.0.1:9980/loleaflet
# WOPI discovery URL
ProxyPass /hosting/discovery https://127.0.0.1:9980/hosting/discovery retry=0
ProxyPassReverse /hosting/discovery https://127.0.0.1:9980/hosting/discovery
# Main websocket
ProxyPassMatch "/lool/(.*)/ws$" wss://127.0.0.1:9980/lool/$1/ws nocanon
# Admin Console websocket
ProxyPass /lool/adminws wss://127.0.0.1:9980/lool/adminws
# Download as, Fullscreen presentation and Image upload operations
ProxyPass /lool https://127.0.0.1:9980/lool
ProxyPassReverse /lool https://127.0.0.1:9980/lool
Fetch and launch docker (the option --restart always will cause the container to be added to service docker which is automatically launched at the start of the computer)
sudo su
docker pull collabora/code
ufw allow 9980
docker run -t -d -p 127.0.0.1:9980:9980 -e 'domain=cloud\\.communecter\\.org\|cloud\\.openappecosystem\\.cc\|nextcloud\\.co\\.tools|cloud\\.co\\.tools|cloud\\.cosystem\\.cc' --restart always --cap-add MKNOD collabora/code
Then, in the web interface of NextCloud, add the application Collabora and configure it by giving the server address : https://collabora.co.toolsGitBook
With a cron, update the gitbook from the github wiki + a script to make the necessary conversions
Start reading page "Contribute to the documentation"
If necessary : GitBook Toolchain Documentation
Installation and configuration : https://gitlab.com/funkycram/git-wiki-to-gitbookBookStack
Installation
https://www.bookstackapp.com/docs/admin/installation/ : manual installation
Update
https://www.bookstackapp.com/docs/admin/updates
Export pdf
Documentation
Mise en place
dans le fichier .env, j'ai du paramétrer memcached comme expliqué ici : https://www.bookstackapp.com/docs/admin/cache-session-config/
CACHE_DRIVER=memcached
SESSION_DRIVER=memcached
and
php artisan config:cache
php artisan config:clear
Bug "page expired"
Toujours un souci de cache ! Du coup j'ai remplacé memcached par database et ça marche !Dialoguea (Obsolete)
Dialoguea : installation
GitHub repository
requirements
system
sudo su
apt install -y libvips-dev libgsf-1-dev
wget http://dl.google.com/closure-compiler/compiler-latest.tar.gz
tar zxvf compiler-latest.tar.gz
mv closure-compiler-v20170910.jar /usr/share/java/build/compiler.jar
rm compiler-latest.tar.gz
Create a specific user
In order to have a specific version for Dialoguea, we create a specific user for it. Replace DIR by the home directory you want :
sudo adduser dialoguea --home DIR
sudo su dialoguea
node.js
nvm install 6.9.4
extra npm packages
npm install -g bower nodemon grunt-cli grunt-closure-compiler
npm install grunt --save-dev
npm install babel fs-extra grunt-contrib-concat
Install
git clone https://github.com/ForumDebats/dialoguea.git
cd dialoguea
npm install
bower install
echo "my53CR3Tkey" > key.pub
cd scripts; ./install-tinyup.sh; cd -;
cd tinymce/plugins/upimage
mv plugin.min.js.off plugin.min.js
cd -
grunt
Create the minimified files in public/css (https://www.minifier.org/) :
content.min.css
dialoguea.min.css
skin.min.css
configure SITE and SMTP in settings.js (for the provider, just add the name : e.g. if your SMTP is smtp.mailgun.com, write mailgun)
Allow 2015 port in firewall, add an admin user and launch the server :
sudo ufw allow 2015
npm run adduser
npm run dev
On the web browser, sign in and create a public group
Update
git pull && grunt
bug or feature requests ?
https://github.com/ForumDebats/dialoguea/issues
Make the node.js server start when Ubuntu server starts:
Create the file start-server.sh containing (adapt the cd line) :
#!/bin/bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
cd /var/www/dialoguea
npm run dev &
sudo nano /etc/rc.local :
su dialoguea -c "/var/www/dialoguea/start-server.sh" &
Wiki.JS (Obsolete)
Wiki.Js install & configuration
official website
based on Node.js
Install as an ubuntu user by following official documentation
Configure the port in config.yml :
title: WikiJS
host: 'https://wikijs.communecter.org'
port: 3003
And the reverse proxy for apache :
ProxyPass / http://83.166.144.90:3003/
ProxyPassReverse / http://83.166.144.90:3003/
ProxyRequests Off
ProxyPreserveHost Off
If there is a bug, the command to restart the server is node wiki reload
Replace files in assets with those in this zip file
Edit the file app.js and add the following CSS code just before the 1st character \ de \n\n/*# sourceMappingURL=app.scss.map :
.nav-left{overflow-x: hidden} .nc-icon-outline.ui-2_layers::before {content: ""; width: 36px; display: block;} a.nav-item {background-image: url("/images/logo-30-36.png");background-repeat: no-repeat;background-position: 10px center;} .nav-item h1 {font-size: 24px; margin-top: 8px;} .nav.is-indigo .control input[type="text"]:placeholder-shown {color: #e8eaf6}#search-input::-webkit-input-placeholder { color: #e8eaf6 !important; } #search-input:-moz-placeholder { color: #e8eaf6 !important; opacity: 1;}#search-input::-moz-placeholder {color: #e8eaf6 !important;opacity: 1;}#search-input:-ms-input-placeholder {color: #e8eaf6 !important;}#search-input::-ms-input-placeholder {color: #e8eaf6 !important;}#search-input::placeholder {color: #e8eaf6 !important;} .mkcontent a {color: #1976d2; text-decoration: none;} .mkcontent a:hover {text-decoration: underline;} .mkcontent h3 {color: #004d40}
And replace all :
#3f51b5 with #E33551
#283593 with #c5203b
#3949AB with #de314d
#5c6bc0 with #4a4a4a