Skip to content

Commit

Permalink
1.25.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-timcu committed Jul 4, 2024
1 parent d8a9832 commit c111baa
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ aikido-*-extension-php-*.so
.vscode/settings.json
src/extension/ndDb2pJ5Px
*.deb
package/deb/opt/aikido/aikido-1.24.0*
package/deb/opt/aikido/aikido-1.25.0*
src/agent/aikido_config.json
2 changes: 1 addition & 1 deletion include/php_aikido.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
extern zend_module_entry aikido_module_entry;
# define phpext_aikido_ptr &aikido_module_entry

# define PHP_AIKIDO_VERSION "1.24.0"
# define PHP_AIKIDO_VERSION "1.25.0"

# if defined(ZTS) && defined(COMPILE_DL_AIKIDO)
ZEND_TSRMLS_CACHE_EXTERN()
Expand Down
2 changes: 1 addition & 1 deletion package/deb/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: aikido-firewall-php
Version: 1.24.0
Version: 1.25.0
Section: base
Priority: optional
Architecture: all
Expand Down
2 changes: 1 addition & 1 deletion package/deb/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

VERSION="1.24.0"
VERSION="1.25.0"

declare -A php_api_versions

Expand Down
2 changes: 1 addition & 1 deletion package/rpm/aikido.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: aikido-php-firewall
Version: 1.24.0
Version: 1.25.0
Release: 1
Summary: Aikido PHP extension and agent

Expand Down
2 changes: 1 addition & 1 deletion rpm_build_and_install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rm -rf ~/rpmbuild
rpmdev-setuptree

VERSION="1.24.0"
VERSION="1.25.0"

mkdir -p ~/rpmbuild/SOURCES/aikido-php-firewall-$VERSION
cp -rf package/rpm/etc ~/rpmbuild/SOURCES/aikido-php-firewall-$VERSION/
Expand Down
2 changes: 1 addition & 1 deletion rpm_uninstall.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rpm -e aikido-php-firewall-1.24.0-1.x86_64
rpm -e aikido-php-firewall-1.25.0-1.x86_64
2 changes: 1 addition & 1 deletion src/agent/globals/constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package globals

const (
Version = "1.24.0"
Version = "1.25.0"
ConfigFilePath = "/opt/aikido/config.json"
DevConfigFilePath = "/opt/aikido/config-dev.json"
LogFilePath = "/var/log/aikido/aikido.log"
Expand Down
21 changes: 16 additions & 5 deletions src/lib/grpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import (
const socketPath = "/run/aikido.sock"

var conn *grpc.ClientConn
var cancel context.CancelFunc
var client protos.AikidoClient
var ctx context.Context

func Init() {
var err error
Expand All @@ -32,23 +30,26 @@ func Init() {

client = protos.NewAikidoClient(conn)

ctx, cancel = context.WithTimeout(context.Background(), time.Second)

log.Debug("Initialized gRPC client!")
}

func Uninit() {
conn.Close()
cancel()
}

func OnReceiveToken() {
log.Infof("Client: %v", client)

token := os.Getenv("AIKIDO_TOKEN")
if token == "" {
log.Warn("AIKIDO_TOKEN not found in env variables!")
return
}
log.Info("Sending token: ", token)

ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()

_, err := client.OnReceiveToken(ctx, &protos.Token{Token: token})
if err != nil {
log.Debugf("Could not send token %v: %v", token, err)
Expand All @@ -57,12 +58,17 @@ func OnReceiveToken() {
}

func OnReceiveLogLevel() {
log.Infof("Client: %v", client)

log_level := os.Getenv("AIKIDO_LOG_LEVEL")
if log_level == "" {
log.Debug("AIKIDO_LOG_LEVEL not found in env variables!")
return
}
log.Info("Sending log level: ", log_level)

ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
_, err := client.OnReceiveLogLevel(ctx, &protos.LogLevel{LogLevel: log_level})
if err != nil {
log.Debugf("Could not send log level %v: %v", log_level, err)
Expand All @@ -71,6 +77,11 @@ func OnReceiveLogLevel() {
}

func OnReceiveDomain(domain string) {
log.Infof("Client: %v", client)

ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()

_, err := client.OnReceiveDomain(ctx, &protos.Domain{Domain: domain})
if err != nil {
log.Debugf("Could not send domain %v: %v", domain, err)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/handle_urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ func OnFunctionExecutedCurl(parameters map[string]interface{}) string {
}
domain := utils.GetDomain(*url)
log.Info("Got domain: ", domain)
grpc.OnReceiveDomain(domain)
go grpc.OnReceiveDomain(domain)
return "{}"
}

0 comments on commit c111baa

Please sign in to comment.