linux

Create a restricted user for SSH tunneling

<?php
$URL="https://raw.githubusercontent.com/panticz/scripts/master/create_ssh_tunnel_user.sh";
echo "wget -q --no-check-certificate $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Add your public key(s)
cat /tmp/authorized_keys > /home/tunnel/.ssh/authorized_keys
sed -i 's|ssh-rsa|command="/bin/false",no-pty,no-X11-forwarding ssh-rsa|g' /home/tunnel/.ssh/authorized_keys

# parameter
command="/bin/false",no-agent-forwarding,no-pty,no-user-rc,no-X11-forwarding,permitopen="127.0.0.1:80"
no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding

Links
http://www.gnu.org/software/bash/manual/html_node/The-Restricted-Shell.html

Install Google Music Manager

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.google-musicmanager.sh";
echo "wget -q --no-check-certificate $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

$ cat /etc/apt/sources.list.d/google-musicmanager.list
deb http://dl.google.com/linux/musicmanager/deb/ stable main

Links
https://play.google.com/music/listen?u=0#/manager

Puppet: iPXE boot module

# create module structure
mkdir -p /etc/puppet/modules/ipxe/files
mkdir -p /etc/puppet/modules/ipxe/manifests

# download files
wget -q http://dl.panticz.de/ipxe/ipxe.lkrn -O /etc/puppet/modules/ipxe/files/ipxe.lkrn
wget -q http://dl.panticz.de/ipxe/49_ipxe -O /etc/puppet/modules/ipxe/files/49_ipxe

# download module definiction
<?php
$URL="https://raw.githubusercontent.com/panticz/puppet/master/modules/ipxe/init.pp";
echo "wget -q $URL -O /etc/puppet/modules/ipxe/manifests/init.pp";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Install Gnokii (Manage SMS on USB Stick)

# install
sudo apt-get install -y gnokii

# set permissions (TODO set permissions with udev)
sudo chmod o+rw /dev/ttyUSB0

# configure
cat < .gnokiirc
[global]
model = AT
port = /dev/ttyUSB0
connection = serial
EOF

# show sms status
gnokii --showsmsfolderstatus

# show sms
gnokii --getsms MT 0 end

# show sms and filter for "http"
gnokii --getsms MT 0 2> /dev/null | grep http

# delete sms
gnokii --deletesms MT 0

# Links
http://linuxgazette.net/164/tomar.html
http://wiki.gnokii.org/index.php/SMS_options
http://ubuntuforums.org/showthread.php?t=1123538

Squid

Install
apt-get install -y squid

Configuration /etc/squid3/squid.conf
http_port 80 accel defaultsite=www.example.com vhost
cache_peer 10.0.3.10 parent 80 0 no-query login=PASS originserver name=myAccel1
acl our_sites1 dstdomain 88.99.100.101 .example.com www.foo.com
http_access allow our_sites1
cache_peer_access myAccel1 allow our_sites1
cache_peer_access myAccel1 deny all

# reload configuration
squid3 -k reconfigure

Links
http://www.ehow.de/man-ssl-squid-aktiviert-wie_10142/

Tomcat configuration

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.tomcat.sh";
echo "wget $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

# start
export JAVA_HOME=/usr/lib/jvm/jdk1.6.0
export JAVA_OPTS="$JAVA_OPTS -Xmx256m"
/usr/local/apache-tomcat-5.5.20/bin/startup.sh

# deploy
/opt/SDK2/bin/asadmin deploy /tmp/Intranet.war

# change default port from 8080 to 80

# log directory
/var/log/tomcat6

# redirect by default to a app
mv /var/lib/tomcat6/webapps/ROOT/index.html /var/lib/tomcat6/webapps/ROOT/index.old.html
cat < /var/lib/tomcat6/webapps/ROOT/index.html

EOF

# manager
/etc/tomcat8/tomcat-users.xml
http://YOUR_TOMCAT_IP/manager/html/

# apache module
mod_jk

# LINKS
http://wiki.ubuntuusers.de/Tomcat
http://linux-sxs.org/internet_serving/c581.html
http://shrubbery.mynetgear.net/c/display/W/Disable+Directory+Listing+in+Tomcat
http://wiki.ubuntuusers.de/Tomcat

# https://intranet.sedo.de.intern/confluence/pages/viewpage.action?title=Enable+SSL+in+Tomcat&spaceKey=SOA
# https://ssl-trust.com/ssl-zertifikat-installieren/tomcat
# http://www.torsten-horn.de/techdocs/ssl.htm

UnixBench

# install required packages for compile
apt-get install -y build-essential
# perl perl-modules make

# download
wget -q http://byte-unixbench.googlecode.com/files/UnixBench5.1.3.tgz -O /tmp/UnixBench.tar.gz
tar -C /tmp/ -xzf /tmp/UnixBench.tar.gz
cd /tmp/UnixBench

# patch > 16 core limitation, https://code.google.com/p/byte-unixbench/issues/detail?id=4
wget --no-check-certificate "https://byte-unixbench.googlecode.com/issues/attachment?aid=-1645413311807741160&name=fix-limitation.patch&token=ABZ6GAfTt_8YARok5-o9WLVQDWrlCoUdQw%3A1399886165120" -O /tmp/fix-limitation.patch