How disable network redirections

Create custom Bourne Again SHell package to disable network redirections and enchance system security.

Operating system version.

$ lsb_release  -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

Bash version.

$ bash --version
GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ apt-cache policy bash
bash:
  Installed: 5.0-4
  Candidate: 5.0-4
  Version table:
 *** 5.0-4 500
        500 http://deb.debian.org/debian buster/main amd64 Packages
        100 /var/lib/dpkg/status

Attempt to open the TCP socket using Bourne Again SHell.

$ timeout 1 cat </dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2

Ensure that source packages are defined.

$ cat /etc/apt/sources.list
deb http://deb.debian.org/debian buster main
deb-src http://deb.debian.org/debian buster main

deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main

Update package index.

$ sudo apt update
Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://security.debian.org/debian-security buster/updates InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

Install package development scripts and tools.

$ sudo apt install -y dpkg-dev devscripts
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  at autoconf automake autopoint autotools-dev binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-8 dctrl-tools
  debhelper debian-keyring dh-autoreconf dh-strip-nondeterminism diffstat dirmngr dput dwz equivs exim4-base exim4-config
  exim4-daemon-light fakeroot g++ g++-8 gcc gcc-8 gettext git git-man gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client
  gpg-wks-server gpgconf gpgsm guile-2.2-libs intltool-debian libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
  libapt-pkg-perl libarchive-cpio-perl libarchive-zip-perl libasan5 libasync-mergepoint-perl libatomic1 libauthen-sasl-perl
  libb-hooks-endofscope-perl libb-hooks-op-check-perl libbinutils libc-dev-bin libc6-dev libcapture-tiny-perl libcc1-0 libcgi-fast-perl
  libcgi-pm-perl libclass-accessor-perl libclass-inspector-perl libclass-method-modifiers-perl libclass-xsaccessor-perl libclone-perl
  libcommon-sense-perl libconst-fast-perl libcontextual-return-perl libconvert-binhex-perl libcroco3 libdata-dump-perl
  libdata-optlist-perl libdevel-callchecker-perl libdevel-globaldestruction-perl libdigest-bubblebabble-perl libdigest-hmac-perl
  libdistro-info-perl libdpkg-perl libdynaloader-functions-perl libemail-valid-perl libencode-locale-perl liberror-perl libevent-2.1-6
  libexporter-tiny-perl libfakeroot libfcgi-perl libfile-basedir-perl libfile-chdir-perl libfile-fcntllock-perl libfile-homedir-perl
  libfile-listing-perl libfile-stripnondeterminism-perl libfile-which-perl libfl2 libfont-afm-perl libfribidi0 libfuture-perl libgc1c2
  libgcc-8-dev libgetopt-long-descriptive-perl libgit-wrapper-perl libgitlab-api-v4-perl libglib2.0-0 libglib2.0-data libgnutls-dane0
  libgomp1 libgpgme11 libgsasl7 libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl
  libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl libhttp-tiny-multipart-perl
  libimport-into-perl libio-async-perl libio-html-perl libio-prompter-perl libio-pty-perl libio-sessiondata-perl libio-socket-ssl-perl
  libio-string-perl libio-stringy-perl libipc-run-perl libipc-system-simple-perl libisl19 libitm1 libjson-perl libjson-xs-perl libksba8
  libkyotocabinet16v5 liblist-compare-perl liblist-moreutils-perl liblog-any-adapter-screen-perl liblog-any-perl liblsan0 libltdl-dev
  libltdl7 liblwp-mediatypes-perl liblwp-protocol-https-perl liblzo2-2 libmail-sendmail-perl libmailtools-perl libmailutils5
  libmariadb3 libmime-tools-perl libmodule-implementation-perl libmodule-runtime-perl libmoo-perl libmpc3 libmpfr6 libmpx2
  libnamespace-clean-perl libnet-dns-perl libnet-dns-sec-perl libnet-domain-tld-perl libnet-http-perl libnet-ip-perl libnet-libidn-perl
  libnet-smtp-ssl-perl libnet-ssleay-perl libnpth0 libntlm0 libnumber-compare-perl libnumber-range-perl libossp-uuid-perl
  libossp-uuid16 libpackage-stash-perl libpackage-stash-xs-perl libparams-classify-perl libparams-util-perl libparams-validate-perl
  libparse-debianchangelog-perl libpath-iterator-rule-perl libpath-tiny-perl libperlio-gzip-perl libpod-constants-perl libpython2.7
  libquadmath0 libreadonly-perl libref-util-perl libref-util-xs-perl libregexp-pattern-license-perl librole-tiny-perl
  libsereal-decoder-perl libsereal-encoder-perl libsereal-perl libsigsegv2 libsoap-lite-perl libsort-key-perl libsort-versions-perl
  libstdc++-8-dev libstrictures-perl libstring-copyright-perl libstring-escape-perl libstring-shellquote-perl libstruct-dumb-perl
  libsub-exporter-perl libsub-exporter-progressive-perl libsub-identify-perl libsub-install-perl libsub-name-perl libsub-quote-perl
  libsys-hostname-long-perl libtask-weaken-perl libterm-readkey-perl libtest-fatal-perl libtest-refcount-perl libtext-glob-perl
  libtext-levenshtein-perl libtimedate-perl libtool libtry-tiny-perl libtsan0 libtype-tiny-perl libtype-tiny-xs-perl
  libtypes-serialiser-perl libubsan1 libunbound8 libunicode-utf8-perl libunwind8 liburi-perl libvariable-magic-perl libwant-perl
  libwww-perl libwww-robotrules-perl libxml-libxml-perl libxml-namespacesupport-perl libxml-parser-perl libxml-sax-base-perl
  libxml-sax-expat-perl libxml-sax-perl libxml-simple-perl libxmlrpc-lite-perl libyaml-0-2 libyaml-libyaml-perl licensecheck lintian
  linux-libc-dev m4 mailutils mailutils-common make manpages-dev mariadb-common mysql-common patch patchutils perl-openssl-defaults
  po-debconf psmisc python3-gpg python3-magic python3-unidiff python3-xdg shared-mime-info strace t1utils unzip wdiff xdg-user-dirs
Suggested packages:
  autoconf-archive gnu-standards autoconf-doc binutils-doc cpp-doc gcc-8-locales debtags dh-make adequate autopkgtest bls-standalone
  check-all-the-things cvs-buildpackage devscripts-el diffoscope disorderfs dose-extra duck faketime gnuplot how-can-i-help
  libdbd-pg-perl libfile-desktopentry-perl libnet-smtps-perl libterm-size-perl libyaml-syck-perl mozilla-devscripts mutt piuparts
  postgresql-client quilt ratt reprotest svn-buildpackage w3m dbus-user-session pinentry-gnome3 tor mini-dinstall exim4-doc-html
  | exim4-doc-info eximon4 spf-tools-perl swaks g++-multilib g++-8-multilib gcc-8-doc libstdc++6-8-dbg gcc-multilib flex bison gdb
  gcc-doc gcc-8-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan5-dbg liblsan0-dbg libtsan0-dbg libubsan1-dbg
  libmpx2-dbg libquadmath0-dbg gettext-doc libasprintf-dev libgettextpo-dev git-daemon-run | git-daemon-sysvinit git-doc git-el
  git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn parcimonie xloadimage scdaemon libgssapi-perl glibc-doc bzr dns-root-data
  libtool-doc libcrypt-ssleay-perl uuid libscalar-number-perl libhtml-template-perl libapache2-mod-perl2 libmime-lite-perl
  libnet-jabber-perl libstdc++-8-doc libbareword-filehandles-perl libindirect-perl libmultidimensional-perl gfortran
  | fortran95-compiler gcj-jdk libdevel-lexalias-perl libdevel-stacktrace-perl libauthen-ntlm-perl libxml-sax-expatxs-perl
  binutils-multiarch libtext-template-perl m4-doc mailutils-mh mailutils-doc make-doc ed diffutils-doc libmail-box-perl zip wdiff-doc
he following NEW packages will be installed:                                                                                    [8/1886]
  at autoconf automake autopoint autotools-dev binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-8 dctrl-tools
  debhelper debian-keyring devscripts dh-autoreconf dh-strip-nondeterminism diffstat dirmngr dpkg-dev dput dwz equivs exim4-base
  exim4-config exim4-daemon-light fakeroot g++ g++-8 gcc gcc-8 gettext git git-man gnupg gnupg-l10n gnupg-utils gpg gpg-agent
  gpg-wks-client gpg-wks-server gpgconf gpgsm guile-2.2-libs intltool-debian libalgorithm-diff-perl libalgorithm-diff-xs-perl
  libalgorithm-merge-perl libapt-pkg-perl libarchive-cpio-perl libarchive-zip-perl libasan5 libasync-mergepoint-perl libatomic1
  libauthen-sasl-perl libb-hooks-endofscope-perl libb-hooks-op-check-perl libbinutils libc-dev-bin libc6-dev libcapture-tiny-perl
  libcc1-0 libcgi-fast-perl libcgi-pm-perl libclass-accessor-perl libclass-inspector-perl libclass-method-modifiers-perl
  libclass-xsaccessor-perl libclone-perl libcommon-sense-perl libconst-fast-perl libcontextual-return-perl libconvert-binhex-perl
  libcroco3 libdata-dump-perl libdata-optlist-perl libdevel-callchecker-perl libdevel-globaldestruction-perl
  libdigest-bubblebabble-perl libdigest-hmac-perl libdistro-info-perl libdpkg-perl libdynaloader-functions-perl libemail-valid-perl
  libencode-locale-perl liberror-perl libevent-2.1-6 libexporter-tiny-perl libfakeroot libfcgi-perl libfile-basedir-perl
  libfile-chdir-perl libfile-fcntllock-perl libfile-homedir-perl libfile-listing-perl libfile-stripnondeterminism-perl
  libfile-which-perl libfl2 libfont-afm-perl libfribidi0 libfuture-perl libgc1c2 libgcc-8-dev libgetopt-long-descriptive-perl
  libgit-wrapper-perl libgitlab-api-v4-perl libglib2.0-0 libglib2.0-data libgnutls-dane0 libgomp1 libgpgme11 libgsasl7
  libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
  libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl libhttp-tiny-multipart-perl libimport-into-perl
  libio-async-perl libio-html-perl libio-prompter-perl libio-pty-perl libio-sessiondata-perl libio-socket-ssl-perl libio-string-perl
  libio-stringy-perl libipc-run-perl libipc-system-simple-perl libisl19 libitm1 libjson-perl libjson-xs-perl libksba8
  libkyotocabinet16v5 liblist-compare-perl liblist-moreutils-perl liblog-any-adapter-screen-perl liblog-any-perl liblsan0 libltdl-dev
  libltdl7 liblwp-mediatypes-perl liblwp-protocol-https-perl liblzo2-2 libmail-sendmail-perl libmailtools-perl libmailutils5
  libmariadb3 libmime-tools-perl libmodule-implementation-perl libmodule-runtime-perl libmoo-perl libmpc3 libmpfr6 libmpx2
  libnamespace-clean-perl libnet-dns-perl libnet-dns-sec-perl libnet-domain-tld-perl libnet-http-perl libnet-ip-perl libnet-libidn-perl
  libnet-smtp-ssl-perl libnet-ssleay-perl libnpth0 libntlm0 libnumber-compare-perl libnumber-range-perl libossp-uuid-perl
  libossp-uuid16 libpackage-stash-perl libpackage-stash-xs-perl libparams-classify-perl libparams-util-perl libparams-validate-perl
  libparse-debianchangelog-perl libpath-iterator-rule-perl libpath-tiny-perl libperlio-gzip-perl libpod-constants-perl libpython2.7
  libquadmath0 libreadonly-perl libref-util-perl libref-util-xs-perl libregexp-pattern-license-perl librole-tiny-perl
  libsereal-decoder-perl libsereal-encoder-perl libsereal-perl libsigsegv2 libsoap-lite-perl libsort-key-perl libsort-versions-perl
  libstdc++-8-dev libstrictures-perl libstring-copyright-perl libstring-escape-perl libstring-shellquote-perl libstruct-dumb-perl
  libsub-exporter-perl libsub-exporter-progressive-perl libsub-identify-perl libsub-install-perl libsub-name-perl libsub-quote-perl
  libsys-hostname-long-perl libtask-weaken-perl libterm-readkey-perl libtest-fatal-perl libtest-refcount-perl libtext-glob-perl
  libtext-levenshtein-perl libtimedate-perl libtool libtry-tiny-perl libtsan0 libtype-tiny-perl libtype-tiny-xs-perl
  libtypes-serialiser-perl libubsan1 libunbound8 libunicode-utf8-perl libunwind8 liburi-perl libvariable-magic-perl libwant-perl
  libwww-perl libwww-robotrules-perl libxml-libxml-perl libxml-namespacesupport-perl libxml-parser-perl libxml-sax-base-perl
  libxml-sax-expat-perl libxml-sax-perl libxml-simple-perl libxmlrpc-lite-perl libyaml-0-2 libyaml-libyaml-perl licensecheck lintian
  linux-libc-dev m4 mailutils mailutils-common make manpages-dev mariadb-common mysql-common patch patchutils perl-openssl-defaults
  po-debconf psmisc python3-gpg python3-magic python3-unidiff python3-xdg shared-mime-info strace t1utils unzip wdiff xdg-user-dirs
0 upgraded, 270 newly installed, 0 to remove and 0 not upgraded.
Need to get 129 MB of archives.
After this operation, 405 MB of additional disk space will be used.
[...]

Create temporary bash directory.

$ mkdir bash

Change working directory.

$ cd bash

Get the source package for bash.

$ apt source bash
Reading package lists... Done
NOTICE: 'bash' packaging is maintained in the 'Bzr' version control system at:
http://bazaar.launchpad.net/~doko/+junk/pkg-bash-debian
Please use:
bzr branch http://bazaar.launchpad.net/~doko/+junk/pkg-bash-debian
to retrieve the latest (possibly unreleased) updates to the package.
Need to get 5,649 kB of source archives.
Get:1 http://deb.debian.org/debian buster/main bash 5.0-4 (dsc) [2,305 B]
Get:2 http://deb.debian.org/debian buster/main bash 5.0-4 (tar) [5,555 kB]
Get:3 http://deb.debian.org/debian buster/main bash 5.0-4 (diff) [91.9 kB]
Fetched 5,649 kB in 2s (3,028 kB/s)
dpkg-source: info: extracting bash in bash-5.0
dpkg-source: info: unpacking bash_5.0.orig.tar.xz
dpkg-source: info: unpacking bash_5.0-4.debian.tar.xz
dpkg-source: info: using patch list from debian/patches/series
dpkg-source: info: applying bash50-001.diff
dpkg-source: info: applying bash50-002.diff
dpkg-source: info: applying bash50-003.diff
dpkg-source: info: applying bashbug-editor.diff
dpkg-source: info: applying deb-bash-config.diff
dpkg-source: info: applying deb-examples.diff
dpkg-source: info: applying man-arithmetic.diff
dpkg-source: info: applying man-fignore.diff
dpkg-source: info: applying man-bashrc.diff
dpkg-source: info: applying man-bashlogout.diff
dpkg-source: info: applying man-nocaseglob.diff
dpkg-source: info: applying man-test.diff
dpkg-source: info: applying man-test2.diff
dpkg-source: info: applying rbash-manpage.diff
dpkg-source: info: applying bash-default-editor.diff
dpkg-source: info: applying input-err.diff
dpkg-source: info: applying exec-redirections-doc.diff
dpkg-source: info: applying bash-aliases-repeat.diff
dpkg-source: info: applying use-system-texi2html.diff
dpkg-source: info: applying bzero.diff
dpkg-source: info: applying man-macro-warnings.diff
dpkg-source: info: applying po-de-fix.diff
dpkg-source: info: applying man-vx-opts.diff
dpkg-source: info: applying wait-builtin-avoid-hanging-on-inherited-children.diff

List files in working directory.

$ ls
bash-5.0  bash_5.0-4.debian.tar.xz  bash_5.0-4.dsc  bash_5.0.orig.tar.xz

Build and install a package that will satisfy build-dependencies.

$ sudo mk-build-deps bash --install --remove
dh_testdir
dh_testroot
dh_prep
dh_testdir
dh_testroot
dh_install
dh_installdocs
dh_installchangelogs
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dpkg-deb: building package 'bash-build-deps' in '../bash-build-deps_5.0-4_all.deb'.

The package has been created.
Attention, the package has been created in the current directory,
not in ".." as indicated by the message above!
(Reading database ... 45916 files and directories currently installed.)
Preparing to unpack bash-build-deps_5.0-4_all.deb ...
Unpacking bash-build-deps (5.0-4) over (5.0-4) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies...Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
 Done
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following additional packages will be installed:
  bison fontconfig-config fonts-dejavu-core fonts-lmodern ghostscript libavahi-client3 libavahi-common-data libavahi-common3
  libbison-dev libbrotli1 libcairo2 libcups2 libcupsimage2 libfontconfig1 libgraphite2-3 libgs9 libgs9-common libharfbuzz-icu0
  libharfbuzz0b libice6 libijs-0.35 libjbig0 libjbig2dec0 libjpeg62-turbo libkpathsea6 liblcms2-2 libncurses-dev libncurses5-dev
  libopenjp2-7 libpaper-utils libpaper1 libpixman-1-0 libpotrace0 libptexenc1 libsm6 libsynctex2 libteckit0 libtexlua52 libtexlua53
  libtexluajit2 libtext-unidecode-perl libtiff5 libwebp6 libwoff1 libxaw7 libxcb-render0 libxcb-shm0 libxi6 libxmu6 libxpm4 libxrender1
  libxt6 libxxhash0 libzzip-0-13 man2html-base poppler-data sharutils tex-common texi2html texinfo texlive-base texlive-binaries
  texlive-fonts-recommended texlive-latex-base time x11-common xdg-utils
Suggested packages:
  bison-doc ghostscript-x cups-common liblcms2-utils ncurses-doc poppler-utils fonts-japanese-mincho | fonts-ipafont-mincho
  fonts-japanese-gothic | fonts-ipafont-gothic fonts-arphic-ukai fonts-arphic-uming fonts-nanum sharutils-doc latex2html
  texlive-generic-recommended texinfo-doc-nonfree perl-tk xpdf-reader | pdf-viewer texlive-fonts-recommended-doc texlive-latex-base-doc
Recommended packages:
  gsfonts libcupsfilters1 fonts-droid-fallback lmodern tex-gyre tipa libfile-mimeinfo-perl libnet-dbus-perl libx11-protocol-perl
  x11-utils x11-xserver-utils
The following NEW packages will be installed:
  bison fontconfig-config fonts-dejavu-core fonts-lmodern ghostscript libavahi-client3 libavahi-common-data libavahi-common3
  libbison-dev libbrotli1 libcairo2 libcups2 libcupsimage2 libfontconfig1 libgraphite2-3 libgs9 libgs9-common libharfbuzz-icu0
  libharfbuzz0b libice6 libijs-0.35 libjbig0 libjbig2dec0 libjpeg62-turbo libkpathsea6 liblcms2-2 libncurses-dev libncurses5-dev
  libopenjp2-7 libpaper-utils libpaper1 libpixman-1-0 libpotrace0 libptexenc1 libsm6 libsynctex2 libteckit0 libtexlua52 libtexlua53
  libtexluajit2 libtext-unidecode-perl libtiff5 libwebp6 libwoff1 libxaw7 libxcb-render0 libxcb-shm0 libxi6 libxmu6 libxpm4 libxrender1
  libxt6 libxxhash0 libzzip-0-13 man2html-base poppler-data sharutils tex-common texi2html texinfo texlive-base texlive-binaries
  texlive-fonts-recommended texlive-latex-base time x11-common xdg-utils
0 upgraded, 67 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 64.3 MB of archives.
After this operation, 228 MB of additional disk space will be used.
Do you want to continue? [Y/n]
[...]
Running updmap-sys. This may take some time... done.
Running mktexlsr /var/lib/texmf ... done.
Building format(s) --all.
        This may take some time... done.

Inspect Bourne Again SHell build options.

$ grep -A5 ^conf_args bash-5.0/debian/rules  
conf_args = \
        --enable-largefile \
        --prefix=/usr \
        --infodir=/usr/share/info \
        --mandir=/usr/share/man \
        --without-bash-malloc

Append the --disable-net-redirections option.

$ sed -i -e "/^conf_args =/ a\ \ \ \ \ \ \ \ --disable-net-redirections \\\\" bash-5.0/debian/rules 

Inspect new build options.

$ grep -A6 ^conf_args  bash-5.0/debian/rules
conf_args = \
        --disable-net-redirections \
        --enable-largefile \
        --prefix=/usr \
        --infodir=/usr/share/info \
        --mandir=/usr/share/man \
        --without-bash-malloc

Change working directory to build altered package.

$ cd bash-5.0/

Append a personal suffix and changelog entry using proper email address.

$ EMAIL="[email protected]" dch --local "+personal" "Disabled net redirections"

Inspect changelog.

$ head -20 debian/changelog 
bash (5.0-4+personal1) UNRELEASED; urgency=medium

  * Disabled net redirections

 -- Vagrant Default User <[email protected]>  Sat, 04 Apr 2020 22:20:27 +0000

bash (5.0-4) unstable; urgency=medium

  * wait builtin: avoid hanging on inherited children. Closes: #920455.

 -- Matthias Klose <[email protected]>  Thu, 18 Apr 2019 06:12:36 +0200

bash (5.0-3) unstable; urgency=medium

  * Apply upstream patch 003.
  * Fix clear_console locking up video when X is running and logging out
    from a plain text console. Closes: #810660. LP: #1822184.

 -- Matthias Klose <[email protected]>  Thu, 04 Apr 2019 04:30:33 +0200

Build package.

$ debuild -us -uc                     
 dpkg-buildpackage -us -uc -ui                                                                                                           
dpkg-buildpackage: info: source package bash                        
dpkg-buildpackage: info: source version 5.0-4personal1                                                                                   
dpkg-buildpackage: info: source distribution UNRELEASED        
dpkg-buildpackage: info: source changed by Vagrant Default User <[email protected]>
 dpkg-source --before-build .                                                                                                            
dpkg-buildpackage: info: host architecture amd64
 fakeroot debian/rules clean                                        
dh_testdir                                                          
dh_testroot                                                         
rm -rf stamps build-*                                                                                                                    
rm -f debian/bash.preinst debian/*.o
rm -f debian/README.Debian                                          
rm -rf locales                                                      
rm -f clear_console                                                 
dh_autotools-dev_restoreconfig    
[...]
dpkg-deb: building package 'bash-static-dbgsym' in '../bash-static-dbgsym_5.0-4+personal1_amd64.deb'.
dpkg-deb: building package 'bash-static' in '../bash-static_5.0-4+personal1_amd64.deb'.
 dpkg-genbuildinfo
 dpkg-genchanges  >../bash_5.0-4+personal1_amd64.changes
dpkg-genchanges: info: not including original source code in upload
 dpkg-source --after-build .
dpkg-buildpackage: info: binary and diff upload (original source NOT included)
Now running lintian bash_5.0-4+personal1_amd64.changes ...
W: bash source: debhelper-tools-from-autotools-dev-are-deprecated dh_autotools-dev_updateconfig (line 101)
W: bash source: debhelper-tools-from-autotools-dev-are-deprecated dh_autotools-dev_restoreconfig (line 175)
W: bash source: build-depends-on-obsolete-package build-depends: texi2html
W: bash source: changelog-should-mention-nmu
W: bash source: source-nmu-has-incorrect-version-number 5.0-4+personal1
W: bash: duplicate-changelog-files usr/share/doc/bash/CHANGES.gz usr/share/doc/bash/changelog.gz
W: bash-builtins: pkg-config-unavailable-for-cross-compilation usr/lib/pkgconfig/bash.pc
E: bash-builtins: pkg-config-bad-directive usr/lib/pkgconfig/bash.pc -Wl,-soname,[email protected]
E: bash-builtins: pkg-config-bad-directive usr/lib/pkgconfig/bash.pc -fPIC
N: 29 tags overridden (29 errors); 4 unused overrides
Finished running lintian.

Change working directory to the parent directory.

$ cd ..

Inspect built packages.

$ ls
bash-5.0                             bash_5.0-4personal1_amd64.deb                  bash-dbgsym_5.0-4personal1_amd64.deb
bash_5.0-4.debian.tar.xz             bash_5.0-4personal1.debian.tar.xz              bash-doc_5.0-4personal1_all.deb
bash_5.0-4.dsc                       bash_5.0-4personal1.dsc                        bash-static_5.0-4personal1_amd64.deb
bash_5.0-4personal1_amd64.build      bash_5.0.orig.tar.xz                           bash-static-dbgsym_5.0-4personal1_amd64.deb
bash_5.0-4personal1_amd64.buildinfo  bash-builtins_5.0-4personal1_amd64.deb
bash_5.0-4personal1_amd64.changes    bash-builtins-dbgsym_5.0-4personal1_amd64.deb

Install altered Bourne Again SHell package.

$ sudo dpkg -i bash_5.0-4personal1_amd64.deb 
(Reading database ... 56015 files and directories currently installed.)
Preparing to unpack bash_5.0-4personal1_amd64.deb ...
Unpacking bash (5.0-4personal1) over (5.0-4) ...
Setting up bash (5.0-4personal1) ...
update-alternatives: using /usr/share/man/man7/bash-builtins.7.gz to provide /usr/share/man/man7/builtins.7.gz (builtins.7.gz) in auto mode
Processing triggers for man-db (2.8.5-2) ...

Remove build dependencies.

$ sudo apt remove -y bash-build-deps 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  fonts-lmodern libbrotli1 libcairo2 libgraphite2-3 libharfbuzz-icu0 libharfbuzz0b libice6 libkpathsea6 libncurses-dev libncurses5-dev
  libpixman-1-0 libpotrace0 libptexenc1 libsm6 libsynctex2 libteckit0 libtexlua52 libtexlua53 libtexluajit2 libtext-unidecode-perl
  libwoff1 libxaw7 libxcb-render0 libxcb-shm0 libxi6 libxmu6 libxpm4 libxrender1 libxt6 libxxhash0 libzzip-0-13 man2html-base sharutils
  tex-common texi2html texinfo texlive-base texlive-binaries texlive-fonts-recommended texlive-latex-base time x11-common
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  bash-build-deps
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 9,216 B disk space will be freed.
(Reading database ... 56015 files and directories currently installed.)
Removing bash-build-deps (5.0-4) ...
$ sudo apt autoremove -y
Reading package lists... Done 
Building dependency tree       
Reading state information... Done                                   
The following packages will be REMOVED:       
  fonts-lmodern libbrotli1 libcairo2 libgraphite2-3 libharfbuzz-icu0 libharfbuzz0b libice6 libkpathsea6 libncurses-dev libncurses5-dev
  libpixman-1-0 libpotrace0 libptexenc1 libsm6 libsynctex2 libteckit0 libtexlua52 libtexlua53 libtexluajit2 libtext-unidecode-perl
  libwoff1 libxaw7 libxcb-render0 libxcb-shm0 libxi6 libxmu6 libxpm4 libxrender1 libxt6 libxxhash0 libzzip-0-13 man2html-base sharutils
  tex-common texi2html texinfo texlive-base texlive-binaries texlive-fonts-recommended texlive-latex-base time x11-common
0 upgraded, 0 newly installed, 42 to remove and 0 not upgraded.
After this operation, 179 MB disk space will be freed.
(Reading database ... 56011 files and directories currently installed.)
[...]
$ apt-cache policy bash
bash:
  Installed: 5.0-4personal1
  Candidate: 5.0-4personal1
  Version table:
 *** 5.0-4personal1 100
        100 /var/lib/dpkg/status
     5.0-4 500
        500 http://deb.debian.org/debian buster/main amd64 Packages

Start new bash process.

$ bash

Attempt to open the TCP socket.

$ timeout 1 cat </dev/tcp/127.0.0.1/22
bash: /dev/tcp/127.0.0.1/22: No such file or directory

Network redirections will not work as expected.

Additional notes

You should follow lintian messages to keep up with best practices.

E: bash changes: changed-by-address-malformed Vagrant Default User <[email protected]>
W: bash source: debhelper-tools-from-autotools-dev-are-deprecated dh_autotools-dev_updateconfig (line 101)
W: bash source: debhelper-tools-from-autotools-dev-are-deprecated dh_autotools-dev_restoreconfig (line 175)
W: bash source: build-depends-on-obsolete-package build-depends: texi2html
W: bash source: changelog-should-mention-nmu
W: bash source: source-nmu-has-incorrect-version-number 5.0-4personal1
E: bash-doc: debian-changelog-file-contains-invalid-email-address [email protected]
W: bash-builtins: pkg-config-unavailable-for-cross-compilation usr/lib/pkgconfig/bash.pc
E: bash-builtins: pkg-config-bad-directive usr/lib/pkgconfig/bash.pc -Wl,-soname,[email protected]
E: bash-builtins: pkg-config-bad-directive usr/lib/pkgconfig/bash.pc -fPIC
E: bash: debian-changelog-file-contains-invalid-email-address [email protected]
W: bash: duplicate-changelog-files usr/share/doc/bash/CHANGES.gz usr/share/doc/bash/changelog.gz
E: bash-static: debian-changelog-file-contains-invalid-email-address [email protected]
N: 29 tags overridden (29 errors); 4 unused overrides
Finished running lintian.

These mistakes can be easily avoided.

  source-nmu-has-incorrect-version-number 5.0-4personal1

Use +personal instead of personal as a a suffix to the Debian version number.

  E: bash-doc: debian-changelog-file-contains-invalid-email-address [email protected]

Define proper email address as the domain needs to contain at least one dot.