Squid Access Control Lists

You can limit users’ ability to browse the Internet with access control lists (ACLs). Each ACL line defines a particular type of activity, such as an access time or source network, they are then linked to an http_access statement that tells Squid whether or not to deny or allow traffic that matches the ACL.

Squid matches each Web access request it receives by checking the http_access list from top to bottom. If it finds a match, it enforces the allow or deny statement and stops reading further. You have to be careful not to place a deny statement in the list that blocks a similar allow statement below it. The final http_access statement denies everything, so it is best to place new http_access statements above it.

Adding my network on acl.

I can add it in two ways like this

acl my_network src 192.168.1.0/24

or

acl my_network src 192.168.1.0/255.255.255.0

both means my network starts from 192.168.1.0 to 255

Now on http_access section allow this network to access internet

http_access allow my_network

Restricting Web Access By Time

You can create access control lists with time parameters.that is you can allow internet only on working hours etc..Add acl for time

acl work_hours time SMTWHFA 08:00-17:00

SMTWHFA- represents Sunday to Saturday

please ensure there is no space between the time it may cause error..

now modify htt_access with time

http_access allow  my_network  work_hours

Now the machines under my_network will get internet connection only during working hours

Installing and Configuring squid proxy server on ubuntu server

Am using ubuntu 12.04 server edition for this purpose.Squid is a full-featured web proxy cache server application which provides proxy and cache services for  HTTP..

Installation

sudo apt-get install squid3

Configuration

Squid is configured by editing the directives contained within the /etc/squid3/squid.conf configuration file.First make a backup copy of the squid.conf file..Copy the /etc/squid3/squid.conf file and protect it from writing with the following commands entered at a terminal prompt

sudo cp /etc/squid3/squid.conf /etc/squid3/squid.conf.original
sudo chmod a-w /etc/squid3/squid.conf.original

By default squid listens to default TCP port 3128..we can change the port by editing the squid.conf file…

sud vim /etc/squid3/squid.conf

search for http_port…change the http_port directive as you wish am changing it to 8888

http_port 8888

After changing the settings restart squid..For restarting we can use both these commands

sudo /etc/init.d/squid3 restart
or
sudo service squid3 restart

MSP430 Polling Vs Interrupt

In this example other than the usual polling method we uses an interrupt to get the switch reading…
In MSP430 port1 interrupt service routine is written like this

#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{

}

I used code composer studio to get the output of interrupt code…The mspgcc interrupt service routine is like this but i failed to get the output using mspgcc

//port1 interrupt service routine
void Port_1 (void) __attribute__((interrupt(PORT1_VECTOR)));
void Port_1 (void)
{

}

This example also reads switch and toggles light…This is the full code of the interrupt program..

/*interrupt.c
ganeshredcobra@gmail.com
GPL
*/
#include <msp430g2553.h>
#define LED1 BIT0
#define LED2 BIT6
#define BUTTON BIT3
volatile unsigned int i;//to prevent optimization
void main(void)
{
WDTCTL=WDTPW+WDTHOLD;
P1DIR |= (LED1+LED2);//
P1OUT &= ~(LED1+LED2);
P1IE |= BUTTON;
P1IFG &= ~BUTTON;

//__enable_interrupt();//enable all interrupts
_BIS_SR(LPM4_bits+GIE);
for(;;)
{}
}

//port1 interrupt service routine
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
P1OUT ^= (LED1+LED2);
P1IFG &= ~BUTTON;
P1IES ^= BUTTON;
}