Python script on github

After a looooooooooong time i finaly uploaded the script on github.

It wasn’t updated when i did it because of some issues with my pc and github.

https://github.com/victor1tnet/pfteam4

Posted in Uncategorized | Leave a comment

Use case diagram for Squid proxy

Posted in Uncategorized | Leave a comment

End of Iteration 4

Getting closer and closer to the and of the project, we’ve been working hard to tie up loose ends and make everything look nice.

We’ve gotten the router/firewall up and running, the Nagios server monitors the web and proxy servers and we’ve made a script that e-mails us the changes made to the logfiles on the webserver.

All in all this iteration turned out pretty well. We worked hard and got most of the things

we wanted done in time.

Next assignment is to write the final report.

Team 4.

Posted in Uncategorized | Leave a comment

Final system overview

Posted in Uncategorized | Leave a comment

Python LogSending script

UPDATE:

SCRIPT ON GITHUB : https://github.com/victor1tnet/pfteam4

I have used python to read a log file and send its line through emails. The emails are sent using the smtplib class from python and the gmail smtp.

Due to some issues my machine has with github i will post the code here:

”’
this should send an email with every new line in the log file
what it does now?
– it uses gmails smtp
– it sends nice html emails
– it sends emails with each and every line in the file
what to do next?
– make it send emails with only the new lines
”’

import os
import time
import smtplib

#defining the sending fuction
def sending(line):
fromaddr = ‘mail@mail.com’
toaddrs  = ‘mail@mail.com’
msg = “””From: SellThruUs Webserver <webserver@pfteam4.com>
To: SellThruUs Admin<admin@pfteam4.com>
MIME-Version: 1.0
Content-type: text/html
Subject: there is activity on the server

<h1>This is the event:</h1>
“””+line
# Credentials (if needed)
username = ‘yourgmailusername’
password = ‘yourgmailpassword’

# The actual mail send
server = smtplib.SMTP(‘smtp.gmail.com:587′)
server.starttls()
server.login(username,password)
server.sendmail(fromaddr, toaddrs, msg)
print(“Your E-Mail has been sent!”)
server.quit()

f = open(r’/var/log/auth.log’, ‘r’)

while True:
lines = f.readlines()
primelength=len(lines)
print primelength
for line in lines:
print line
sending(line)
time.sleep(5)

Posted in Uncategorized | Leave a comment

Enable Apache Status page

/opt/lampp/etc/httpd.conf

remove comment from :

#Include etc/extra/httpd-info.conf

(this enables http://localhost/server-status)

/opt/lampp/etc/extra/httpd-info.conf

change from the default example (.example.com) to:

(this allows only localhost to connect to http://localhost/server-status)

<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost
</Location>

remove comment from:

#ExtendedStatus On

add comment to:

<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
Allow from .example.com
</Location>

Restart XAMPP/LAMPP

Now access localhost/server-status and localhost/server-info.

For an automatic refresh of the page access localhost/server-status?refresh=N

Posted in Uncategorized | Leave a comment

GoAccess for the website

” GoAccess is an open source real-time Apache log analyzer and interactive viewer that runs in a terminal in *nix systems. It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly. ” (http://goaccess.prosoftcorp.com/)

The reason why i choose goaccess is clearly visible from its description on the its home page.

How:

# to install

sudo apt-get install goaccess

# to get a readable output of the access log file

goaccess -f /opt/lampp/logs/access_log -s -b -a

# remote viewing the readable output of the access file

ssh root@192.168.1.114 ‘cat /opt/lampp/logs/access_log’ | goaccess -s -a -b

(instead of root@192.168.1.114 use what ever user and remote server you have : user@remoteserver)

 

Posted in Uncategorized | Leave a comment

System overview v0.3

Posted in Uncategorized | Leave a comment

Tasklist for week 4

– write report introduction (done – Victor)

– make end of iteration blogpost

– update block diagram (again) (done – Victor)

– come up with python script ideea

– write and implement python script

–  make mirror server

– make mail server

–to be continued–

Posted in Uncategorized | Leave a comment

End of iteration 3

Task list – https://projectfirewall4.wordpress.com/2012/02/10/tasklist-for-week3/

Tasklist – done

– login for proxy(johan)

– update the block diagram(victor)

– use case for employees on how to use the proxy(johan)

– research on mirror server(alexandru)

Timetable

Victor Johan  Alexandru Sarunas Sum
 Admin(meetup)  1  1  1 0
 Focussed(taskwork)  16  16  4 0
 Unfocussed(background)  4  5  0 0
 Sum (hours) 0

Red Leader – Johan Green leader – Victor

Posted in Uncategorized | Leave a comment