Squid: Compile with SSL support under Debian Wheezy / Jessie

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/scripts/master/compile.squid.with.ssl.support.sh -O - | bash -s


# add Debian Wheezy backports repository
cat <<EOF> /etc/apt/sources.list.d/wheezy-backports.list
deb http://ftp.de.debian.org/debian wheezy-backports main
deb-src http://ftp.de.debian.org/debian wheezy-backports main
# update repository list
apt-get update
# install required dev packages
apt-get install -y wget openssl devscripts build-essential libssl-dev
# install debian squid3 source code
apt-get source -y squid3
# install all required dependeny packages
apt-get build-dep -y squid3
# enable SSL support
wget -q http://dl.panticz.de/squid/squid3-3.4.8_enable_ssl.diff -O - | patch -p2 squid3-3.4.8/debian/rules
# build packages
cd squid3-3.4.8
debuild -us -uc

Install packages
apt-get install logrotate
dpkg -i *.deb
apt-get install -f

Test configuration
# squid3 -v
Squid Cache: Version 3.4.8
configure options: '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--libexecdir=${prefix}/lib/squid3' '--srcdir=.' '--disable-maintainer-mode' '--disable-dependency-tracking' '--disable-silent-rules' '--datadir=/usr/share/squid3' '--sysconfdir=/etc/squid3' '--mandir=/usr/share/man' '--enable-inline' '--disable-arch-native' '--enable-async-io=8' '--enable-storeio=ufs,aufs,diskd,rock' '--enable-removal-policies=lru,heap' '--enable-delay-pools' '--enable-cache-digests' '--enable-icap-client' '--enable-follow-x-forwarded-for' '--enable-auth-basic=DB,fake,getpwnam,LDAP,MSNT,MSNT-multi-domain,NCSA,NIS,PAM,POP3,RADIUS,SASL,SMB' '--enable-auth-digest=file,LDAP' '--enable-auth-negotiate=kerberos,wrapper' '--enable-auth-ntlm=fake,smb_lm' '--enable-external-acl-helpers=file_userip,kerberos_ldap_group,LDAP_group,session,SQL_session,unix_group,wbinfo_group' '--enable-url-rewrite-helpers=fake' '--enable-eui' '--enable-esi' '--enable-icmp' '--enable-zph-qos' '--enable-ecap' '--disable-translation' '--with-swapdir=/var/spool/squid3' '--with-logdir=/var/log/squid3' '--with-pidfile=/var/run/squid3.pid' '--with-filedescriptors=65536' '--with-large-files' '--with-default-user=proxy' '--enable-ssl' '--with-open-ssl=/etc/ssl/openssl.cnf' '--enable-linux-netfilter' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'LDFLAGS=-fPIE -pie -Wl,-z,relro -Wl,-z,now' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security'


Create Ubuntu / Debian SSH network install ISO

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/preseed/master/pxe/scripts/create.network.install.iso.sh -O - | bash -s



# install required applications
wget -q http://mirrors.kernel.org/ubuntu/pool/main/s/syslinux/syslinux_6.03+dfsg-11ubuntu1_amd64.deb -P /tmp/
sudo dpkg -i /tmp/syslinux_6.03+dfsg-11ubuntu1_amd64.deb

# create target directory
mkdir /tmp/iso

# download kernel and initrd
wget -q http://archive.ubuntu.com/ubuntu/dists/${DIST}/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux -O /tmp/iso/linux
wget -q http://archive.ubuntu.com/ubuntu/dists/${DIST}/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz -O /tmp/iso/initrd.gz

# create preseed configuration (and copy to webserver)
cat <<EOF> /tmp/iso/ssh.seed
d-i anna/choose_modules string network-console
d-i preseed/early_command string anna-install network-console

# password authentification
d-i network-console/password password t00r
d-i network-console/password-again password t00r

# or authentication with pre-shared SSH key
#d-i network-console/password-disabled boolean true
#d-i network-console/authorized_keys_url string http://www.example.com/user/ssh/id_rsa.pub

# create isolinux configuration
cat <<EOF> /tmp/iso/isolinux.cfg
default linux
timeout 1
label linux
kernel linux
append initrd=initrd.gz url=http://www.example/preseed/ssh.seed auto=true interface=auto locale=en_US.UTF-8 priority=critical biosdevname=0 --

# copy required files
cp /usr/lib/syslinux/isolinux.bin /tmp/iso

# create iso image
mkisofs -q -V "netinstall" -o /tmp/netinstall.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -r -J /tmp/iso

Fix / update systemd in Debian Jessie LXC container

# fix Debian Jessie LXC container boot error:
Failed to install release agent, ignoring: No such file or directory
Failed to create root cgroup hierarchy: Invalid argument
Failed to allocate manager object: Invalid argument
# list all container with uses Debian Jessie:
grep -l jessie /var/lib/lxc/*/rootfs/etc/os-release
# set container name
# stop container
lxc-stop -n ${CONTAINER} -t 10
# backup container
tar -C /var/lib/lxc --use-compress-program=pbzip2 -cf ${CONTAINER}.$(date -I).tar.bz2 ${CONTAINER}
# upgrade systemd in container
echo "deb h

LXC: create Ubuntu Xenial container

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/lxc/master/create_ubuntu_xenial.sh -O - | bash -s


[ -z ${CONTAINER} ] && CONTAINER=xenial

# force, remove previous container
if [ "$1" == "-f" ]; then
  [ $(sudo lxc-ls ${CONTAINER} | wc -l) -gt 0 ] && sudo lxc-destroy -f -n ${CONTAINER}

# create container
sudo lxc-create -t ubuntu -n ${CONTAINER} -- template-options -r xenial $@

# workaround for "Failed to mount cgroup at /sys/fs/cgroup/systemd: Permission denied"
echo "lxc.aa_profile = unconfined" | sudo tee -a /var/lib/lxc/${CONTAINER}/config

# start container in background
sudo lxc-start -d -n ${CONTAINER}

# wait 3 seconds until network is up
sleep 3

# copy APT proxy configuration from host
APT_PROXY=$(grep -h "Acquire::http::Proxy" /etc/apt/* -r | head -1)
[ -n "${APT_PROXY}" ] && echo ${APT_PROXY} | sudo tee /var/lib/lxc/${CONTAINER}/rootfs/etc/apt/apt.conf.d/01proxy

# update packages in container
sudo lxc-attach -n ${CONTAINER} -- apt-get update
sudo lxc-attach -n ${CONTAINER} -- apt-get dist-upgrade -y

# show containers status
sudo lxc-ls ${CONTAINER} -f

Allow root SSH login with password
sed -i 's|PermitRootLogin without-password|PermitRootLogin yes|' /etc/ssh/sshd_config
sed -i 's|PasswordAuthentication no|PasswordAuthentication yes|' /etc/ssh/sshd_config
service ssh restart


# fallback: install required python2 over SSH on remote machine
ansible example.com -i inventory -u root -m raw -a "apt-get update && apt-get install -y python-minimal"
# Ad-hoc commands
ansible all -i inventory.list -l localhost -u root -m ping
ansible all -s -m shell -a "hostname -f"
ansible all -s -m apt -a 'pkg=nginx state=installed update_cache=true'
ansible all -m shell -a uptime
ansible all -m shell -a "apt-get update"
ansible www.example.com -m setup
ansible all -m setup -i inventory/example.com -u root > /tmp/example.com.inventory.$(date -I).txt
ansible www.example.com -m 


wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/installit/master/install.docker.sh -O - | bash -


# ensure that this script is run by root
if [ $(id -u) -ne 0 ]; then
  sudo $0

# install required packages
apt-get install -y apt-transport-https ca-certificates software-properties-common

# install Docker repository key
wget https://yum.dockerproject.org/gpg -qO- | apt-key add -

# add Docker repository
add-apt-repository "deb https://apt.dockerproject.org/repo/ ubuntu-$(lsb_release -cs) main"

# disable APT proxy for Docker repository
echo 'Acquire::HTTP::Proxy::apt.dockerproject.org "DIRECT";' > /etc/apt/apt.conf.d/99_dockerproject

# update package list
apt-get update

# install Docker
apt-get -y install docker-engine

Brother MFC-1910W

Install printer
wget https://raw.githubusercontent.com/panticz/installit/master/hardware/install.brother-mfc-1910w.sh -O - | bash -



# Install printer
wget -q http://download.brother.com/welcome/dlf101543/mfc1910wlpr-3.0.1-1.i386.deb -P /tmp
wget -q http://download.brother.com/welcome/dlf101542/mfc1910wcupswrapper-3.0.1-1.i386.deb -P /tmp
dpkg -i /tmp/mfc1910*.deb
lpadmin -p Brother-MFC-1910 -E -v socket://${IP}:9100  -P /usr/share/ppd/brother/brother-MFC1910W-cups-en.ppd -o PageSize=A4

# Install scanner
wget -q http://download.brother.com/welcome/dlf006645/brscan4-0.4.3-3.amd64.deb -P /tmp
dpkg -i /tmp/brscan4-0.4.3-3.amd64.deb
brsaneconfig4 -a name=MFC-1910W2 model=MFC-1910W ip=${IP}

Check for newer DEB packages



Install Ansible

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/installit/master/install.ansible.sh -O - | bash -


# install required applications 
sudo apt-get install -y software-properties-common

# add ansible repository
sudo apt-add-repository -y ppa:ansible/ansible

# update package list
sudo apt-get update

# install Ansible
sudo apt-get install -y ansible

# Ansible playbook


cat <<EOF> /etc/ansible/test.yml 
- hosts: all
    - debug: msg="{{ ansible_user_id }}@{{ inventory_hostname }}"
- hosts:
  remote_user: ubuntu
  become: yes
    - name: Update all packages
        update_cache: yes
        upgrade: dist
    - name: Show command output
      command: id
      register: out
    - debug: var=out.stdout_lines
    - name: print to stdout
      command: id
      register: print
    - debug: msg="{{ print.stdout }}"
    - debug: msg="{{ print.stderr }}"
- hosts: all
#  p
Syndicate content