Sunday, June 21, 2009

Sendmail : Put in a size restriction

Tested On CentOS 5 - Sendmail 8.13.8

1)Edit sendmail.mc

Add the following

define(`confMAX_MESSAGE_SIZE', `5000')


2)m4 sendmail.mc > sendmail.cf


Sunday, June 7, 2009

Creating a Custom Error SQUID

Tested On-CentOS 4.4 w/ Custom SQUID 3.0.STABLE15


1)Add the following entries

deny_info ERR_AUTH_PROXY ntlm_users #ntlm_users is my NTLM Authentication acl , change it to whatever you configured it with.

2)On the filesystem create the following file and add the customized entries

/usr/local/squid/share/errors/templates/ERR_AUTH_PROXY

3)Restart squid , or check with squid -d 1 if the entries are good.

Saturday, May 30, 2009

Weird Samba Error when upgrading SAMBA

So I've been trying to upgrade SAMBA , but I keep getting this error.I've downloaded SAMBA , from samba.org and use the RHEL /packaging/RHEL/makerpms.sh to try and upgrade it , and I would constantly get this error.


Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1


RPM build errors:
File not found: /var/tmp/samba-3.3.4-root/usr/sbin/cifs.upcall
File not found by glob: /var/tmp/samba-3.3.4-root/usr/share/man/man8/cifs.upcall.8.*
makerpms.sh: Done.

The solution was to install the keyutils-devel package

1)yum install keyutils-devel

Tuesday, May 26, 2009

Samba - Act as a domain controller

Tested on Samba - Samba Version 3.0.10-1.4E.9


1)Put in the following changes in Samba

workgroup = MYGROUP # This will be the Domain Name
netbios name = HOSTNAME
server string = Samba Server %v %h
security = user
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
unix password sync = yes

passwd program = /usr/bin/passwd %u
passwd chat = *New*password* %n\n *Please*retype*new*password* %n\n *password*successfully*updated*


local master = yes

os level = 64

domain master = yes

preferred master = yes

domain logons = yes

logon drive = P:

logon script = netlogon.bat

#=== shares ===
[homes]
comment = Home Directories
browseable = no
writable = yes
valid users = %S
create mode = 0664
directory mode = 0775

[netlogon]
comment = Network Logon Service
path = /home/samba/netlogon
writable = no
share modes = no

[Profiles]
path = /home/samba/profiles
browseable = no


2)Adding the appropriate directories

groupadd -g 300 admins
groupadd -g 301 machines

groupadd -g 302 users

mkdir -m 0775 -p /home/samba/netlogon
chown root.admins /home/samba/netlogon
mkdir /home/samba/profiles

3)Add machine + User accounts

Change the default shell in /etc/default/useradd and change the SHELL=/sbin/nologin

useradd -g machines -d /dev/null computer$

passwd -l computer$

smbpasswd -a -m computer

useradd -g users -d /home/samba/profiles/userx userx

passwd userx

smbpasswd -a userx


Add a Samba account for root , used to join the network

smbpasswd -a root


4)Run testparm -v , and if OK restart

SQUID - Traffic Management via Delay Pools

Tested ON - Centos 4 SQUID 3

1)Build SQUID with delay pool options

./configure --enable-delay-pools

2)Configure squid with the following options

delay_pools 1
delay_class 1 2
delay_access 1 allow localnet
delay_parameters 1 64000/64000 32000/32000 16000/16000

3)Restart and test squid

Saturday, May 16, 2009

SQUID - Allowing internet traffic to go through a different gateway

Tested - CentOS 5- Custom iptables 1.4.1

1)iptables -t mangle -I OUTPUT -m owner --uid-owner squid -j MARK --set-mark 0x1

2)iptables-save > /etc/sysconfig/iptables

3)edit /etc/iproute2/rt_tables and add a line:
101 squid

4)/etc/sysconfig/network-scripts/rule-eth0:
fwmark 0x1 table 101 pref 1000

/etc/sysconfig/network-scripts/route-eth0:
default via 10.0.0.2 dev eth0 table 101

*You can do this manually:
/sbin/ip rule add fwmark 0x1 table 101 pref 101
/sbin/ip route add default via 10.0.0.2 dev eth0 table 101



5)Restart network service

service network restart

6)Check that the ip rules

ip route list table 101
ip rule show

SQUID - Allow Access via Mac Access

Tested On CentOS 4 w/ custom compiled squid SQUID 3.0

1)Configure squid with the following options

/configure --enable-arp-acl

2)make
3)make install
4)If you have a init.d script configure it for bootup , copy and configure it otherwise do some /etc/rc.local magic
5)Edit /usr/local/squid/etc/squid.conf

acl ACLARP arp "/usr/local/squid/etc/mac.conf"

*Put this before your localnets config

http_access deny !ACLARP


6)Edit the
/usr/local/squid/etc/mac.conf file

11:12:13:14:15:16

7)Stop and restart squid

service squid restart
service squid start
or whatever other method


8)Test

Followers