websocket server by service
This commit is contained in:
parent
49085bcc6f
commit
58f3b7daf8
|
@ -0,0 +1,11 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Nineskeletor websocket server
|
||||||
|
After=local-fs.target network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/var/www/html/nineskeletor/bin/console app:Websocket --name nineskeletor
|
||||||
|
Restart=on-watchdog
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -28,6 +28,7 @@ parameters:
|
||||||
ldapModel: '%env(resolve:LDAP_MODEL)%'
|
ldapModel: '%env(resolve:LDAP_MODEL)%'
|
||||||
ldapHost: '%env(resolve:LDAP_HOST)%'
|
ldapHost: '%env(resolve:LDAP_HOST)%'
|
||||||
ldapPort: '%env(resolve:LDAP_PORT)%'
|
ldapPort: '%env(resolve:LDAP_PORT)%'
|
||||||
|
ldapTls: '%env(resolve:LDAP_TLS)%'
|
||||||
ldapUser: '%env(resolve:LDAP_USER)%'
|
ldapUser: '%env(resolve:LDAP_USER)%'
|
||||||
ldapPassword: '%env(resolve:LDAP_PASSWORD)%'
|
ldapPassword: '%env(resolve:LDAP_PASSWORD)%'
|
||||||
ldapBasedn: '%env(resolve:LDAP_BASEDN)%'
|
ldapBasedn: '%env(resolve:LDAP_BASEDN)%'
|
||||||
|
@ -66,6 +67,7 @@ services:
|
||||||
bind:
|
bind:
|
||||||
$ldapHost: '%ldapHost%'
|
$ldapHost: '%ldapHost%'
|
||||||
$ldapPort: '%ldapPort%'
|
$ldapPort: '%ldapPort%'
|
||||||
|
$ldapTls: '%ldapTls%'
|
||||||
$ldapUser: '%ldapUser%'
|
$ldapUser: '%ldapUser%'
|
||||||
$ldapPassword: '%ldapPassword%'
|
$ldapPassword: '%ldapPassword%'
|
||||||
$ldapBasedn: '%ldapBasedn%'
|
$ldapBasedn: '%ldapBasedn%'
|
||||||
|
@ -105,7 +107,7 @@ services:
|
||||||
app.ldap.service:
|
app.ldap.service:
|
||||||
public: true
|
public: true
|
||||||
class: App\Service\ldapService
|
class: App\Service\ldapService
|
||||||
arguments: ["%ldapHost%","%ldapPort%","%ldapUser%","%ldapPassword%","%ldapBasedn%"]
|
arguments: ["%ldapHost%","%ldapPort%","%ldapTls%","%ldapUser%","%ldapPassword%","%ldapBasedn%"]
|
||||||
|
|
||||||
app.upload.samename:
|
app.upload.samename:
|
||||||
public: true
|
public: true
|
||||||
|
|
|
@ -32,6 +32,6 @@ then
|
||||||
|
|
||||||
if [ "$restart" == "yes" ] && [ "$1" != "stop" ] ; then
|
if [ "$restart" == "yes" ] && [ "$1" != "stop" ] ; then
|
||||||
echo WEBSOCKET = START
|
echo WEBSOCKET = START
|
||||||
bin/console app:Websocket --name $APP_ALIAS & disown
|
systemctl restart $APP_ALIAS
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
|
@ -10,16 +10,18 @@ class ldapService
|
||||||
|
|
||||||
protected $host;
|
protected $host;
|
||||||
protected $port;
|
protected $port;
|
||||||
|
protected $tls;
|
||||||
protected $user = null;
|
protected $user = null;
|
||||||
protected $password = null;
|
protected $password = null;
|
||||||
protected $basedn;
|
protected $basedn;
|
||||||
|
|
||||||
private $connection = null;
|
private $connection = null;
|
||||||
|
|
||||||
public function __construct($ldapHost, $ldapPort, $ldapUser, $ldapPassword, $ldapBasedn)
|
public function __construct($ldapHost, $ldapPort, $ldapTls, $ldapUser, $ldapPassword, $ldapBasedn)
|
||||||
{
|
{
|
||||||
$this->host = $ldapHost;
|
$this->host = $ldapHost;
|
||||||
$this->port = $ldapPort;
|
$this->port = $ldapPort;
|
||||||
|
$this->tls = $ldapTls;
|
||||||
$this->user = $ldapUser;
|
$this->user = $ldapUser;
|
||||||
$this->password = $ldapPassword;
|
$this->password = $ldapPassword;
|
||||||
$this->basedn = $ldapBasedn;
|
$this->basedn = $ldapBasedn;
|
||||||
|
@ -32,6 +34,9 @@ class ldapService
|
||||||
$ldapConn = ldap_connect($this->host, $this->port);
|
$ldapConn = ldap_connect($this->host, $this->port);
|
||||||
if($ldapConn){
|
if($ldapConn){
|
||||||
ldap_set_option($ldapConn, LDAP_OPT_PROTOCOL_VERSION, 3);
|
ldap_set_option($ldapConn, LDAP_OPT_PROTOCOL_VERSION, 3);
|
||||||
|
ldap_set_option($ldapConn, LDAP_OPT_REFERRALS, 0);
|
||||||
|
if($this->tls) ldap_start_tls($ldapConn);
|
||||||
|
|
||||||
if(ldap_bind( $ldapConn, $this->user, $this->password)){
|
if(ldap_bind( $ldapConn, $this->user, $this->password)){
|
||||||
$this->connection = $ldapConn;
|
$this->connection = $ldapConn;
|
||||||
return $this->connection;
|
return $this->connection;
|
||||||
|
|
|
@ -63,6 +63,11 @@ LDAP_MODEL=open
|
||||||
%end if
|
%end if
|
||||||
LDAP_HOST=%%adresse_ip_ldap
|
LDAP_HOST=%%adresse_ip_ldap
|
||||||
LDAP_PORT=%%ldap_port
|
LDAP_PORT=%%ldap_port
|
||||||
|
%if %%getVar("ldap_tls","non") == "oui"
|
||||||
|
LDAP_TLS=1
|
||||||
|
%else
|
||||||
|
LDAP_TLS=0
|
||||||
|
%end if
|
||||||
LDAP_USER=%%ldap_reader
|
LDAP_USER=%%ldap_reader
|
||||||
LDAP_PASSWORD=%%pwdreader("",%%ldap_reader_passfile)
|
LDAP_PASSWORD=%%pwdreader("",%%ldap_reader_passfile)
|
||||||
LDAP_BASEDN=%%ldap_base_dn
|
LDAP_BASEDN=%%ldap_base_dn
|
||||||
|
|
Loading…
Reference in New Issue