Apache's root directory in my provisions file - apache

I have a question. I finally found out how to change the root directory of apache. I simply have to edit this line of code DocumentRoot /var/www/html but since vagrant is amazing and has this provision script, I thought that I could tell apache the root directory from here.
Because think of it if i could use this provision script for every time I make a new website that would save me a lot of time. I wouldn't have to like go to the config file and change it every time
ADDED:
This is how my provision script looks now:
#!/usr/bin/env bash
PROJECT="foundation"
PROJECT_LOG="foundation"
MYSQL_PASSWORD="wachtwoord"
set -o nounset -o errexit -o pipefail -o errtrace
error() {
local sourcefile=$1
local lineno=$2
echo "ERROR at ${sourcefile}:${lineno}; Last logs:"
grep "${PROJECT}" /var/log/syslog | tail -n 20
}
trap 'error "${BASH_SOURCE}" "${LINENO}"' ERR
oe() { "$#" 2>&1 | logger -t "${PROJECT}" > /dev/null; }
ol() { echo "[${PROJECT_LOG}] $#"; }
export DEBIAN_FRONTEND=noninteractive
ol 'Updating repository caches'
oe sudo apt-get -q -y update
ol 'Adding apt repositories'
oe sudo apt-get -q -y install python-software-properties
oe sudo add-apt-repository ppa:ondrej/php5-5.6
ol 'Updating repository caches (second time)'
oe sudo apt-get -q -y update
ol "Installing misc packages"
oe sudo apt-get -q -y install language-pack-nl
ol 'Installing Apache 2'
oe sudo apt-get -q -y install apache2
oe sudo systemctl restart apache2
oe sudo systemctl status apache2
ol "Installing PHP"
oe sudo apt-get -q -y install php5 libapache2-mod-php5 php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcached php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-xcache
debconf-set-selections <<< 'phpmyadmin phpmyadmin/dbconfig-install boolean true'
debconf-set-selections <<< 'phpmyadmin phpmyadmin/app-password-confirm password ${MYSQL_PASSWORD}'
debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/admin-pass password ${MYSQL_PASSWORD}'
debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/app-pass password ${MYSQL_PASSWORD}'
debconf-set-selections <<< 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2'
ol "Installing PHPmyadmin"
apt-get install -y phpmyadmin
# Make Composer available globally
ln -s /etc/phpmyadmin/apache.conf /etc/apache2/sites-enabled/phpmyadmin.conf
ol 'Installing Sendmail'
oe sudo apt-get -q -y install sendmail
ol 'Restarting Apache 2'
oe sudo systemctl restart apache2
oe sudo systemctl status apache2
ol "Installing MySQL"
oe sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password ${MYSQL_PASSWORD}"
oe sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password ${MYSQL_PASSWORD}"
oe sudo apt-get -q -y install mysql-server mysql-client
oe sudo systemctl restart mysql
oe sudo systemctl status mysql

you can play with sed command to make a replacement in file, something like
sed -i "s/DocumentRoot.*/DocumentRoot <your new path>" <path to httpd/apache2.conf>
PS:
-i makes a backup of your file
DocumentRoot.* will replace all line starting with DocumentRoot (dont remember by heart if there are multiple lines starting with DocumentRoot; in this case, make the correct pattern and not wildcard)
if you have / in your new path, make sure to use \/
The other option (probably a bit more simple) is to push a new conf file under the /etc/apache2/conf-enabled/ directory with your specific setting, in case you have other settings such as VirtualHost or other it will make it more simple

Related

The TLS connection was non-properly terminated in kubernetes

I am doing an apt-get update for installing Kubernetes and I get this message
https://packages.cloud.google.com/apt kubernetes-xenial Release
Could not handshake: The TLS connection was non-properly terminated.
and ofcourse later in the process; ""The repository 'http://apt.kubernetes.io kubernetes-xenial Release' does not have a Release file"
I have the proxies set correctly:
1 in etc-apt-apt.conf.d -proxy.conf
Acquire::ForceIPv4 "true";
and proxies are set for https_proxy; http_proxy and ftp_proxy
and in **
etc conf I have disabled ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
**
Can someone please help me understand what other proxies etc are missing to avoid the TLS error.
Solved the issue:
This was an issue due to be being behind a firewall
The apt-key before the apt-get update instruction was the issue
By rerunning the apt-key using
"curl -sSL
'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xBBEBDCB318AD50EC6865090613B00F1FD2C19886'
| sudo apt-key add - "
instead of the original instruction
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
Full set of instructions
sudo apt-get update
sudo apt-get install docker.io
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add –
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update:

Unable to load Odoo 12 in browser 0.0.0.0:8069 after insllation via sh script

Hi I install odoo 12 in cloud-server in Ubuntu 18.04.3 (LTS) x64 using below script command
Download my installation script from Github and copy it locally:
sudo wget https://raw.githubusercontent.com/Yenthe666/InstallScript/12.0/odoo_install.sh
Edit the file and modify the parameters that you'd like to change:
sudo nano odoo_install.sh
Tip: If you'd like the enterprise version you should set IS_ENTERPRISE to True instead of false.
3. Make the file executable:
sudo chmod +x odoo_install.sh
Execute the script and wait a few minutes for Odoo to install:
./odoo_install.sh
After installation i run command sudo service odoo-server start.
I check the status server is running and active.
But when i try to access in browser 0.0.0.0:8069
Unable to connect
Firefox can’t establish a connection to the server at 206.189.197.248:8069.
the standard binding of odoo is:
bind = '127.0.0.1:8069'
you might change this to 0.0.0.0:8069, but i do not recommend such alike.
You will want to have e.g. nginx to upstream 127.0.0.1:8069
to a real webserver e.g. nginx:
upstream odoo {
socket
server 127.0.0.1:8069; # for a web port socket (we'll use this first)
}
upstream odoo-chat {
server 127.0.0.1:8072;
}
I have a better solution that can be helpful to others.
I have just modified the existing script and it works like a charm.
I modified Yenthe Van Ginneken script
Change requirements libraries installation process.
Add new python libraries and modified specific versions of python libraries.
Change the npm install process.
#!/bin/bash
################################################################################
# Script for installing Odoo on Ubuntu 14.04, 15.04, 16.04 and 18.04 (could be used for other version too)
# Author: Yenthe Van Ginneken
# Modified by: Shahid Raza
#-------------------------------------------------------------------------------
# This script will install Odoo on your Ubuntu 16.04 server. It can install multiple Odoo instances
# in one Ubuntu because of the different xmlrpc_ports
#-------------------------------------------------------------------------------
# Make a new file:
# sudo nano odoo-install.sh
# Place this content in it and then make the file executable:
# sudo chmod +x odoo-install.sh
# Execute the script to install Odoo:
# ./odoo-install
################################################################################
#OE_USER is your system user change name according your system
OE_USER="odoo"
OE_HOME="/$OE_USER"
OE_HOME_EXT="/$OE_USER/${OE_USER}-server"
# The default port where this Odoo instance will run under (provided you use the command -c in the terminal)
# Set to true if you want to install it, false if you don't need it or have it already installed.
INSTALL_WKHTMLTOPDF="True"
# Set the default Odoo port (you still have to use -c /etc/odoo-server.conf for example to use this.)
OE_PORT="8069"
# Choose the Odoo version which you want to install. For example: 12.0, 11.0, 10.0 or saas-18. When using 'master' the master version will be installed.
# IMPORTANT! This script contains extra libraries that are specifically needed for Odoo 12.0
OE_VERSION="12.0"
# Set this to True if you want to install the Odoo enterprise version!
IS_ENTERPRISE="False"
# set the superadmin password
OE_SUPERADMIN="admin"
OE_CONFIG="${OE_USER}-server"
##
### WKHTMLTOPDF download links
## === Ubuntu Trusty x64 & x32 === (for other distributions please replace these two links,
## in order to have correct version of wkhtmltopdf installed, for a danger note refer to
## https://github.com/odoo/odoo/wiki/Wkhtmltopdf ):
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb
WKHTMLTOX_X32=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_i386.deb
#--------------------------------------------------
# Update Server
#--------------------------------------------------
echo -e "\n---- Update Server ----"
# add-apt-repository can install add-apt-repository Ubuntu 18.x
sudo apt-get install software-properties-common
# universe package is for Ubuntu 18.x
sudo add-apt-repository universe
# libpng12-0 dependency for wkhtmltopdf
sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ xenial main"
sudo apt-get update
sudo apt-get upgrade -y
#--------------------------------------------------
# Install PostgreSQL Server
#--------------------------------------------------
echo -e "\n---- Install PostgreSQL Server ----"
sudo apt-get install postgresql -y
echo -e "\n---- Creating the ODOO PostgreSQL User ----"
sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true
#--------------------------------------------------
# Install Dependencies
#--------------------------------------------------
echo -e "\n--- Installing Python 3 + pip3 --"
sudo apt-get install git python3 python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less libpng12-0 gdebi -y
echo -e "\n---- Install python packages/requirements ----"
sudo pip3 install Babel
sudo pip3 install chardet
sudo pip3 install decorator
sudo pip3 install docutils
sudo pip3 install ebaysdk
sudo pip3 install feedparser
sudo pip3 install gevent
sudo pip3 install greenlet
sudo pip3 install html2text
sudo pip3 install Jinja2
sudo pip3 install lxml
sudo pip3 install Mako
sudo pip3 install MarkupSafe
sudo pip3 install mock
sudo pip3 install num2words
sudo pip3 install ofxparse
sudo pip3 install passlib
sudo pip3 install Pillow
sudo pip3 install psutil
sudo pip3 install psycopg2-binary
sudo pip3 install pydot
sudo pip3 install pyldap
sudo pip3 install pyparsing
sudo pip3 install PyPDF2
sudo pip3 install pyserial
sudo pip3 install python-dateutil
sudo pip3 install pytz
sudo pip3 install pyusb
sudo pip3 install qrcode
sudo pip3 install reportlab
sudo pip3 install requests
sudo pip3 install suds-jurko
sudo pip3 install vatnumber
sudo pip3 install vobject
sudo pip3 install Werkzeug==0.11.15
sudo pip3 install XlsxWriter
sudo pip3 install xlwt
sudo pip3 install xlrd
sudo pip3 install pypiwin32
sudo pip3 install libsass==0.12.3
echo -e "\n---- Installing nodeJS NPM and rtlcss for LTR support ----"
sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less less-plugin-clean-css
sudo apt-get install -y node-less
#--------------------------------------------------
# Install Wkhtmltopdf if needed
#--------------------------------------------------
if [ $INSTALL_WKHTMLTOPDF = "True" ]; then
echo -e "\n---- Install wkhtml and place shortcuts on correct place for ODOO 12 ----"
#pick up correct one from x64 & x32 versions:
if [ "`getconf LONG_BIT`" == "64" ];then
_url=$WKHTMLTOX_X64
else
_url=$WKHTMLTOX_X32
fi
sudo wget $_url
sudo gdebi --n `basename $_url`
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
else
echo "Wkhtmltopdf isn't installed due to the choice of the user!"
fi
echo -e "\n---- Create ODOO system user ----"
sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER
#The user should also be added to the sudo'ers group.
sudo adduser $OE_USER sudo
echo -e "\n---- Create Log directory ----"
sudo mkdir /var/log/$OE_USER
sudo chown $OE_USER:$OE_USER /var/log/$OE_USER
#--------------------------------------------------
# Install ODOO
#--------------------------------------------------
echo -e "\n==== Installing ODOO Server ===="
sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT/
if [ $IS_ENTERPRISE = "True" ]; then
# Odoo Enterprise install!
echo -e "\n--- Create symlink for node"
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo su $OE_USER -c "mkdir $OE_HOME/enterprise"
sudo su $OE_USER -c "mkdir $OE_HOME/enterprise/addons"
GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1)
while [[ $GITHUB_RESPONSE == *"Authentication"* ]]; do
echo "------------------------WARNING------------------------------"
echo "Your authentication with Github has failed! Please try again."
printf "In order to clone and install the Odoo enterprise version you \nneed to be an offical Odoo partner and you need access to\nhttp://github.com/odoo/enterprise.\n"
echo "TIP: Press ctrl+c to stop this script."
echo "-------------------------------------------------------------"
echo " "
GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1)
done
echo -e "\n---- Added Enterprise code under $OE_HOME/enterprise/addons ----"
echo -e "\n---- Installing Enterprise specific libraries ----"
sudo pip3 install num2words ofxparse
sudo npm install -g less
sudo npm install -g less-plugin-clean-css
fi
echo -e "\n---- Create custom module directory ----"
sudo su $OE_USER -c "mkdir $OE_HOME/custom"
sudo su $OE_USER -c "mkdir $OE_HOME/custom/addons"
echo -e "\n---- Setting permissions on home folder ----"
sudo chown -R $OE_USER:$OE_USER $OE_HOME/*
echo -e "* Create server config file"
sudo touch /etc/${OE_CONFIG}.conf
echo -e "* Creating server config file"
sudo su root -c "printf '[options] \n; This is the password that allows database operations:\n' >> /etc/${OE_CONFIG}.conf"
sudo su root -c "printf 'admin_passwd = ${OE_SUPERADMIN}\n' >> /etc/${OE_CONFIG}.conf"
sudo su root -c "printf 'xmlrpc_port = ${OE_PORT}\n' >> /etc/${OE_CONFIG}.conf"
sudo su root -c "printf 'logfile = /var/log/${OE_USER}/${OE_CONFIG}.log\n' >> /etc/${OE_CONFIG}.conf"
if [ $IS_ENTERPRISE = "True" ]; then
sudo su root -c "printf 'addons_path=${OE_HOME}/enterprise/addons,${OE_HOME_EXT}/addons\n' >> /etc/${OE_CONFIG}.conf"
else
sudo su root -c "printf 'addons_path=${OE_HOME_EXT}/addons,${OE_HOME}/custom/addons\n' >> /etc/${OE_CONFIG}.conf"
fi
sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf
sudo chmod 640 /etc/${OE_CONFIG}.conf
echo -e "* Create startup file"
sudo su root -c "echo '#!/bin/sh' >> $OE_HOME_EXT/start.sh"
sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/openerp-server --config=/etc/${OE_CONFIG}.conf' >> $OE_HOME_EXT/start.sh"
sudo chmod 755 $OE_HOME_EXT/start.sh
#--------------------------------------------------
# Adding ODOO as a deamon (initscript)
#--------------------------------------------------
echo -e "* Create init file"
cat <<EOF > ~/$OE_CONFIG
#!/bin/sh
### BEGIN INIT INFO
# Provides: $OE_CONFIG
# Required-Start: \$remote_fs \$syslog
# Required-Stop: \$remote_fs \$syslog
# Should-Start: \$network
# Should-Stop: \$network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Enterprise Business Applications
# Description: ODOO Business Applications
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DAEMON=$OE_HOME_EXT/odoo-bin
NAME=$OE_CONFIG
DESC=$OE_CONFIG
# Specify the user name (Default: odoo).
USER=$OE_USER
# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/etc/${OE_CONFIG}.conf"
# pidfile
PIDFILE=/var/run/\${NAME}.pid
# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c \$CONFIGFILE"
[ -x \$DAEMON ] || exit 0
[ -f \$CONFIGFILE ] || exit 0
checkpid() {
[ -f \$PIDFILE ] || return 1
pid=\`cat \$PIDFILE\`
[ -d /proc/\$pid ] && return 0
return 1
}
case "\${1}" in
start)
echo -n "Starting \${DESC}: "
start-stop-daemon --start --quiet --pidfile \$PIDFILE \
--chuid \$USER --background --make-pidfile \
--exec \$DAEMON -- \$DAEMON_OPTS
echo "\${NAME}."
;;
stop)
echo -n "Stopping \${DESC}: "
start-stop-daemon --stop --quiet --pidfile \$PIDFILE \
--oknodo
echo "\${NAME}."
;;
restart|force-reload)
echo -n "Restarting \${DESC}: "
start-stop-daemon --stop --quiet --pidfile \$PIDFILE \
--oknodo
sleep 1
start-stop-daemon --start --quiet --pidfile \$PIDFILE \
--chuid \$USER --background --make-pidfile \
--exec \$DAEMON -- \$DAEMON_OPTS
echo "\${NAME}."
;;
*)
N=/etc/init.d/\$NAME
echo "Usage: \$NAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
EOF
echo -e "* Security Init File"
sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG
sudo chmod 755 /etc/init.d/$OE_CONFIG
sudo chown root: /etc/init.d/$OE_CONFIG
echo -e "* Start ODOO on Startup"
sudo update-rc.d $OE_CONFIG defaults
echo -e "* Starting Odoo Service"
sudo su root -c "/etc/init.d/$OE_CONFIG start"
echo "-----------------------------------------------------------"
echo "Done! The Odoo server is up and running. Specifications:"
echo "Port: $OE_PORT"
echo "User service: $OE_USER"
echo "User PostgreSQL: $OE_USER"
echo "Code location: $OE_USER"
echo "Addons folder: $OE_USER/$OE_CONFIG/addons/"
echo "Start Odoo service: sudo service $OE_CONFIG start"
echo "Stop Odoo service: sudo service $OE_CONFIG stop"
echo "Restart Odoo service: sudo service $OE_CONFIG restart"
echo "-----------------------------------------------------------"

how to display chunk information using pwndbg

Linux: Ubuntu 16.04
VMware 15
I'm currently learning how to use pwndbg. When I try to display the chunk details using the command heap. It shows one allocated chunk that only displays the addr and size this is what shows up when I do heap inspection rather than displaying prev_size, size, fd, bk, fd_nextsize, bk_nextsize This is what I want it to show
This is the script I used to install pwndbg and its dependencies
#!/bin/sh
# Date: 2020-01-01
# Author: chandler
# Description: pwn environment install script for ubuntu
# Fiel: pwn_env_install.sh
# update source list
## backup the sources.list
echo "updating apt source"
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo chmod 666 /etc/apt/sources.list
## update
echo deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse > /etc/apt/sources.list
echo deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse >> /etc/apt/sources.list
echo deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse >> /etc/apt/sources.list
echo deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse >> /etc/apt/sources.list
## restore
sudo chmod 660 /etc/apt/sources.list
## update
sudo apt-get update -y
# install curl
echo "install curl"
#sudo apt-get install libcurl3-gnutls=7.47.0-1ubuntu2 -y
sudo apt install curl -y
# install ruby
echo "install ruby"
sudo apt-get install ruby -y
echo "install gem"
sudo apt-get install gem -y
# install pip
echo "install python-pip"
sudo apt install python-pip -y
#install vim
echo "install vim"
#sudo apt-get install vim-common=2:7.4.1689-3ubuntu1 -y
sudo apt-get install vim -y
echo "custom configure vim"
cp vimrc ~/.vimrc
#install tmux
echo "install tmux"
sudo apt-get install tmux -y
echo "custom configure tmux"
cp tmux.conf ~/.tmux.conf
# install git
echo "install git"
sudo apt-get install git -y
# install ssh
echo "install ssh server"
sudo apt-get install openssh-server -y
# some lib
echo "install lib:"
echo "\tbiscon"
sudo apt-get install bison -y
echo "\tgawk"
sudo apt-get install gawk -y
echo "\tgcc-multilib"
sudo apt-get install gcc-multilib -y
echo "\tg++-multilib"
sudo apt-get install g++-multilib -y
# install one_gadget
echo "install one_gadget"
sudo gem install one_gadget
# install patchelf
echo "install patchelf"
sudo apt-get install patchelf -y
# install pwntools
echo "install pwntools"
pip install pwntools
# make dir ~/work/soft to install soft
mkdir -p ~/work/soft
# install pwndbg
echo "install pwndbg"
if [ ! -d "$HOME/work/soft/pwndbg" ]; then
git clone https://github.com/pwndbg/pwndbg.git ~/work/soft/pwndbg
(cd ~/work/soft/pwndbg && ./setup.sh)
else
echo "[*] ~/work/soft/pwndbg exists..."
fi
# install peda
echo "install peda"
if [ ! -d "$HOME/work/soft/peda" ]; then
git clone https://github.com/longld/peda.git ~/work/soft/peda
echo "#source ~/work/soft/peda/peda.py" >> ~/.gdbinit
else
echo "[*] ~/work/soft/peda exists..."
fi
# install pwn_debug
echo "install pwn_debug"
if [ ! -d "$HOME/work/soft/pwn_debug" ]; then
git clone https://github.com/ray-cp/pwn_debug.git ~/work/soft/pwn_debug
(cd ~/work/soft/pwn_debug && sudo python setup.py install)
else
echo "[*] ~/work/soft/pwn_debug exists..."
fi
# install zsh
echo "install zsh"
sudo apt-get install zsh -y
## need to exit manually
echo "[!] ENTER exit manually!"
#sh -c "$(curl -fsSL https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh)"
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
bash_aliases=$(cat ~/.zshrc | grep "~/.bash_aliases")
if [ -z "$bash_aliases" ];then
echo "[*] add ~/.bash_aliases in ~/.zshrc"
cat <<EOF >>~/.zshrc
## add ~/.bash_aliases
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
EOF
else
echo "[*] ~/.bash_aliases exists in ~/.zshrc"
fi
## use dircolors
echo "[*] add ~/.dircolors in ~/.zshrc"
dircolors -p > ~/.dircolors
cat <<EOF >>~/.zshrc
## enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
EOF
## install zsh-autosuggestions
if [ ! -d "$HOME/.zsh/zsh-autosuggestions" ]; then
git clone git://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
echo "source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc
else
echo "[*] ~/.zsh/zsh-autosuggestions exists..."
fi
## install zsh-syntax-highlighting
if [ ! -d "$HOME/.zsh/zsh-syntax-highlighting" ]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.zsh/zsh-syntax-highlighting
echo "source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc
else
echo "[*] ~/.zsh/zsh-syntax-highlighting exists...."
fi
sudo apt-get install autojump -y
if [ `grep -c ". /usr/share/autojump/autojump.sh" ~/.zshrc` -eq '0' ]; then
echo "autojump has been installed"
else
echo . /usr/share/autojump/autojump.sh >> ~/.zshrc
fi
sed -i "s/ZSH_THEME=\"robbyrussell\"/ZSH_THEME=\"ys\"/g" ~/.zshrc
# change zsh to default shell
sudo chsh -s /bin/zsh
echo "[*] ENJOY!"
echo "if you wanna install glibc with debug symbols go to ~/work/soft/pwn_debug and execute '/build.sh'"
/bin/zsh
and this is the c file I used for learning
#include<stdio.h>
#include<malloc.h>
#include<unistd.h>
#include<string.h>
int main(){
int size = 0x100;
void *p = malloc(size);
void *junk = malloc(size);
void *q = malloc(size);
void *r = malloc(size);
printf("p:0x%x\n",p);
printf("q:0x%x\n",q);
printf("r:0x%x\n",r);
strcpy(p,"aaaaaaaabbbbbbbb");
strcpy(q,"ccccccccdddddddd");
strcpy(r,"eeeeeeeeffffffff");
sleep(0);
free(p);
sleep(0);
free(q);
sleep(0);
q = malloc(0x600);
sleep(0);
return 0;
}
Use:
heap -v
They changed the command a few months ago to show only relevant fields by default (commit: https://github.com/pwndbg/pwndbg/pull/728). If you use the verbose flag you get all fields, even if they aren't in use.
It took me a while to find as well

Odoo 10 installation never finish (Setting up odoo)

I have odoo installed on my server that I want to update.
The problem is the upgrade procedure never end. The only message is :
Setting up odoo (10.0.20181203) ...
Even after several hours nothing has changed.
I've tried to remove the package and reinstall it but the same thing happens.
The problem is similar to this question (but not with the same version). But for ease of use and maintainability I really prefer use the apt option instead of having install from the sources.
Coud you help me to :
Best option : solve the odoo problem
At least : which log to look to check where the problem is. I've looked on term.log (apt) but it only show the current step and not what the system is doing.
Thanks for your help
#!/bin/bash
################################################################################
# Script for installing Odoo V10 on Ubuntu 16.04, 15.04, 14.04 (could be used for other version too)
################################################################################
##fixed parameters
#odoo
OE_USER="odoo"
OE_HOME="/opt/odoo/$OE_USER"
OE_HOME_EXT="/opt/odoo/$OE_USER/${OE_USER}-server"
#The default port where this Odoo instance will run under (provided you use the command -c in the terminal)
#Set to true if you want to install it, false if you don't need it or have it already installed.
INSTALL_WKHTMLTOPDF="True"
#Set the default Odoo port (you still have to use -c /etc/odoo-server.conf for example to use this.)
OE_PORT="8069"
#Choose the Odoo version which you want to install. For example: 10.0, 9.0, 8.0, 7.0 or saas-6. When using 'trunk' the master version will be installed.
#IMPORTANT! This script contains extra libraries that are specifically needed for Odoo 10.0
OE_VERSION="10.0"
# Set this to True if you want to install Odoo 10 Enterprise!
IS_ENTERPRISE="False"
#set the superadmin password
OE_SUPERADMIN="admin"
OE_CONFIG="${OE_USER}-server"
##
### WKHTMLTOPDF download links
## === Ubuntu Trusty x64 & x32 === (for other distributions please replace these two links,
## in order to have correct version of wkhtmltox installed, for a danger note refer to
## https://www.odoo.com/documentation/8.0/setup/install.html#deb ):
WKHTMLTOX_X64=https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
WKHTMLTOX_X32=https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
#--------------------------------------------------
# Update Server
#--------------------------------------------------
echo -e "\n---- Update Server ----"
sudo apt-get update
sudo apt-get upgrade -y
#--------------------------------------------------
# Install PostgreSQL Server
#--------------------------------------------------
echo -e "\n---- Install PostgreSQL Server ----"
sudo apt-get install postgresql -y
echo -e "\n---- Creating the ODOO PostgreSQL User ----"
sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true
#--------------------------------------------------
# Install Dependencies
#--------------------------------------------------
echo -e "\n---- Install tool packages ----"
sudo apt-get install wget git python-pip gdebi-core -y
echo -e "\n---- Install python packages ----"
sudo apt-get install python-dateutil python-feedparser python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-docutils python-psutil python-mock python-unittest2 python-jinja2 python-pypdf python-decorator python-requests python-passlib python-pil -y python-suds
echo -e "\n---- Install python libraries ----"
sudo pip install gdata psycogreen ofxparse XlsxWriter xlrd
echo -e "\n--- Install other required packages"
sudo apt-get install node-clean-css -y
sudo apt-get install node-less -y
sudo apt-get install python-gevent -y
#--------------------------------------------------
# Install Wkhtmltopdf if needed
#--------------------------------------------------
if [ $INSTALL_WKHTMLTOPDF = "True" ]; then
echo -e "\n---- Install wkhtml and place shortcuts on correct place for ODOO 10 ----"
#pick up correct one from x64 & x32 versions:
if [ "`getconf LONG_BIT`" == "64" ];then
_url=$WKHTMLTOX_X64
else
_url=$WKHTMLTOX_X32
fi
sudo wget $_url
sudo gdebi --n `basename $_url`
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
else
echo "Wkhtmltopdf isn't installed due to the choice of the user!"
fi
echo -e "\n---- Create ODOO system user ----"
sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER
#The user should also be added to the sudo'ers group.
sudo adduser $OE_USER sudo
echo -e "\n---- Create Log directory ----"
sudo mkdir /var/log/$OE_USER
sudo chown $OE_USER:$OE_USER /var/log/$OE_USER
#--------------------------------------------------
# Install ODOO
#--------------------------------------------------
echo -e "\n==== Installing ODOO Server ===="
sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT/
if [ $IS_ENTERPRISE = "True" ]; then
# Odoo Enterprise install!
echo -e "\n--- Create symlink for node"
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo su $OE_USER -c "mkdir $OE_HOME/enterprise"
sudo su $OE_USER -c "mkdir $OE_HOME/enterprise/addons"
GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch 10.0 https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1)
while [[ $GITHUB_RESPONSE == *"Authentication"* ]]; do
echo "------------------------WARNING------------------------------"
echo "Your authentication with Github has failed! Please try again."
printf "In order to clone and install the Odoo enterprise version you \nneed to be an offical Odoo partner and you need access to\nhttp://github.com/odoo/enterprise.\n"
echo "TIP: Press ctrl+c to stop this script."
echo "-------------------------------------------------------------"
echo " "
GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch 10.0 https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1)
done
echo -e "\n---- Added Enterprise code under $OE_HOME/enterprise/addons ----"
echo -e "\n---- Installing Enterprise specific libraries ----"
sudo apt-get install nodejs npm
sudo npm install -g less
sudo npm install -g less-plugin-clean-css
fi
echo -e "\n---- Create custom module directory ----"
sudo su $OE_USER -c "mkdir $OE_HOME/custom"
sudo su $OE_USER -c "mkdir $OE_HOME/custom/addons"
echo -e "\n---- Setting permissions on home folder ----"
sudo chown -R $OE_USER:$OE_USER $OE_HOME/*
echo -e "* Create server config file"
sudo cp $OE_HOME_EXT/debian/odoo.conf /etc/${OE_CONFIG}.conf
sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf
sudo chmod 640 /etc/${OE_CONFIG}.conf
echo -e "* Change server config file"
sudo sed -i s/"db_user = .*"/"db_user = $OE_USER"/g /etc/${OE_CONFIG}.conf
sudo sed -i s/"; admin_passwd.*"/"admin_passwd = $OE_SUPERADMIN"/g /etc/${OE_CONFIG}.conf
sudo su root -c "echo '[options]' >> /etc/${OE_CONFIG}.conf"
sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> /etc/${OE_CONFIG}.conf"
if [ $IS_ENTERPRISE = "True" ]; then
sudo su root -c "echo 'addons_path=$OE_HOME/enterprise/addons,$OE_HOME_EXT/addons' >> /etc/${OE_CONFIG}.conf"
else
sudo su root -c "echo 'addons_path=$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf"
fi
echo -e "* Create startup file"
sudo su root -c "echo '#!/bin/sh' >> $OE_HOME_EXT/start.sh"
sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/openerp-server --config=/etc/${OE_CONFIG}.conf' >> $OE_HOME_EXT/start.sh"
sudo chmod 755 $OE_HOME_EXT/start.sh
#--------------------------------------------------
# Adding ODOO as a deamon (initscript)
#--------------------------------------------------
echo -e "* Create init file"
cat <<EOF > ~/$OE_CONFIG
#!/bin/sh
### BEGIN INIT INFO
# Provides: $OE_CONFIG
# Required-Start: \$remote_fs \$syslog
# Required-Stop: \$remote_fs \$syslog
# Should-Start: \$network
# Should-Stop: \$network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Enterprise Business Applications
# Description: ODOO Business Applications
### END INIT INFO
PATH=/bin:/sbin:/usr/bin
DAEMON=$OE_HOME_EXT/odoo-bin
NAME=$OE_CONFIG
DESC=$OE_CONFIG
# Specify the user name (Default: odoo).
USER=$OE_USER
# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/etc/${OE_CONFIG}.conf"
# pidfile
PIDFILE=/var/run/\${NAME}.pid
# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c \$CONFIGFILE"
[ -x \$DAEMON ] || exit 0
[ -f \$CONFIGFILE ] || exit 0
checkpid() {
[ -f \$PIDFILE ] || return 1
pid=\`cat \$PIDFILE\`
[ -d /proc/\$pid ] && return 0
return 1
}
case "\${1}" in
start)
echo -n "Starting \${DESC}: "
start-stop-daemon --start --quiet --pidfile \$PIDFILE \
--chuid \$USER --background --make-pidfile \
--exec \$DAEMON -- \$DAEMON_OPTS
echo "\${NAME}."
;;
stop)
echo -n "Stopping \${DESC}: "
start-stop-daemon --stop --quiet --pidfile \$PIDFILE \
--oknodo
echo "\${NAME}."
;;
restart|force-reload)
echo -n "Restarting \${DESC}: "
start-stop-daemon --stop --quiet --pidfile \$PIDFILE \
--oknodo
sleep 1
start-stop-daemon --start --quiet --pidfile \$PIDFILE \
--chuid \$USER --background --make-pidfile \
--exec \$DAEMON -- \$DAEMON_OPTS
echo "\${NAME}."
;;
*)
N=/etc/init.d/\$NAME
echo "Usage: \$NAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
EOF
echo -e "* Security Init File"
sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG
sudo chmod 755 /etc/init.d/$OE_CONFIG
sudo chown root: /etc/init.d/$OE_CONFIG
echo -e "* Change default xmlrpc port"
sudo su root -c "echo 'xmlrpc_port = $OE_PORT' >> /etc/${OE_CONFIG}.conf"
echo -e "* Start ODOO on Startup"
sudo update-rc.d $OE_CONFIG defaults
echo -e "* Starting Odoo Service"
sudo su root -c "/etc/init.d/$OE_CONFIG start"
echo "-----------------------------------------------------------"
echo "Done! The Odoo server is up and running. Specifications:"
echo "Port: $OE_PORT"
echo "User service: $OE_USER"
echo "User PostgreSQL: $OE_USER"
echo "Code location: $OE_USER"
echo "Addons folder: $OE_USER/$OE_CONFIG/addons/"
echo "Start Odoo service: sudo service $OE_CONFIG start"
echo "Stop Odoo service: sudo service $OE_CONFIG stop"
echo "Restart Odoo service: sudo service $OE_CONFIG restart"
echo "-----------------------------------------------------------"
Save the above in a file and save with an extension of '.sh'. Then open the terminal from where you saved the file. Then type sudo bash .sh
Hope this will work. Don't forget to put tick mark if this works. Also give me an upvote too.

How do I remove SPDY (mod-spdy)?

I have tested with SPDY how do I get the uninstall now?
dpkg -r -P mod-spdy or dpkg -r -P mod-spdy-*.deb does not work.
What am i doing wrong ?
I installed with:
cd /tmp
wget https://dl-ssl.google.com/dl/linux/direct/mod-spdy-beta_current_amd64.deb
dpkg -i mod-spdy-*.deb
apt-get -f install
cat /etc/apt/sources.list.d/mod-spdy.list
Edit
dpkg -r mod-spdy-beta and dpkg -P mod-spdy-beta and it works: s