SlideShare une entreprise Scribd logo
1  sur  20
Building a secure
bastion, or, 50
ways to kill your
server
Anna
Kennedy
@anna_ken_
Telenor Digital
What is a bastion (jumpbox) ?
bastion
server
server
server
Outside
world
What do we mean by secure?
How do we make a custom AMI?
Technical context
Ubuntu default packages
$ apt list --installed
Listing... Done
a11y-profile-manager-indicator/xenial,now 0.1.10-0ubuntu3 amd64 [installed]
accountsservice/xenial-updates,now 0.6.40-2ubuntu11.3 amd64 [installed]
acl/xenial,now 2.2.52-3 amd64 [installed]
acpi-support/xenial,now 0.142 amd64 [installed]
acpid/xenial,now 1:2.0.26-1ubuntu2 amd64 [installed]
activity-log-manager/xenial-updates,now 0.9.7-0ubuntu23.16.04.1 amd64 [installed]
adduser/xenial,xenial,now 3.113+nmu3ubuntu4 all [installed]
adium-theme-ubuntu/xenial-updates,xenial-updates,now 0.3.4-0ubuntu1.1 all [installed]
adwaita-icon-theme/xenial-updates,xenial-updates,now 3.18.0-2ubuntu3.1 all [installed]
aisleriot/xenial,now 1:3.18.2-1ubuntu1 amd64 [installed]
alien/xenial,xenial,now 8.95 all [installed,automatic]
alsa-base/xenial,xenial,now 1.0.25+dfsg-0ubuntu5 all [installed]
alsa-utils/xenial,now 1.1.0-0ubuntu5 amd64 [installed]
anacron/xenial,now 2.3-23 amd64 [installed]
$ dpkg-query -W
a11y-profile-manager-indicator 0.1.10-0ubuntu3
accountsservice 0.6.40-2ubuntu11.3
acl 2.2.52-3
acpi-support 0.142
acpid 1:2.0.26-1ubuntu2
activity-log-manager 0.9.7-0ubuntu23.16.04.1
adduser 3.113+nmu3ubuntu4
adium-theme-ubuntu 0.3.4-0ubuntu1.1
adwaita-icon-theme 3.18.0-2ubuntu3.1
aisleriot 1:3.18.2-1ubuntu1
alien 8.95
alsa-base 1.0.25+dfsg-0ubuntu5
alsa-utils 1.1.0-0ubuntu5
anacron 2.3-23
~2000 packages
Ubuntu default packages includes:
● ed
● ftp
● curl
● nano
● perl
● python
● rsync
● sed
● telnet
● wget
● vim-common
● adduser
● apt
● dpkg
?
● screen
● tmux
Just remove all optional / extra
packages
$ dpkg-query -Wf '${Package;-40}${Priority}n'
apt important
adduser required
at
standard
a11y-profile-manager-indicator optional
adium-theme-ubuntu extra
dpkg-query -Wf '${Package;-40}${Priority}n' |
awk '$2 ~ /optional|extra/ { print $1 }' |
xargs -I % sudo apt-get -y purge %
Turns out optional doesn’t mean
optional
‘Optional’ and ‘extra’ include:
● cloud-init
● grub
● linux-base
● openssh-server
● resolvconf
● ubuntu-server (meta-
Remove all packages that we don’t
want
ed
ftp
gawk
nano
rsync
screen
tmux
vim
wget
curl
net-tools
perl
python 2.7
python 3
tar
Remove all packages that we don’t
want, apart from the ones we can’t
Can remove:
ed
ftp
gawk
nano
rsync
screen
tmux
vim
wget
Can’t remove:
curl needed for consul restarts
net-tools needed for sshuttle
perl needed for ssh
python 2.7 needed for Ansible
python 3needed for AWS instance checks
tar needed for Ansible
Restricting user capabilities
Change all user shells to
/bin/nologin
Use rbash instead
of bash
Remove sudo from
all usersRestrict allowed commands in
authorized_keys
Restricting user capabilities
Change all user shells to
/bin/nologin
Restrict allowed commands in
authorized_keys
Use rbash instead
of bash
Remove sudo from
all users
sshuttle
sshuttle
sshuttle
Troubleshooting without sudo
Finally, a bootable, usable AMI
Install fail2ban
Use 2FA
Port knocking
Safe and secure
Thanks for
listening!
Anna
Kennedy
@anna_ken_
Telenor Digital

Contenu connexe

Tendances

Gns3 0.5 Tutorial
Gns3 0.5 TutorialGns3 0.5 Tutorial
Gns3 0.5 Tutorial
rusevi
 

Tendances (20)

DNF Failed To Open Cache
DNF Failed To Open CacheDNF Failed To Open Cache
DNF Failed To Open Cache
 
firmware hacking, slash the pineapple for fun (codebali 2015)
firmware hacking, slash the pineapple for fun (codebali 2015)firmware hacking, slash the pineapple for fun (codebali 2015)
firmware hacking, slash the pineapple for fun (codebali 2015)
 
الفصل الخامس - الإدخال والإخراج - د. خالد بكرو Input and Output - Dr. Khaled ...
الفصل الخامس - الإدخال والإخراج - د. خالد بكرو Input and Output - Dr. Khaled ...الفصل الخامس - الإدخال والإخراج - د. خالد بكرو Input and Output - Dr. Khaled ...
الفصل الخامس - الإدخال والإخراج - د. خالد بكرو Input and Output - Dr. Khaled ...
 
weddew
weddewweddew
weddew
 
2015.10.05 Updated > Network Device Development - Part 1: Switch
2015.10.05 Updated > Network Device Development - Part 1: Switch2015.10.05 Updated > Network Device Development - Part 1: Switch
2015.10.05 Updated > Network Device Development - Part 1: Switch
 
Instrucciones
InstruccionesInstrucciones
Instrucciones
 
CIALUG: Encrypt all the things
CIALUG: Encrypt all the thingsCIALUG: Encrypt all the things
CIALUG: Encrypt all the things
 
Install oracle service bus
Install oracle service bus Install oracle service bus
Install oracle service bus
 
Installing Loopback Adapter
Installing Loopback AdapterInstalling Loopback Adapter
Installing Loopback Adapter
 
Cisco pix firewall configuration for dcsl
Cisco pix firewall configuration for dcslCisco pix firewall configuration for dcsl
Cisco pix firewall configuration for dcsl
 
Network Security
Network SecurityNetwork Security
Network Security
 
444asus
444asus444asus
444asus
 
WebRTC for Managers!
WebRTC for Managers!WebRTC for Managers!
WebRTC for Managers!
 
Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload...
Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload...Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload...
Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload...
 
Installing and Using XBMC
Installing and Using XBMCInstalling and Using XBMC
Installing and Using XBMC
 
Buildstrapping Aloofix
Buildstrapping AloofixBuildstrapping Aloofix
Buildstrapping Aloofix
 
Setup ephemeral password for TURN, Learn RTC in less than 200 Lines of code
Setup ephemeral password for TURN, Learn RTC in less than 200 Lines of codeSetup ephemeral password for TURN, Learn RTC in less than 200 Lines of code
Setup ephemeral password for TURN, Learn RTC in less than 200 Lines of code
 
Gns3 0.5 Tutorial
Gns3 0.5 TutorialGns3 0.5 Tutorial
Gns3 0.5 Tutorial
 
Joomla! security
Joomla! securityJoomla! security
Joomla! security
 
Fortinet SSL VPN access
Fortinet SSL VPN accessFortinet SSL VPN access
Fortinet SSL VPN access
 

Similaire à Building a secure bastion, or, 50 ways to kill your server

Gitlab installation
Gitlab installationGitlab installation
Gitlab installation
Raiful Hasan
 
the NML project
the NML projectthe NML project
the NML project
Lei Yang
 
Development platform virtualization using qemu
Development platform virtualization using qemuDevelopment platform virtualization using qemu
Development platform virtualization using qemu
Premjith Achemveettil
 

Similaire à Building a secure bastion, or, 50 ways to kill your server (20)

Installing & Configuring IBM Domino 9 on CentOS
Installing & Configuring IBM Domino 9 on CentOSInstalling & Configuring IBM Domino 9 on CentOS
Installing & Configuring IBM Domino 9 on CentOS
 
Vt6655 linux user_guide
Vt6655 linux user_guideVt6655 linux user_guide
Vt6655 linux user_guide
 
NFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center OperationsNFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center Operations
 
Couch to OpenStack: Nova - July, 30, 2013
Couch to OpenStack: Nova - July, 30, 2013Couch to OpenStack: Nova - July, 30, 2013
Couch to OpenStack: Nova - July, 30, 2013
 
Eucalyptus on Xen - Build Enterprise Private Cloud | Torry Harris Whitepaper
Eucalyptus on Xen - Build Enterprise Private Cloud | Torry Harris WhitepaperEucalyptus on Xen - Build Enterprise Private Cloud | Torry Harris Whitepaper
Eucalyptus on Xen - Build Enterprise Private Cloud | Torry Harris Whitepaper
 
Xen time machine
Xen time machineXen time machine
Xen time machine
 
Full Unity Cloud Build Log of the 'Gachapoint' Demo
Full Unity Cloud Build Log of the 'Gachapoint' Demo Full Unity Cloud Build Log of the 'Gachapoint' Demo
Full Unity Cloud Build Log of the 'Gachapoint' Demo
 
C&C Botnet Factory
C&C Botnet FactoryC&C Botnet Factory
C&C Botnet Factory
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
Gitlab installation
Gitlab installationGitlab installation
Gitlab installation
 
Kernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisKernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysis
 
Linux introduction Class 02
Linux introduction Class 02Linux introduction Class 02
Linux introduction Class 02
 
Instalar PENTAHO 5 en CentOS 6
Instalar PENTAHO 5 en CentOS 6Instalar PENTAHO 5 en CentOS 6
Instalar PENTAHO 5 en CentOS 6
 
Linux lpi101
Linux lpi101Linux lpi101
Linux lpi101
 
the NML project
the NML projectthe NML project
the NML project
 
Freeradius edir
Freeradius edirFreeradius edir
Freeradius edir
 
Ansible101
Ansible101Ansible101
Ansible101
 
Development platform virtualization using qemu
Development platform virtualization using qemuDevelopment platform virtualization using qemu
Development platform virtualization using qemu
 
Snort-IPS-Tutorial
Snort-IPS-TutorialSnort-IPS-Tutorial
Snort-IPS-Tutorial
 
CPN209 Your Amazon Linux AMI - AWS re: Invent 2012
CPN209 Your Amazon Linux AMI - AWS re: Invent 2012CPN209 Your Amazon Linux AMI - AWS re: Invent 2012
CPN209 Your Amazon Linux AMI - AWS re: Invent 2012
 

Dernier

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Building a secure bastion, or, 50 ways to kill your server

  • 1. Building a secure bastion, or, 50 ways to kill your server Anna Kennedy @anna_ken_ Telenor Digital
  • 2. What is a bastion (jumpbox) ? bastion server server server Outside world
  • 3. What do we mean by secure?
  • 4. How do we make a custom AMI?
  • 6. Ubuntu default packages $ apt list --installed Listing... Done a11y-profile-manager-indicator/xenial,now 0.1.10-0ubuntu3 amd64 [installed] accountsservice/xenial-updates,now 0.6.40-2ubuntu11.3 amd64 [installed] acl/xenial,now 2.2.52-3 amd64 [installed] acpi-support/xenial,now 0.142 amd64 [installed] acpid/xenial,now 1:2.0.26-1ubuntu2 amd64 [installed] activity-log-manager/xenial-updates,now 0.9.7-0ubuntu23.16.04.1 amd64 [installed] adduser/xenial,xenial,now 3.113+nmu3ubuntu4 all [installed] adium-theme-ubuntu/xenial-updates,xenial-updates,now 0.3.4-0ubuntu1.1 all [installed] adwaita-icon-theme/xenial-updates,xenial-updates,now 3.18.0-2ubuntu3.1 all [installed] aisleriot/xenial,now 1:3.18.2-1ubuntu1 amd64 [installed] alien/xenial,xenial,now 8.95 all [installed,automatic] alsa-base/xenial,xenial,now 1.0.25+dfsg-0ubuntu5 all [installed] alsa-utils/xenial,now 1.1.0-0ubuntu5 amd64 [installed] anacron/xenial,now 2.3-23 amd64 [installed] $ dpkg-query -W a11y-profile-manager-indicator 0.1.10-0ubuntu3 accountsservice 0.6.40-2ubuntu11.3 acl 2.2.52-3 acpi-support 0.142 acpid 1:2.0.26-1ubuntu2 activity-log-manager 0.9.7-0ubuntu23.16.04.1 adduser 3.113+nmu3ubuntu4 adium-theme-ubuntu 0.3.4-0ubuntu1.1 adwaita-icon-theme 3.18.0-2ubuntu3.1 aisleriot 1:3.18.2-1ubuntu1 alien 8.95 alsa-base 1.0.25+dfsg-0ubuntu5 alsa-utils 1.1.0-0ubuntu5 anacron 2.3-23 ~2000 packages
  • 7. Ubuntu default packages includes: ● ed ● ftp ● curl ● nano ● perl ● python ● rsync ● sed ● telnet ● wget ● vim-common ● adduser ● apt ● dpkg ? ● screen ● tmux
  • 8. Just remove all optional / extra packages $ dpkg-query -Wf '${Package;-40}${Priority}n' apt important adduser required at standard a11y-profile-manager-indicator optional adium-theme-ubuntu extra dpkg-query -Wf '${Package;-40}${Priority}n' | awk '$2 ~ /optional|extra/ { print $1 }' | xargs -I % sudo apt-get -y purge %
  • 9. Turns out optional doesn’t mean optional ‘Optional’ and ‘extra’ include: ● cloud-init ● grub ● linux-base ● openssh-server ● resolvconf ● ubuntu-server (meta-
  • 10. Remove all packages that we don’t want ed ftp gawk nano rsync screen tmux vim wget curl net-tools perl python 2.7 python 3 tar
  • 11. Remove all packages that we don’t want, apart from the ones we can’t Can remove: ed ftp gawk nano rsync screen tmux vim wget Can’t remove: curl needed for consul restarts net-tools needed for sshuttle perl needed for ssh python 2.7 needed for Ansible python 3needed for AWS instance checks tar needed for Ansible
  • 12. Restricting user capabilities Change all user shells to /bin/nologin Use rbash instead of bash Remove sudo from all usersRestrict allowed commands in authorized_keys
  • 13. Restricting user capabilities Change all user shells to /bin/nologin Restrict allowed commands in authorized_keys Use rbash instead of bash Remove sudo from all users sshuttle sshuttle sshuttle
  • 15. Finally, a bootable, usable AMI