Skip to content

Instantly share code, notes, and snippets.

@smurugap
Last active December 21, 2019 06:14
Show Gist options
  • Select an option

  • Save smurugap/a6c862a76c99331a7f929a14aaa30551 to your computer and use it in GitHub Desktop.

Select an option

Save smurugap/a6c862a76c99331a7f929a14aaa30551 to your computer and use it in GitHub Desktop.

Revisions

  1. Senthilnathan Murugappan revised this gist Dec 21, 2019. 1 changed file with 12 additions and 8 deletions.
    20 changes: 12 additions & 8 deletions cirros
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    Base Image:
    Edit /lib/cirros/ds/ec2 or /etc/cirros-init/ds-ec2 based on image (MAX_TRIES=5, SLEEP_TIME=2)

    v6 support:
    v6 support (How dhcpcd was built is not captured here):
    scp [email protected]:/sbin/dhcpcd /sbin/
    scp [email protected]:/sbin/cirros-dhcpc /sbin/cirros-dhcpc
    scp -r [email protected]:/libexec /
    @@ -26,15 +26,23 @@ dhcpcd -h ${hostname:-"hostname"} -A -q -b -L "$iface"

    Other packages installed for Traffic Image:
    SFTP Server:
    Download cirros and compile with the below args:
    Download source and compile with the below args:
    ./configure --disable-libutil --disable-lastlog --disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx --disable-pututline --disable-pututxline --disable-pam --without-pam --without-stackprotect --without-hardening
    make sftp-server
    Copy sftp-server /lib/x86_64-linux-gnu/libnss_files-2.23.so /lib/x86_64-linux-gnu/libc.so.6 /lib64/ld-linux-x86-64.so.2

    To increase image size:
    1. qemu-img resize cirros-traffic.qcow2 100M
    2. launch the VM
    3. execute `/sbin/resize-filesystem /dev/root /run/resize.rootfs /dev/console`
    3. execute `/sbin/resize-filesystem /dev/root /run/resize.rootfs /dev/console` inside the cirros VM

    Either statically build the reqd packages from source (or)
    download the package on ubuntu host and copy the binary and the dependent shared libraries.
    For eg:
    TcpDump (download the tcpdump deb package and do below):
    scp [email protected]:/usr/sbin/tcpdump ./
    scp [email protected]:/usr/lib/libpcap.so.1.7.2* ./


    scp [email protected]:/usr/sbin/in.tftpd ./
    scp [email protected]:/usr/sbin/xinetd ./
    @@ -46,11 +54,7 @@ scp [email protected]:/etc/init.d/S70vsftpd ./
    scp [email protected]:/etc/init.d/S90thttpd ./
    scp [email protected]:/usr/sbin/xconv.pl ./

    TcpDump (download the tcpdump deb package and do below):
    scp [email protected]:/usr/sbin/tcpdump ./
    scp [email protected]:/usr/lib/libpcap.so.1.7.2* ./

    Compile Python locally on the Ubuntu host and follow the below steps:
    To compile Python statically on the Ubuntu host follow the below steps:
    Compiling Python2.7:
    ./configure LDFLAGS="-static" --disable-shared
    make LDFLAGS="-static" LINKFORSHARED=" "
  2. Senthilnathan Murugappan revised this gist Dec 21, 2019. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion cirros
    Original file line number Diff line number Diff line change
    @@ -62,4 +62,8 @@ Compile Python locally on the Ubuntu host and follow the below steps:
    scp <srcdir>/python /usr/local/bin/
    scp -r <srcdir>/Lib/* /usr/local/lib/python2.7/
    scp <srcdir>/build/lib.linux-x86_64-2.7/_sysconfigdata.py /usr/local/lib/python2.7/
    chmod -R 777 /usr/local/
    chmod -R 777 /usr/local/

    To install any dist-packages modules inside cirros:
    * pip install the package on the host
    * copy the contents (directory or .py files) to /usr/local/lib/python2.7/ inside the container
  3. Senthilnathan Murugappan revised this gist Aug 26, 2019. 1 changed file with 9 additions and 3 deletions.
    12 changes: 9 additions & 3 deletions cirros
    Original file line number Diff line number Diff line change
    @@ -51,9 +51,15 @@ scp [email protected]:/usr/sbin/tcpdump ./
    scp [email protected]:/usr/lib/libpcap.so.1.7.2* ./

    Compile Python locally on the Ubuntu host and follow the below steps:
    Compiling Python2.7:
    ./configure LDFLAGS="-static" --disable-shared
    make LDFLAGS="-static" LINKFORSHARED=" "
    Apply the workaround - https://github.com/usnistgov/REFPROP-cmake/issues/13
    Content of Setup.local is at https://gist.github.com/smurugap/f8f3ce8b96da33d9ad5c782a4c53ff0e

    mkdir -p /usr/local/lib/python2.7
    mkdir -p /usr/local/bin
    mv /tmp/python /usr/local/bin/
    mv /tmp/Lib/* /usr/local/lib/python2.7/
    mv /tmp/_sysconfigdata.py /usr/local/lib/python2.7/
    scp <srcdir>/python /usr/local/bin/
    scp -r <srcdir>/Lib/* /usr/local/lib/python2.7/
    scp <srcdir>/build/lib.linux-x86_64-2.7/_sysconfigdata.py /usr/local/lib/python2.7/
    chmod -R 777 /usr/local/
  4. Senthilnathan Murugappan revised this gist Aug 22, 2019. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions cirros
    Original file line number Diff line number Diff line change
    @@ -44,10 +44,9 @@ scp [email protected]:/sbin/arping ./
    scp [email protected]:/etc/init.d/S01logging ./
    scp [email protected]:/etc/init.d/S70vsftpd ./
    scp [email protected]:/etc/init.d/S90thttpd ./
    scp [email protected]:/usr/sbin/xconv.pl ./

    TcpDump (download the tcpdump deb package and do below):
    scp [email protected]:/usr/sbin/xconv.pl ./
    scp [email protected]:/lib/libpthread* ./
    scp [email protected]:/usr/sbin/tcpdump ./
    scp [email protected]:/usr/lib/libpcap.so.1.7.2* ./

  5. Senthilnathan Murugappan revised this gist Aug 22, 2019. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions cirros
    Original file line number Diff line number Diff line change
    @@ -57,5 +57,4 @@ Compile Python locally on the Ubuntu host and follow the below steps:
    mv /tmp/python /usr/local/bin/
    mv /tmp/Lib/* /usr/local/lib/python2.7/
    mv /tmp/_sysconfigdata.py /usr/local/lib/python2.7/
    chmod -R 777 /usr/local/
    #vi /usr/local/lib/python2.7/sysconfig.py +361
    chmod -R 777 /usr/local/
  6. Senthilnathan Murugappan revised this gist Aug 22, 2019. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions cirros
    Original file line number Diff line number Diff line change
    @@ -53,10 +53,9 @@ scp [email protected]:/usr/lib/libpcap.so.1.7.2* ./

    Compile Python locally on the Ubuntu host and follow the below steps:
    mkdir -p /usr/local/lib/python2.7
    mkdir -p /usr/local/bin
    mv /tmp/python /usr/local/bin/
    mv /tmp/Lib/* /usr/local/lib/python2.7/
    mv /tmp/_sysconfigdata.py /usr/local/lib/python2.7/
    chmod 777 /usr/local/bin/python
    chmod -R 777 /usr/local/lib/python2.7/*
    chmod 777 /usr/local/lib/python2.7/_sysconfigdata.py
    chmod -R 777 /usr/local/
    #vi /usr/local/lib/python2.7/sysconfig.py +361
  7. Senthilnathan Murugappan revised this gist Aug 22, 2019. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions cirros
    Original file line number Diff line number Diff line change
    @@ -31,6 +31,11 @@ SFTP Server:
    make sftp-server
    Copy sftp-server /lib/x86_64-linux-gnu/libnss_files-2.23.so /lib/x86_64-linux-gnu/libc.so.6 /lib64/ld-linux-x86-64.so.2

    To increase image size:
    1. qemu-img resize cirros-traffic.qcow2 100M
    2. launch the VM
    3. execute `/sbin/resize-filesystem /dev/root /run/resize.rootfs /dev/console`

    scp [email protected]:/usr/sbin/in.tftpd ./
    scp [email protected]:/usr/sbin/xinetd ./
    scp [email protected]:/usr/sbin/vsftpd ./
  8. Senthilnathan Murugappan revised this gist Aug 22, 2019. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions cirros
    Original file line number Diff line number Diff line change
    @@ -25,6 +25,12 @@ dhcpcd -h ${hostname:-"hostname"} -A -q -b -L "$iface"


    Other packages installed for Traffic Image:
    SFTP Server:
    Download cirros and compile with the below args:
    ./configure --disable-libutil --disable-lastlog --disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx --disable-pututline --disable-pututxline --disable-pam --without-pam --without-stackprotect --without-hardening
    make sftp-server
    Copy sftp-server /lib/x86_64-linux-gnu/libnss_files-2.23.so /lib/x86_64-linux-gnu/libc.so.6 /lib64/ld-linux-x86-64.so.2

    scp [email protected]:/usr/sbin/in.tftpd ./
    scp [email protected]:/usr/sbin/xinetd ./
    scp [email protected]:/usr/sbin/vsftpd ./
  9. Senthilnathan Murugappan revised this gist Aug 22, 2019. 1 changed file with 10 additions and 2 deletions.
    12 changes: 10 additions & 2 deletions cirros
    Original file line number Diff line number Diff line change
    @@ -15,8 +15,16 @@ scp -r [email protected]:/libexec /
    50-ntp.conf 100% 2848 2.8KB/s 00:00
    10-mtu 100% 957 0.9KB/s 00:00
    29-lookup-hostname 100% 811 0.8KB/s 00:00

    Traffic Image:

    Change boot order to bring up dropbear first before dhcpcd. <reduces sshable time by 5 seconds>
    mv /etc/rc3.d/S50-dropbear /etc/rc3.d/S39-dropbear (31 sec to 26 sec)

    dhcpcd args in cirros-dhcpc file:
    dhcpcd -h ${hostname:-"hostname"} -A -q -b -L "$iface"
    # Specifying -x option increases the boot time by 10 seconds


    Other packages installed for Traffic Image:
    scp [email protected]:/usr/sbin/in.tftpd ./
    scp [email protected]:/usr/sbin/xinetd ./
    scp [email protected]:/usr/sbin/vsftpd ./
  10. Senthilnathan Murugappan created this gist Aug 21, 2019.
    43 changes: 43 additions & 0 deletions cirros
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    Base Image:
    Edit /lib/cirros/ds/ec2 or /etc/cirros-init/ds-ec2 based on image (MAX_TRIES=5, SLEEP_TIME=2)

    v6 support:
    scp [email protected]:/sbin/dhcpcd /sbin/
    scp [email protected]:/sbin/cirros-dhcpc /sbin/cirros-dhcpc
    scp -r [email protected]:/libexec /
    dhcpcd-run-hooks 100% 8436 8.2KB/s 00:00
    10-wpa_supplicant 100% 2866 2.8KB/s 00:00
    30-hostname 100% 3450 3.4KB/s 00:00
    01-test 100% 276 0.3KB/s 00:00
    02-dump 100% 120 0.1KB/s 00:00
    15-timezone 100% 885 0.9KB/s 00:00
    20-resolv.conf 100% 4562 4.5KB/s 00:00
    50-ntp.conf 100% 2848 2.8KB/s 00:00
    10-mtu 100% 957 0.9KB/s 00:00
    29-lookup-hostname 100% 811 0.8KB/s 00:00

    Traffic Image:
    scp [email protected]:/usr/sbin/in.tftpd ./
    scp [email protected]:/usr/sbin/xinetd ./
    scp [email protected]:/usr/sbin/vsftpd ./
    scp [email protected]:/usr/sbin/thttpd* ./
    scp [email protected]:/sbin/arping ./
    scp [email protected]:/etc/init.d/S01logging ./
    scp [email protected]:/etc/init.d/S70vsftpd ./
    scp [email protected]:/etc/init.d/S90thttpd ./

    TcpDump (download the tcpdump deb package and do below):
    scp [email protected]:/usr/sbin/xconv.pl ./
    scp [email protected]:/lib/libpthread* ./
    scp [email protected]:/usr/sbin/tcpdump ./
    scp [email protected]:/usr/lib/libpcap.so.1.7.2* ./

    Compile Python locally on the Ubuntu host and follow the below steps:
    mkdir -p /usr/local/lib/python2.7
    mv /tmp/python /usr/local/bin/
    mv /tmp/Lib/* /usr/local/lib/python2.7/
    mv /tmp/_sysconfigdata.py /usr/local/lib/python2.7/
    chmod 777 /usr/local/bin/python
    chmod -R 777 /usr/local/lib/python2.7/*
    chmod 777 /usr/local/lib/python2.7/_sysconfigdata.py
    #vi /usr/local/lib/python2.7/sysconfig.py +361