Last active
October 2, 2017 19:26
-
-
Save kanazux/272f43933f0e7c17be99 to your computer and use it in GitHub Desktop.
Install squid3 + samba4 + krb5 + pfsense2.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python | |
# -*- coding: utf-8 -*- | |
# | |
# Get files for squid33 on packages server of the pfSense | |
# Author: Silvio Giunge a.k.a Kanazuchi | |
# 1410180880 | |
# a2FuYXp1Y2hpQGFsdm9saXZyZS5jb20= | |
# | |
import os | |
import re | |
from urllib2 import urlopen | |
import xml.etree.ElementTree as etree | |
xml_file = etree.fromstring(urlopen('https://packages.pfsense.org/packages/config/squid3/33/squid.xml').read()) | |
def sync_files(xml_file): | |
for child in xml_file.findall('additional_files_needed'): | |
print "Reading file from \033[93m%s\033[97m" % child[2].text | |
file_name = os.path.split(child[2].text)[1] | |
print "Creating file \033[97m%s in \033[93m%s\033[97m" % (file_name, child[0].text) | |
path_file = os.path.join(child[0].text, file_name) | |
new_file = urlopen(child[2].text).read().split('\n') | |
for line in new_file: | |
print >> open(path_file, 'a'), line | |
print "Give permisson \033[93m%s\033[97m for \033[93m%s\033[97m in \033[93m%s\033[97m" % (child[1].text,file_name,child[0].text) | |
os.system('chmod %s %s' % (child[1].text,path_file)) | |
print '' | |
sync_files(xml_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Install packages for webfilter | |
# Author: Silvio Giunge a.k.a Kanazuchi | |
# 1410180880 | |
# a2FuYXp1Y2hpQGFsdm9saXZyZS5jb20= | |
# | |
SAMBAPATH="/var/run/samba4" | |
CONFPATH="/usr/local/etc" | |
SQUIDPATH="/usr/local/etc/squid" | |
pkg add -f txz_files/expat-2.1.0_1.txz | |
pkg add -f txz_files/gettext-0.18.3.1_1.txz | |
pkg add -f txz_files/cyrus-sasl-2.1.26_8.txz | |
pkg add -f txz_files/openldap-client-2.4.39_1.txz | |
pkg add -f txz_files/perl5-5.16.3_11.txz | |
pkg add -f txz_files/cups-client-1.7.3_2.txz | |
pkg add -f txz_files/libffi-3.0.13_1.txz | |
pkg add -f txz_files/pcre-8.35.txz | |
pkg add -f txz_files/python27-2.7.8_4.txz | |
pkg add -f txz_files/python2-2_3.txz | |
pkg add -f txz_files/glib-2.36.3_3.txz | |
pkg add -f txz_files/ca_root_nss-3.16.3.txz | |
pkg add -f txz_files/libtasn1-4.1.txz | |
pkg add -f txz_files/p11-kit-0.20.3_1.txz | |
pkg add -f txz_files/gmp-5.1.3_2.txz | |
pkg add -f txz_files/gnutls-3.2.16_4.txz | |
pkg add -f txz_files/pkgconf-0.9.6_1.txz | |
pkg add -f txz_files/libgpg-error-1.13_1.txz | |
pkg add -f txz_files/samba4-4.0.21.txz | |
pkg add -f txz_files/krb5-1.12.2.txz | |
pkg add -f txz_files/avahi-app-0.6.31_2.txz | |
pkg add -f txz_files/squid33-3.3.13.txz | |
if [ ! -d ${SAMBAPATH} ]; then | |
mkdir /var/run/samba4 | |
fi | |
if [ ! -d "$SAMBAPATH/winbindd_privileged" ]; then | |
mkdir /var/run/samba4/winbindd_privileged | |
chmod 0755 /var/run/samba4/winbindd_privileged | |
fi | |
if [ ! -d "$SAMBAPATH/winbindd" ]; then | |
mkdir /var/run/samba4/winbindd | |
fi | |
echo 'smbd_enable="YES"' >> /etc/rc.conf | |
echo 'nmbd_enable="YES"' >> /etc/rc.conf | |
echo 'winbindd_enable="YES"' >> /etc/rc.conf | |
echo 'samba_server_enable="YES"' >> /etc/rc.conf | |
if [ ! -e "/usr/local/lib/libgnutls.so.26" ]; then | |
ln -s /usr/local/lib/libgnutls.so.28 /usr/local/lib/libgnutls.so.26 | |
fi | |
if [ ! -e "/usr/local/lib/libtasn1.so.7" ]; then | |
ln -s /usr/local/lib/libtasn1.so.6 /usr/local/lib/libtasn1.so.7 | |
fi | |
if [ ! -e "/lib/libreadline.so.6" ]; then | |
ln -s /lib/libreadline.so.8 /lib/libreadline.so.6 | |
fi | |
#exec rehash | |
echo "*********" | /usr/local/bin/kinit ****@*******.***** | |
net ads join -U ****%******** | |
service samba_server restart | |
if [ ! -d "/var/squid/cache" ]; then | |
mkdir /var/squid/cache | |
fi | |
chown -R proxy:proxy /var/squid/cache/ | |
if [ ! -d "/usr/local/etc/squid/certificates" ]; then | |
mkdir /usr/local/etc/squid/certificates | |
fi | |
chown -R proxy:proxy /usr/local/etc/squid/certificates | |
openssl genrsa 2048 > "$SQUIDPATH/certificates/squidkey.pem" | |
echo -e "BR\nSao Paulo\nLimeira\nBluePex\nBP\n*\[email protected]\n" | openssl req -new -x509 -days 3650 -key "$SQUIDPATH/certificates/squidkey.pem" -out "$SQUIDPATH/certificates/squidcrt.pem" | |
openssl x509 -in "$SQUIDPATH/certificates/squidcrt.pem" -outform DER -out "$SQUIDPATH/certificates/squid.der" | |
/usr/local/libexec/squid/ssl_crtd -c -s /usr/local/etc/squid/ssl_db |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi, mr Silvio.
im newbie. i downloaded your scripts but an have some error when i run install_squid_samba_krb.sh
its here
pkg: txz_files/expat-2.1.0_1.txz: No such file or directory
pkg: Was 'pkg install txz_files/expat-2.1.0_1.txz' meant?
...
and some error same.
can you help me?
tks very much.