SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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)Rama Nanda
 
الفصل الخامس - الإدخال والإخراج - د. خالد بكرو Input and Output - Dr. Khaled ...
الفصل الخامس - الإدخال والإخراج - د. خالد بكرو Input and Output - Dr. Khaled ...الفصل الخامس - الإدخال والإخراج - د. خالد بكرو Input and Output - Dr. Khaled ...
الفصل الخامس - الإدخال والإخراج - د. خالد بكرو Input and Output - Dr. Khaled ...Dr. Khaled Bakro
 
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: SwitchCheng-Yi Yu
 
CIALUG: Encrypt all the things
CIALUG: Encrypt all the thingsCIALUG: Encrypt all the things
CIALUG: Encrypt all the thingsAndrew Denner
 
Install oracle service bus
Install oracle service bus Install oracle service bus
Install oracle service bus Osama Mustafa
 
Installing Loopback Adapter
Installing Loopback AdapterInstalling Loopback Adapter
Installing Loopback AdapterKuwait10
 
Cisco pix firewall configuration for dcsl
Cisco pix firewall configuration for dcslCisco pix firewall configuration for dcsl
Cisco pix firewall configuration for dcslIT Tech
 
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...Cheng-Yi Yu
 
Buildstrapping Aloofix
Buildstrapping AloofixBuildstrapping Aloofix
Buildstrapping AloofixKevin Johnson
 
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 codeAmitesh Madhur
 
Gns3 0.5 Tutorial
Gns3 0.5 TutorialGns3 0.5 Tutorial
Gns3 0.5 Tutorialrusevi
 
Joomla! security
Joomla! securityJoomla! security
Joomla! securityYireo
 

Mais procurados (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
 

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

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 CentOSDevin Olson
 
NFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center OperationsNFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center OperationsCumulus Networks
 
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, 2013Trevor Roberts Jr.
 
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 WhitepaperTorry Harris Business Solutions
 
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 Ochuko Ideh
 
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 laptopLorin Hochstein
 
Gitlab installation
Gitlab installationGitlab installation
Gitlab installationRaiful Hasan
 
Kernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisKernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisAnne Nicolas
 
the NML project
the NML projectthe NML project
the NML projectLei Yang
 
Development platform virtualization using qemu
Development platform virtualization using qemuDevelopment platform virtualization using qemu
Development platform virtualization using qemuPremjith Achemveettil
 
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 2012Amazon Web Services
 

Semelhante a 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
 

Último

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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.pdfsudhanshuwaghmare1
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

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