In order to use the Peer-to-Peer functionality of the D2D iOS App, the SSL CA certificate for the D2D protocol must be set in the server settings. D2D iOS SSL CA Certificate and SSL CertificateThe D2D protocol uses SSL, which requires all servers and clients to have a valid SSL certificate. Clients create certificates automatically, which are signed by the server. This requires the server to become a certificate authority (CA), which must be activated in the server settings in the web interface. In Preferences→Network the D2D certificate status can be seen. If the status is "invalid", a new CA certificate can be created with the "Renew D2D Certificate" button. The server then creates a new valid CA certificate, which is stored in server_maintenance/d2d/ca.pem and server_maintenance/d2d/ca.jks. It is not necessary to restart the server after certificate creation or renewal. Create and Renew the iOS-CertificatePlease make sure that the administrator of the server should create the D2D-Certificate that is used for the encrypted dataflow from device to the Web-Sockets. This certificate is valid only for one year and after that it should be renewed manually through admin-portal under Network-Settings:Please make sure that the administrator of the server should create the D2D-Certificate that is used for the encrypted dataflow from device to the Web-Sockets. Web Socket Configuration This certificate is valid only for one year and after that it should be renewed manually through admin-portal under Network-Settings: Image Added Web Sockets for iOSThe D2D protocol uses Web Socket to communicate with the server. When used in cluster setup, the load balancer needs to be configured to allow protocol upgrades from HTTP to WebSocket. Also, each node must be directly accessible for WebSocket via URL. For example, the node with ID node1 must be accessible for WebSocket via URL powerfolder.example.com/websocket/node1 which needs to be redirected to $internalAddress/websocket. Please see the two examples below for nginx and Apache: Sample Configuration Code Block |
---|
| upstream powerfolder.example.com {
ip_hash;
server 10.0.0.1:8080;
server 10.0.0.2:8080;
keepalive 120;
}
server {
listen 10.0.0.1:80;
server_name powerfolder.example.com;
return 301 https://$server_name$request_uri;
location /rpc {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://powerfolder.example.com/rpc;
}
}
server {
listen 10.0.0.1:443 ssl;
server_name powerfolder.example.com;
client_max_body_size 100G;
ssl_certificate certificates/cluster.crt.pem;
ssl_certificate_key certificates/cluster.key.pem;
location / {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://powerfolder.example.com;
}
location /websocket {
proxy_http_version 1.1;
proxy_pass http://powerfolder.example.com/websocket;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /websocket/nodeID1 {
proxy_http_version 1.1;
proxy_pass http://10.0.0.1:8080/websocket;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /websocket_client/nodeID1 {
proxy_http_version 1.1;
proxy_pass http://10.0.0.1:8080/websocket;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /websocket/nodeID2 {
proxy_http_version 1.1;
proxy_pass http://10.0.0.2:8080/websocket;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /websocket_client/nodeID2 {
proxy_http_version 1.1;
proxy_pass http://10.0.0.2:8080/websocket;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
} |
WebSocket ProxyPass entries have to be defined BEFORE other ProxyPass entries Code Block |
---|
| <Proxy balancer://httpcluster>
BalancerMember http://10.0.0.1:8080 route=nodeID1
BalancerMember http://10.0.0.2:8080 route=nodeID2
BalancerMember http://10.0.0.3:8080 route=nodeID3
ProxySet stickysession=rpcid|JSESSIONID|jsessionid scolonpathdelim=On lbmethod=bybusyness
</Proxy>
<Proxy balancer://websocketcluster>
BalancerMember ws://10.0.0.1:8080
BalancerMember ws://10.0.0.2:8080
BalancerMember ws://10.0.0.3:8080
ProxySet lbmethod=bybusyness
</Proxy>
ProxyRequests Off
ProxyPass /websocket/nodeID1 ws://10.0.0.1:8080/websocket
ProxyPass /websocket/nodeID2 ws://10.0.0.2:8080/websocket
ProxyPass /websocket/nodeID3 ws://10.0.0.3:8080/websocket
ProxyPass /websocket balancer://websocketcluster/websocket
ProxyPass /rpc balancer://httpcluster/rpc nocanon
ProxyPassReverse /rpc balancer://httpcluster/rpc
ProxyPass / balancer://httpcluster/ nocanon
ProxyPassReverse / balancer://httpcluster/ |
Enabling Web Sockets for ClientPlease enable also the web sockets for client, you can simply extend the web sockets for iOS to clientsfollow the Cluster Setup Guide for setting up Apache or nginx. Web Sockets for ClientTo provide web sockets connectivity for clients please follow the Cluster Setup Guide for setting up Apache or nginx. Sample ConfigurationPrecondition: Please update the following configuration in DefaulltDefault.config (sever, global) or PowerFolder.config (for one client) to use the web socket connection: connections.websocket=true
Code Block |
---|
| <Proxy balancer://httpcluster>
BalancerMember http://10.0.0.1:8080 route=nodeID1
BalancerMember http://10.0.0.2:8080 route=nodeID2
BalancerMember http://10.0.0.3:8080 route=nodeID3
ProxySet stickysession=rpcid|JSESSIONID|jsessionid scolonpathdelim=On lbmethod=bybusyness
</Proxy>
<Proxy balancer://websocketcluster>
BalancerMember ws://10.0.0.1:8080
BalancerMember ws://10.0.0.2:8080
BalancerMember ws://10.0.0.3:8080
ProxySet lbmethod=bybusyness
</Proxy>
ProxyRequests Off
ProxyPass /websocket/nodeID1 ws://10.0.0.1:8080/websocket
ProxyPass /websocket/nodeID2 ws://10.0.0.2:8080/websocket
ProxyPass /websocket/nodeID3 ws://10.0.0.3:8080/websocket
ProxyPass /websocket balancer://websocketcluster/websocket
ProxyPass /websocket_client/nodeID1 ws://10.0.0.1:8080/websocket_client
ProxyPass /websocket_client/nodeID2 ws://10.0.0.2:8080/websocket_client
ProxyPass /websocket_client/nodeID3 ws://10.0.0.3:8080/websocket_client
ProxyPass /websocket_client balancer://websocketcluster/websocket_client
ProxyPass /rpc balancer://httpcluster/rpc nocanon
ProxyPassReverse /rpc balancer://httpcluster/rpc
ProxyPass / balancer://httpcluster/ nocanon
ProxyPassReverse / balancer://httpcluster/ |
Code Block |
---|
|