Defect fixes following testing.

This commit is contained in:
Thomas Williams 2024-08-19 18:56:56 +01:00
parent 46d895d900
commit 2e04b5eeb8
Signed by: thomas
GPG key ID: EB8F975CF60BCBFF
5 changed files with 12 additions and 12 deletions

View file

@ -91,7 +91,7 @@ class rabbitMQClient:
if result[3] == 'ipBlock':
result[2] = datetime.datetime.fromisoformat(result[2])
manager = logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword)
manager = log.logsManager(config.sqlServer, config.sqlDatabase, config.sqlUsername, config.sqlPassword)
manager.insertIPBlock(result[0], result[1], result[4], result[5], result[6], result[2], config.ipinfoAPIToken)
context = ssl.create_default_context(

View file

@ -16,9 +16,6 @@ def main():
jail = sys.argv[2]
live = int(sys.argv[3])
logTime = datetime.datetime.now()
token = config.ipinfoAPIToken
print(hostname, ipAddress, blockedIPAddress, jail, live, logTime, token)
if not config.loggingMode == 'none' and not config.loggingMode == 'rabbitmq':
@ -27,7 +24,10 @@ def main():
if config.loggingMode == 'rabbitmq':
rabbitmq.publish(hostname + '|' + socket.gethostbyname(socket.gethostname()) + '|' + str(logTime) + '|' + 'ipBlock' + '|' + str(blockedIPAddress) + '|' + str(jail) + '|' str(live)
import rabbitmq
rabbitmq = rabbitmq.rabbitMQClient(config.rabbitmqca,config.rabbitmqcacert,config.rabbitmqcakey,config.rabbitmqHost,config.rabbitmqPort,config.rabbitmqRoutingKey)
rabbitmq.publish(hostname + '|' + socket.gethostbyname(socket.gethostname()) + '|' + str(logTime) + '|' + 'ipBlock' + '|' + str(blockedIPAddress) + '|' + str(jail) + '|' + str(live))
if __name__ == "__main__":
main()

View file

@ -34,7 +34,7 @@ CREATE TABLE monutil_ipblock (
CREATE TABLE monutil_geoip (
geoID BIGINT AUTO_INCREMENT PRIMARY KEY,
logID BIGINT NOT NULL,
hostname VARCHAR(255) NOT NULL,
hostname VARCHAR(255),
city VARCHAR(255),
region VARCHAR(255),
country VARCHAR(255),

View file

@ -34,7 +34,7 @@ CREATE TABLE monutil_ipblock (
CREATE TABLE monutil_geoip (
geoID BIGINT IDENTITY(1,1) PRIMARY KEY,
logID BIGINT NOT NULL,
hostname NVARCHAR(255) NOT NULL,
hostname NVARCHAR(255),
city NVARCHAR(255),
region NVARCHAR(255),
country NVARCHAR(255),

View file

@ -34,7 +34,7 @@ CREATE TABLE monutil_ipblock (
CREATE TABLE monutil_geoip (
geoID BIGSERIAL PRIMARY KEY,
logID BIGINT NOT NULL,
hostname VARCHAR(255) NOT NULL,
hostname VARCHAR(255),
city VARCHAR(255),
region VARCHAR(255),
country VARCHAR(255),