Код: Выделить всё
chown :squid /var/db/samba34/winbindd_privileged
Код: Выделить всё
chown :squid /var/db/samba34/winbindd_privileged
Код: Выделить всё
#!/bin/sh
#################################################
# Avto dobavlenie polzovateley v STC is LDAP #
# Roman Perepechaev roman@stniva.ru #
# Version 1.0 kratkaya - polnaya na 192.168.0.5 #
#################################################
#############
### Trebovaniya
# Nado postavit base64 (FreeBSD: /usr/ports/converters/base64 & make install clean )
# Zapuskat posle STC (FreeBSD: cat "01 2 * * * root /usr/local/stc/etc/ntlm/CreateUser.sh" >> /etc/crontab)
#############
### Spisok peremennyh
# Pochta admina
pochta="agafonov@pechersky.ru"
# 400MB po umolchaniy vsem
trafik="0"
# put do konfigov STC
stcpatch="/usr/local/stc/etc"
# put gde lezhat progi
progi="/usr/local/bin"
# tochka poiska v LDAP
ldapdn="ou=users,dc=pechersky,dc=ru"
# Data v tom formate kak i STC
day=`date -v-1d +%d`
month=`date +%m`
year=`date +%Y`
# Put k otchetam SARG (esli pravim put to pravim i kol-vo "-f 10" strokoy nije )
sargdir="/usr/home/www/proxy/sarg/daily/total"
###########
#Preobrazuem datu k formatu stc
if `test $month = 01`
then month=Jan
elif `test $month = 02`
then month=Feb
elif `test $month = 03`
then month=Mar
elif `test $month = 04`
then month=Apr
elif `test $month = 05`
then month=May
elif `test $month = 06`
then month=Jun
elif `test $month = 07`
then month=Jul
elif `test $month = 08`
then month=Aug
elif `test $month = 09`
then month=Sep
elif `test $month = 10`
then month=Nov
elif `test $month = 11`
then month=Oct
elif `test $month = 12`
then month=Dec
else echo "month not finded"
fi
datedir="$day""$month""$year"
#############
# Sozdaem profil iz poluchennyh imen polzovateley (zapolnyarm familiy i imya po russki)
for i in `/usr/bin/find $sargdir/$datedir-$datedir -type d | tail +2 | cut -d "/" -f 10`;
do
# Proveryaem est uje takoi polsovatel ili net ispolsuem neyavnuy konstrukciy
test -s $stcpatch/profiles/$i.profile && continue ||
echo "domain:" >> $stcpatch/profiles/$i.profile
echo "iface:tori" >> $stcpatch/profiles/$i.profile
echo "email:$i@stniva.ru" >> $stcpatch/profiles/$i.profile
echo "lname:`$progi/ldapsearch -H ldap://192.168.32.3 -b "uid=$i,$ldapdn" -x | grep sn | cut -d ":" -f 3 | sed s/^\ //g | $progi/base64 -d | $progi/iconv -f UTF-8 -t CP1251`" >> $stcpatch/profiles/$i.profile
echo "fname:`$progi/ldapsearch -H ldap://192.168.32.3 -b "uid=$i,$ldapdn" -x | grep givenName | cut -d ":" -f 3 | sed s/^\ //g | $progi/base64 -d | $progi/iconv -f UTF-8 -t CP1251`" >> $stcpatch/profiles/$i.profile
echo "mname:" >> $stcpatch/profiles/$i.profile
echo "$i" >> $stcpatch/allow.users
echo "$i" >> $stcpatch/o100.users
echo "$i $trafik" >> $stcpatch/traffic.users
/usr/sbin/chown www: $stcpatch/profiles/$i.profile
echo "$i" >> $stcpatch/password
# Otpravlyaem uvedomlenie na pochtu adminu
echo "New user: $i" | /usr/bin/mail -s"New STC user created" $pochta
done
exit 0
Код: Выделить всё
# ntlm_auth --username=test
password:
NT_STATUS_OK: Success (0x0)
Код: Выделить всё
ee /usr/local/etc/squid/AutoRestart
Код: Выделить всё
#!/bin/sh
#Проверяем, загружен ли Squid, выходим в случае успеха
/usr/local/sbin/squid -k check >/dev/null 2>&1 && return
#Запускаем Squid
/usr/local/etc/rc.d/squid start
Разрешаем запуск скрипта:
chmod 700 /usr/local/etc/squid/AutoRestart
Выполняем тестовый запуск:
/usr/local/etc/rc.d/squid stop
/usr/local/etc/squid/AutoRestart
Код: Выделить всё
printf '\n*/15\t*\t*\t*\t*\troot\t/usr/local/etc/squid/AutoRestart\n' >>/etc/crontab && cat /etc/crontab