/Dev/Zero Linux

Amazon Linux 2 php 7.4 php-imap fix

Dec
02

I think it’s fucking retarded that Amazon does not build imap support in their upstream main php repo. They should probably take one of their million developers and just fix this and not make us have to use other repos or start to manually maintaining their bullshit php package.

So Amazon go fuck yourself and fix your shit.

Step 1. Enable php 7.4 support in Amazon Linux 2

amazon-linux-extras enable php7.4

Step 2. Install your regular php packages

Step 3. Download the Source

cd ~
yumdownloader --source php

# Yum will download a file called php-7.4.xxx.amzn2.src.rpm
rpm -ihv php-7.4.xxx.amzn2.src.rpm
cd ~rpmbuild/SPECS/

# open php.spec with your favorite editor look for with_libcclient # and change to 1
with_libcclient 1
# Save

Step 4.Install Development tools

yum group install "Development Tools"

Step 5. Install php required packages

Since these packages might change from version to version i won’t post them here.

cd ~rpmbuild/SPECS/
rpmbuild -ba php.spec

# You will get a list of required packages just install them with yum
#Example
rpmbuild -ba php.spec
        bzip2-devel is needed by php-7.4.11-1.amzn2.x86_64
        curl-devel >= 7.9 is needed by php-7.4.11-1.amzn2.x86_64
        httpd-devel >= 2.0.46-1 is needed by php-7.4.11-1.amzn2.x86_64
        pam-devel is needed by php-7.4.11-1.amzn2.x86_64
        sqlite-devel >= 3.6.0 is needed by php-7.4.11-1.amzn2.x86_64
        libedit-devel is needed by php-7.4.11-1.amzn2.x86_64
        libtool-ltdl-devel is needed by php-7.4.11-1.amzn2.x86_64
        libzip-devel >= 0.11 is needed by php-7.4.11-1.amzn2.x86_64
        systemtap-sdt-devel is needed by php-7.4.11-1.amzn2.x86_64
        libacl-devel is needed by php-7.4.11-1.amzn2.x86_64
        systemd-devel is needed by php-7.4.11-1.amzn2.x86_64
        libc-client-devel is needed by php-7.4.11-1.amzn2.x86_64
        cyrus-sasl-devel is needed by php-7.4.11-1.amzn2.x86_64
        openldap-devel is needed by php-7.4.11-1.amzn2.x86_64
        postgresql-devel is needed by php-7.4.11-1.amzn2.x86_64
        unixODBC-devel is needed by php-7.4.11-1.amzn2.x86_64
        libxml2-devel is needed by php-7.4.11-1.amzn2.x86_64
        net-snmp-devel is needed by php-7.4.11-1.amzn2.x86_64
        libxslt-devel >= 1.0.18-1 is needed by php-7.4.11-1.amzn2.x86_64
        libxml2-devel >= 2.4.14-1 is needed by php-7.4.11-1.amzn2.x86_64
        oniguruma-devel is needed by php-7.4.11-1.amzn2.x86_64
        libjpeg-devel is needed by php-7.4.11-1.amzn2.x86_64
        freetype-devel is needed by php-7.4.11-1.amzn2.x86_64
        libXpm-devel is needed by php-7.4.11-1.amzn2.x86_64
        libwebp-devel is needed by php-7.4.11-1.amzn2.x86_64
        gmp-devel is needed by php-7.4.11-1.amzn2.x86_64
        libdb-devel is needed by php-7.4.11-1.amzn2.x86_64
        tokyocabinet-devel is needed by php-7.4.11-1.amzn2.x86_64
        aspell-devel >= 0.50.0 is needed by php-7.4.11-1.amzn2.x86_64
        libicu-devel >= 4.0 is needed by php-7.4.11-1.amzn2.x86_64
        enchant-devel >= 1.2.4 is needed by php-7.4.11-1.amzn2.x86_64
        pkgconfig(libsodium) >= 1.0.9 is needed by php-7.4.11-1.amzn2.x86_64

yum install bzip2-devel curl-devel httpd-devel pam-devel sqlite-devel libedit-devel libtool-ltdl-devel libzip-devel systemtap-sdt-devel libacl-devel systemd-devel libc-client-devyrus-sasl-devel openldap-devel postgresql-devel unixODBC-devel libxml2-devel net-snmp-devel libxslt-devel libxml2-devel oniguruma-devel libjpeg-devel freetype-devel libXpm-devel libwebp-devel gmp-devel libdb-devel tokyocabinet-devel aspell-devel libicu-devel enchant-devel libsodium

#Make sure to install libsodium-devel

Step 6. Recompile php with imap support and install the missing extension.

cd ~rpmbuild/SPECS/
rpmbuild -ba php.spec
....
# once done compiling
yum install ~/rpmbuild/RPMS/x86_64/php-imap-xxx.amzn2.x86_64.rpm

Step 7. go fuck yourself Amazon

Fix proftpd-utils on Amazon Linux

Nov
16

Amazon just fix your shit please!!

Anyway if you are trying to install proftpd-utils on Amazon linux probably you’ve ran into this beauty:

Error: Package: perl-Crypt-Cracklib-1.7-1.el6.x86_64 (epel)
Requires: perl(:MODULE_COMPAT_5.10.1)

How to fix it:

yum group install “development tools”

yum install perl-CPAN cracklib-devel perl-Mail-Sendmail

perl -MCPAN -e shell

enter….enter all the way to the prompt cpan[1]>

install Crypt::Cracklib

At the time of this writing Amazon Linux uses proftpd-1.3.3g-10.el6.x86_64 so you will need to find proftpd-utils-1.3.3g-10.el6.x86_64.rpm

here is a mirror: ftp://mirror.switch.ch/pool/4/mirror/epel/6/x86_64/Packages/p/proftpd-utils-1.3.3g-10.el6.x86_64.rpm

rpm -ihv –nodeps ftp://mirror.switch.ch/pool/4/mirror/epel/6/x86_64/Packages/p/proftpd-utils-1.3.3g-10.el6.x86_64.rpm

 

That’s it.

 

 

 

 

 

AWS cross region ipsec VPN using Vyos and Amazon VPN

Oct
10

This has been a very challenging task but I was able to get it working after a lot of trials.

Task

You need to connect a AWS VPC running in Europe with a AWS VPC running in US.

Since i wanted to learn more about AWS I decided that i will be using the amazon VPN and connect it to a Vyatta/Vyos router running on the other end.

I will try to keep this simple.Once you have everything up and running go back and expand/secure everything.

This is not a in depth guide and i assumed you know how to setup a VPC, setup static routes ,assign IP’s etc…

VPC 1 ) Name US-VPC

IP Range : 10.100.0.0/18

Network ACL => default allow all both directions

1 public subnet 10.100.0.0/24

1 private subnet 10.100.1.0/20

1 public Route 0.0.0.0/0 => IGW

1 private route no 0.0.0/0 => nat instance

VPC 2) EU-Name EU-VPC

IP Range : 10.100.64.0/18

Network ACL => default allow all both directions

1 public subnet 10.100.64.0/24

1 private subnet 10.100.65.0/24

1 public Route 0.0.0.0/0 => IGW

1 private route no 0.0.0/0 => nat instance

Continue reading “AWS cross region ipsec VPN using Vyos and Amazon VPN” »

Compile php 5.3 on Centos 7 from RPM

Nov
05

Updated 5/7/2019

I recently had to build php 5.3.29 on a brand new Centos 7 Digital Ocean droplet.

Pretty simple process but I thought it would be a good idea to share my steps…

This will be a general simple to follow how-to on a brand new centos 7.x machine.

  1. Install the epel repo and rpm tools.

sudo yum -y install epel-release rpm-build rpmdevtools wget

  1. install the Centos development tools and libraries.

sudo yum -y groupinstall “Development Tools” “Server Platform Development” “Additional Development” “Compatibility libraries”

sudo yum -y install db4-devel pam-devel libedit-devel libtool-ltdl-devel libc-client-devel sqlite2-devel t1lib-devel libmcrypt-devel libtidy-devel freetds-devel aspell-devel recode-devel enchant-devel

  1. Setup the rpm build directory environment. 

cd ~

rpmdev-setuptree

  1. Download the Centos 6 src rpm and rebuild it.

This rpm is based on the php-5.3.23-1.el6.remi.src.rpm that I modified to include the latest version of php 5.3 (5.3.29) and also fixed any pathing issues between Centos 6 and Centos 7.

wget https://dev-zero.org/files/php-5.3.29-1.el7.src.rpm

rpmbuild –rebuild php-5.3.29-1.el7.src.rpm

When the process is done you will have your Centos 7 php 5.3.29 rpm’s.

Wrote: ~/rpmbuild/RPMS/x86_64/php-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-cli-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-fpm-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-common-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-devel-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-imap-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-ldap-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-pdo-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-sqlite-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-mysql-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-mysqlnd-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-pgsql-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-process-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-odbc-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-soap-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-snmp-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-xml-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-xmlrpc-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-mbstring-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-gd-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-bcmath-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-dba-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-mcrypt-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-tidy-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-mssql-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-embedded-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-pspell-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-recode-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-intl-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-enchant-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-debuginfo-5.3.29-1.el7.x86_64.rpm

All you have to do now is install them via yum.