implement CVE-2017-7494 (samba cry) on ubuntu server 16.04 - security

Recently my experiment needs to implement CVE-2017-7494 (the so called sambacry), and I am trying to rebuild the vulnerable environment
I am new to this, not very sure how to set all the path and conf right
here is what I did:
# wget https://download.samba.org/pub/samba/stable/samba-4.5.9.tar.gz
# apt-get install acl attr autoconf bison build-essential \
debhelper dnsutils docbook-xml docbook-xsl flex gdb krb5-user \
libacl1-dev libaio-dev libattr1-dev libblkid-dev libbsd-dev \
libcap-dev libcups2-dev libgnutls-dev libjson-perl \
libldap2-dev libncurses5-dev libpam0g-dev libparse-yapp-perl \
libpopt-dev libreadline-dev perl perl-modules pkg-config \
python-all-dev python-dev python-dnspython python-crypto \
xsltproc zlib1g-dev
Reference about the above package.
# tar -xvf samba-4.5.9.tar.gz
# cd samba-4.5.9
# ./configure
# make
# make install
after that I found it installed under /local, and cannot start samba normally because, say, smbd not found, etc
I think it's a problem of path and config file then I tried this to fix it.
But didn't get well realizing.
Would anyone please help?

Since you did not specify a path in your configure parameters, it should be by default at /usr/local/samba/sbin/smbd.
You can try running this in your shell (and add it to your profile) to add it to your path:
export PATH=/usr/local/samba/bin/:/usr/local/samba/sbin/:$PATH

Related

Dependency issue installing google-chrome-stable through Ubuntu docker

I have a Dockerfile that attempts to install the package google-chrome-stable among other packages in Ubuntu (v16 Xenial I think) as part of a Gitlab pipeline step. I have had no issues until recently, when the step started failing with this issue:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
google-chrome-stable : Depends: libu2f-udev but it is not installable
E: Unable to correct problems, you have held broken packages.
It seems like the libu2f-udev has recently become a depends instead of a recommends – but I'm not sure how to fix this. Here is the part of the Dockerfile in question:
FROM -.dkr.ecr.us-east-1.amazonaws.com/ubuntu:xenial
EXPOSE 9222
# Install ubuntu dependencies
RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -yq curl libgconf-2-4
# Install Google Chrome Stable
RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
apt-get install -y wget gnupg && \
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb stable main' >> /etc/apt/sources.list.d/google-chrome.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst ttf-freefont && \
rm -fr /var/lib/apt/lists/* && \
apt-get purge --auto-remove -y curl && \
rm -fr /src/*.deb
I would think the apt-get update before the install would fix this but it is not. Any help is appreciated, thanks!
Edit: also, I know that Ubuntu 16 is no longer receiving standard support (this is a pretty old service I'm working with). If upgrading to v18 or higher would help that would also be good to know
Creating a dummy package which provides libu2f-udev fixes the issue. I followed below steps for Ubuntu 16.04. Install equivs package
sudo apt install equivs
equivs-control libu2f-udev
This creates a file libu2f-udev. Edit this file and give libu2f-udev as value of "Package" and "Provides" keys. Then execute
equivs-build libu2f-udev
This creates dummy package libu2f-udev_1.0_all.deb. Install it by
sudo dpkg -i libu2f-udev_1.0_all.deb
All set.
The contents of the libu2f-udev file should be like this
Tested on 16.04.7 LTS & chrome 110.0.5481.100. In case it is not clear, the libu2f-udev file after editing should look like this:
​### Commented entries have reasonable defaults.
### Uncomment to edit them.
# Source: <source package name; defaults to package name>
Section: misc
Priority: optional
# Homepage: <enter URL here; no default>
Standards-Version: 3.9.2
Package: libu2f-udev
# Version: <enter version here; defaults to 1.0>
# Maintainer: Your Name <yourname#example.com>
# Pre-Depends: <comma-separated list of packages>
# Depends: <comma-separated list of packages>
# Recommends: <comma-separated list of packages>
# Suggests: <comma-separated list of packages>
Provides: libu2f-udev
# Replaces: <comma-separated list of packages>
# Architecture: all
# Multi-Arch: <one of: foreign|same|allowed>
# Copyright: <copyright file; defaults to GPL2>
# Changelog: <changelog file; defaults to a generic changelog>
# Readme: <README.Debian file; defaults to a generic one>
# Extra-Files: <comma-separated list of additional files>
# Files: <pair of space-separated paths;>
# <more pairs, if there's more than one file to include.>
Description: <short description; defaults to some wise words>
long description and info
.
second paragraph

ERROR: SvtAv1Enc not found using pkg-config

I am trying to compile FFmpeg with SVT-AV1 codec, following instructions from here: https://github.com/OpenVisualCloud/SVT-AV1/tree/master/ffmpeg_plugin
Everything goes well, but when I try to run
./configure --enable-libsvtav1
I am getting
ERROR: SvtAv1Enc not found using pkg-config
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user#ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
The content of the ffbuild/config.log: https://pastebin.com/euPriFAp
There is an exact issue on the github: https://github.com/OpenVisualCloud/SVT-AV1/issues/35, but is closed as solved.
I have tried both on my Mac and in the Docker container with Ubuntu 18.04, but getting the same result.
Could anyone please help, what am I doing wrong?
The problem was in the lack of requred libraries. Please find the complete installation instruction below.
Installing packages required for compiling:
sudo apt-get update
sudo apt-get install \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
pkg-config \
texinfo \
wget \
zlib1g-dev
Installing assemblers used by some libraries:
sudo apt-get install nasm
sudo apt-get install yasm
Build and install SVT-AV1:
git clone --depth=1 https://github.com/OpenVisualCloud/SVT-AV1
cd SVT-AV1
cd Build
cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
make -j $(nproc)
sudo make install
Apply SVT-AV1 plugin and enable libsvtav1 to FFmpeg:
cd ~
git clone -b release/4.2 --depth=1 https://github.com/FFmpeg/FFmpeg ffmpeg
cd ffmpeg
export LD_LIBRARY_PATH+=":/usr/local/lib"
export PKG_CONFIG_PATH+=":/usr/local/lib/pkgconfig"
git apply ../SVT-AV1/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-av1.patch
./configure --enable-libsvtav1
(Note: if you want other codecs to be supported please add the required flags to the ./configure command)
Build FFmpeg:
make
make install
hash -r
source ~/.profile
Now you should have ffmpeg command working and have svt-av1 in encoders list:
ffmpeg -encoders
...
V..... libsvt_av1 SVT-AV1(Scalable Video Technology for AV1) encoder (codec av1)
...
I used next docs a reference:
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
https://github.com/OpenVisualCloud/SVT-AV1/tree/master/ffmpeg_plugin

Unable to install php7.1-soap in Ubuntu 19.04

I am running PHP 7.2 on an Apache server on Ubuntu, and I need to add the PHP SoapClient. However, when I try to install it using apt-get, I get the following error:
The following packages have unmet dependencies:
php7.2-soap : Depends: php7.2-common (= 7.2.24-0ubuntu0.19.04.2) but 7.2.26-1+ubuntu19.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
I've tried the following before reattempting:
sudo apt-get update
sudo apt-get clean && sudo apt-get update
sudo apt-get upgrade
sudo apt-get upgrade-dist
sudo apt-get -f install
sudo dpkg --configure -a
If it helps, when I run uname -r the output is
5.0.0-37-generic
Thanks in advance!
After a looooong time tackling this issue I finally got my head around it and found a solution :)
It seems the issue is I was using the ppa:ondrej/apache2 PPA which was installing the latest version of a selection of PHP packages, which at the time of writing is using PHP7.2.27. As far as I can tell, the most up-to-date version of the php7.2-soap package is for php7.2.24, meaning there is an unmet dependency for the php7.2-common package provided by the PPA.
So, the solution was to remove the PPA and downgrade the PHP packages. Here's a step by step for any poor souls who might encounter a similar issue:
First, if not already installed, install aptitude sudo apt-get install aptitude
Next, install ppa-purge:
mkdir ppa-purge && cd ppa-purge && wget http://mirror.pnl.gov/ubuntu/pool/universe/p/ppa-purge/ppa-purge_0.2.8+bzr56_all.deb && wget http://mirror.pnl.gov/ubuntu//pool/main/a/aptitude/aptitude_0.6.6-1ubuntu1_i386.deb && sudo dpkg -i ./*.deb
(I ran this in my user folder, i.e. ~/
Then I remove the PPA with the following commands:
sudo ppa-purge ppa:ondrej/apache2
sudo add-apt-repository --remove ppa:ondrej/apache2
sudo apt-get autoclean
Now we need to downgrade the dependencies. First I determined which version I needed. The package that was causing the unmet dependency was php7.2-common, so I ran sudo apt list -a php7.2-common. I chose the version which matched the original error message, in this case, 7.2.24-0ubuntu0.19.04.2.
So you are able to install a specific version by following the package with a = then a version number. If you, like me, are working on a live server, I'm going to shout this next bit about the next command you will write:
DO NOT USE THE -y TAG!!
CHOOSE "NO" WHEN IT ASKS YOU IF YOU WANT TO CONTINUE!!
If you do any of these, it will automatically remove any dependencies for php7.2-common and the PHP stop working on your site.
To determine which dependencies we need to update along with php7.2-common, I ran sudo apt-get install php7.2-common=7.2.24-0ubuntu0.19.04.2. It then showed me a list of other packages it would remove as well. I copied these dependencies then chose 'n' to cancel the install.
Next, I put the copied list into a text editor and used it to create the following script:
sudo apt-get install php7.2-common=7.2.24-0ubuntu0.19.04.2 \
libapache2-mod-php7.2=7.2.24-0ubuntu0.19.04.2 \
php7.2=7.2.24-0ubuntu0.19.04.2 \
php7.2-bcmath=7.2.24-0ubuntu0.19.04.2 \
php7.2-bz2=7.2.24-0ubuntu0.19.04.2 \
php7.2-cgi=7.2.24-0ubuntu0.19.04.2 \
php7.2-cli=7.2.24-0ubuntu0.19.04.2 \
php7.2-curl=7.2.24-0ubuntu0.19.04.2 \
php7.2-dev=7.2.24-0ubuntu0.19.04.2 \
php7.2-enchant=7.2.24-0ubuntu0.19.04.2 \
php7.2-fpm=7.2.24-0ubuntu0.19.04.2 \
php7.2-gd=7.2.24-0ubuntu0.19.04.2 \
php7.2-imap=7.2.24-0ubuntu0.19.04.2 \
php7.2-intl=7.2.24-0ubuntu0.19.04.2 \
php7.2-json=7.2.24-0ubuntu0.19.04.2 \
php7.2-ldap=7.2.24-0ubuntu0.19.04.2 \
php7.2-mbstring=7.2.24-0ubuntu0.19.04.2 \
php7.2-mysql=7.2.24-0ubuntu0.19.04.2 \
php7.2-odbc=7.2.24-0ubuntu0.19.04.2 \
php7.2-opcache=7.2.24-0ubuntu0.19.04.2 \
php7.2-pspell=7.2.24-0ubuntu0.19.04.2 \
php7.2-readline=7.2.24-0ubuntu0.19.04.2 \
php7.2-tidy=7.2.24-0ubuntu0.19.04.2 \
php7.2-xml=7.2.24-0ubuntu0.19.04.2 \
php7.2-xmlrpc=7.2.24-0ubuntu0.19.04.2 \
php7.2-zip=7.2.24-0ubuntu0.19.04.2
Finally, I ran this command. Instead of warning me about removing the packages, it warned me that these packages would be "downgraded", which is fine. I pressed Y and it reinstalled all the packages and viola! I was then able to install php7.2-soap :)
See these links which I credit to finding a solution for this:
https://askubuntu.com/a/92021
https://appuals.com/fix-unmet-dependencies-error-ubuntu/
I have a similar issue one month ago with a Debian 9 and PHP 7 Did you consider to upgrade your PHP to the latest stable version before installing the PHP Client ?

Ubuntu 16.04 LTS - Can't enable xterm_clipboard in VIM

I use VIM a lot, and have previously been able to get +xterm_clipboard support working by using a script provided in a separate post on StackOverflow. I've re-installed Ubuntu on my machine, and have since migrated from Ubuntu 14.04.4 LTS (Wily) to Ubuntu 16.04 LTS (Xenial).
# Get the compile-dependencies of vim
sudo apt-get build-dep vim
# If you haven't got mercurial, get it
sudo apt-get install mercurial
# Get the source
hg clone https://vim.googlecode.com/hg/ vim_source
# Compile it
cd vim_source
./configure \
--enable-perlinterp=dynamic \
--enable-pythoninterp=dynamic \
--enable-rubyinterp=dynamic \
--enable-cscope \
--enable-gui=auto \
--enable-gtk2-check \
--enable-gnome-check \
--with-features=huge \
--with-x \
--with-compiledby="Your Name <youremail#domain.com>" \
--with-python-config-dir=/usr/lib/python2.7/config
make && sudo make install
However, this no longer works, and I can't make use of ",+,y to yank buffers to the system clipboard. I don't see anything obvious in the .configure output, but vim --version always shows -xterm_clipboard when I build it. How do I fix this?
You should have noticed that the source is no longer hosted on Google code via mercurial (hg) anymore, and has migrated to GitHub in the error messages generated by the provided script.
You'll need to use the new source tree, git, and some developer libraries will need to be installed in advance.
Code Listing (Updated for Ubuntu 18.04 and onward)
# Get the compile-dependencies of vim
sudo apt-get -y build-dep vim
# Install the "checkinstall" tool so the "make install" step is
# wrapped and the result is a .deb file that can be removed later by
# your package manager rather than having to hunt down every file deployed
# by "make install", which might not be possible if it overwrites existing
# system files.
sudo apt-get -y install checkinstall
# Install python dev
sudo apt-get -y install python3-dev
# Install xorg dev
sudo apt-get -y install xorg-dev
# Install git
sudo apt-get -y install git
# Get the source
git clone https://github.com/vim/vim.git vim_source
# Remove ./configure cache in case we have to run this twice due to permissions
# related issues.
rm vim_source/src/auto/config.cache
# Compile it
cd vim_source
make clean distclean
./configure \
--enable-perlinterp=yes \
--enable-python3interp=yes \
--enable-rubyinterp=yes \
--with-python3-command=python3.6 \
--with-python3-config-dir=$(python3.6-config --configdir) \
--enable-cscope \
--enable-gui=auto \
--enable-gtk2-check \
--enable-gnome-check \
--with-features=huge \
--with-x \
--with-compiledby="DevNull <darkstar#/dev/null>"
# Build quickly (parallel jobs).
make -j$(nproc)
# Need root to install
sudo checkinstall

Build Vim with lua on Linux Mint

This is what I did:
# Install lua
curl -R -O http://www.lua.org/ftp/lua-5.2.2.tar.gz
tar zxf lua-5.2.2.tar.gz
cd lua-5.2.2
sudo make linux install
# build vim
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev mercurial
sudo apt-get remove vim vim-runtime gvim
sudo apt-get remove vim-tiny vim-common vim-gui-common
cd ~
hg clone https://code.google.com/p/vim/
cd vim
./configure --with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7-config \
--enable-perlinterp \
--enable-gui=gtk2 --enable-cscope --prefix=/usr \
--enable-luainterp \
--with-lua-prefix=/usr/local/bin/lua
make VIMRUNTIMEDIR=/usr/share/vim/vim74
sudo make install
But the ./configure step returns:
checking --enable-luainterp argument... yes
checking --with-lua-prefix argument... /usr/local/bin/lua
checking --with-luajit... no
checking for lua... (cached) /usr/local/bin/lua
checking Lua version... (cached) 5.2
checking if lua.h can be found in /usr/local/bin/lua/include... no
checking if lua.h can be found in /usr/local/bin/lua/include/lua5.2... no
I can verify that lua.h can't be found in those locations, but I don't know where it can be found.
Edit
I tried this again, ran into problems, and discovered a package vim-nox that already has vim support.
Original answer
I'm not entirely sure how I did this in the end, but thanks to #wrikken for the tip about headers.
# Install lua from binaries (these are out-of-date but at least they worked).
sudo apt-get install lua50 liblua50-dev liblualib50-dev
# Remove old vims
sudo apt-get remove vim vim-runtime gvim
sudo apt-get remove vim-tiny vim-common vim-gui-common
# Download and build a new vim
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev mercurial
cd ~
hg clone https://code.google.com/p/vim/
cd vim
cd ~/vim
./configure --with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7-config \
--enable-perlinterp \
--enable-gui=gtk2 --enable-cscope --prefix=/usr \
--enable-luainterp \
--with-lua-prefix=/usr/local
At this point, check the output of ./configure to see that it found lua.h. If not, find out where it is (I'm afraid I can't remember where it was). Symlink to it in /usr/local with e.g. sudo ln -s ../lua.h and rerun ./configure.
Finally:
sudo make VIMRUNTIMEDIR=/usr/share/vim/vim74
sudo make install
If it still won't work, post on a forum somewhere and go for a walk in the outdoors. You'll find it suddenly starts to behave.
What worked for me:
sudo apt-get install liblua5.1-dev
copy all files from /usr/include/lua5.1/ to /usr/include/lua5.1/include/
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.so /usr/local/lib/liblua.so
Go to the vim source folder
cd src
make distclean
clear
./configure --with-features=huge --enable-cscope --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu --enable-multibyte --enable-fontset --enable-gui=gnome2 --disable-netbeans --enable-luainterp=yes --with-lua-prefix=/usr/include/lua5.1 --enable-largefile --enable-rubyinterp
sudo make
sudo make install
This will also install the GUI version, remove the --enable-gui=gnome2 if you will only use it in the command line.
Most of these I found it in here

Resources