Skip to content

Commit 7e3e411

Browse files
authored
One agent fixes (#321)
1 parent 21f9578 commit 7e3e411

File tree

13 files changed

+33
-28
lines changed

13 files changed

+33
-28
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,25 @@ Prerequisites:
3838

3939
##### x86_64
4040
```
41-
rpm -Uvh --oldpackage https://github.com/AikidoSec/firewall-php/releases/download/v1.4.0/aikido-php-firewall.x86_64.rpm
41+
rpm -Uvh --oldpackage https://github.com/AikidoSec/firewall-php/releases/download/v1.4.1/aikido-php-firewall.x86_64.rpm
4242
```
4343

4444
##### arm64 / aarch64
4545
```
46-
rpm -Uvh --oldpackage https://github.com/AikidoSec/firewall-php/releases/download/v1.4.0/aikido-php-firewall.aarch64.rpm
46+
rpm -Uvh --oldpackage https://github.com/AikidoSec/firewall-php/releases/download/v1.4.1/aikido-php-firewall.aarch64.rpm
4747
```
4848

4949
#### For Debian-based Systems (Debian, Ubuntu)
5050

5151
##### x86_64
5252
```
53-
curl -L -O https://github.com/AikidoSec/firewall-php/releases/download/v1.4.0/aikido-php-firewall.x86_64.deb
53+
curl -L -O https://github.com/AikidoSec/firewall-php/releases/download/v1.4.1/aikido-php-firewall.x86_64.deb
5454
dpkg -i -E ./aikido-php-firewall.x86_64.deb
5555
```
5656

5757
##### arm64 / aarch64
5858
```
59-
curl -L -O https://github.com/AikidoSec/firewall-php/releases/download/v1.4.0/aikido-php-firewall.aarch64.deb
59+
curl -L -O https://github.com/AikidoSec/firewall-php/releases/download/v1.4.1/aikido-php-firewall.aarch64.deb
6060
dpkg -i -E ./aikido-php-firewall.aarch64.deb
6161
```
6262

docs/aws-elastic-beanstalk.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
```
55
commands:
66
aikido-php-firewall:
7-
command: "rpm -Uvh --oldpackage https://github.com/AikidoSec/firewall-php/releases/download/v1.4.0/aikido-php-firewall.x86_64.rpm"
7+
command: "rpm -Uvh --oldpackage https://github.com/AikidoSec/firewall-php/releases/download/v1.4.1/aikido-php-firewall.x86_64.rpm"
88
ignoreErrors: true
99
1010
files:

docs/fly-io.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Create a script to install the Aikido PHP Firewall during deployment:
3232
#!/usr/bin/env bash
3333
cd /tmp
3434

35-
curl -L -O https://github.com/AikidoSec/firewall-php/releases/download/v1.4.0/aikido-php-firewall.x86_64.deb
35+
curl -L -O https://github.com/AikidoSec/firewall-php/releases/download/v1.4.1/aikido-php-firewall.x86_64.deb
3636
dpkg -i -E ./aikido-php-firewall.x86_64.deb
3737
```
3838

docs/laravel-forge.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ cd /tmp
2121
2222
# Install commands from the "Manual install" section below, based on your OS
2323
24-
curl -L -O https://github.com/AikidoSec/firewall-php/releases/download/v1.4.0/aikido-php-firewall.x86_64.deb
24+
curl -L -O https://github.com/AikidoSec/firewall-php/releases/download/v1.4.1/aikido-php-firewall.x86_64.deb
2525
dpkg -i -E ./aikido-php-firewall.x86_64.deb
2626
2727
# Restarting the php services in order to load the Aikido PHP Firewall

lib/agent/constants/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package constants
22

33
const (
4-
Version = "1.4.0"
4+
Version = "1.4.1"
55
SocketPath = "/run/aikido-" + Version + "/aikido-agent.sock"
66
PidPath = "/run/aikido-" + Version + "/aikido-agent.pid"
77
ConfigUpdatedAtMethod = "GET"

lib/php-extension/PhpWrappers.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ bool CallPhpFunction(std::string function_name, unsigned int params_number, zval
4141
if (!return_value) {
4242
zval_ptr_dtor(&_temp_return_value);
4343
}
44-
AIKIDO_LOG_INFO("Called user function '%s' -> result %d\n", function_name.c_str(), _result == SUCCESS);
4544
return _result == SUCCESS;
4645
}
4746

lib/php-extension/include/php_aikido.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
extern zend_module_entry aikido_module_entry;
44
#define phpext_aikido_ptr &aikido_module_entry
55

6-
#define PHP_AIKIDO_VERSION "1.4.0"
6+
#define PHP_AIKIDO_VERSION "1.4.1"
77

88
#if defined(ZTS) && defined(COMPILE_DL_AIKIDO)
99
ZEND_TSRMLS_CACHE_EXTERN()

lib/request-processor/config/config.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,28 @@ func UpdateToken(token string) {
1919
log.Infof("Token changed to \"AIK_RUNTIME_***%s\"", utils.AnonymizeToken(token))
2020
}
2121

22-
func ReloadAikidoConfig(conf *AikidoConfigData, initJson string) {
22+
func ReloadAikidoConfig(conf *AikidoConfigData, initJson string) bool {
2323
err := json.Unmarshal([]byte(initJson), conf)
2424
if err != nil {
25-
panic(fmt.Sprintf("Error parsing JSON to AikidoConfig: %s", err))
25+
return false
2626
}
2727

2828
if err := log.SetLogLevel(conf.LogLevel); err != nil {
29-
panic(fmt.Sprintf("Error setting log level: %s", err))
29+
return false
3030
}
3131

32-
if conf.Token != "" {
33-
server := globals.CreateServer(conf.Token)
34-
server.AikidoConfig = *conf
32+
if conf.Token == "" {
33+
return false
34+
}
35+
36+
if globals.ServerExists(conf.Token) {
3537
UpdateToken(conf.Token)
38+
return false
3639
}
40+
server := globals.CreateServer(conf.Token)
41+
server.AikidoConfig = *conf
42+
UpdateToken(conf.Token)
43+
return true
3744
}
3845

3946
func Init(initJson string) {

lib/request-processor/globals/globals.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ func CreateServer(token string) *ServerData {
6262
}
6363

6464
const (
65-
Version = "1.4.0"
65+
Version = "1.4.1"
6666
SocketPath = "/run/aikido-" + Version + "/aikido-agent.sock"
6767
)

lib/request-processor/grpc/client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ func OnRequestShutdown(server *ServerData, method string, route string, routePar
143143
}
144144

145145
/* Get latest cloud config from Aikido Agent via gRPC */
146-
func GetCloudConfig(server *ServerData) {
146+
func GetCloudConfig(server *ServerData, timeout time.Duration) {
147147
if client == nil {
148148
return
149149
}
150150

151-
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
151+
ctx, cancel := context.WithTimeout(context.Background(), timeout)
152152
defer cancel()
153153

154154
cloudConfig, err := client.GetCloudConfig(ctx, &protos.CloudConfigUpdatedAt{Token: server.AikidoConfig.Token, ConfigUpdatedAt: utils.GetCloudConfigUpdatedAt(server)})
@@ -160,9 +160,9 @@ func GetCloudConfig(server *ServerData) {
160160
setCloudConfig(server, cloudConfig)
161161
}
162162

163-
func GetCloudConfigForAllServers() {
163+
func GetCloudConfigForAllServers(timeout time.Duration) {
164164
for _, server := range globals.GetServers() {
165-
GetCloudConfig(server)
165+
GetCloudConfig(server, timeout)
166166
}
167167
}
168168

0 commit comments

Comments
 (0)