SlideShare a Scribd company logo
Sudo – Giving access while staying in control
Peter Czanik
Open Source Evangelist
One Identity
@PCzanik
Security Starts Here | One Identity - Restricted - Confidential
Sudo: Giving
access while
staying in control
• Working at the Budapest office of One Identity
(formerly known as Balabit)
• syslog-ng & sudo upstream
• Helping in RPM and FreeBSD packaging
• Blogger and speaker
About me
Security Starts Here | One Identity - Restricted - Confidential
• What is sudo?
• Some lesser-known features
• What’s new?
• JSON-formatted logging
• Relays
• Chroot, working directory
• Logging sub-commands
• Masking passwords
• Getting more precise information
Overview
Security Starts Here | One Identity - Restricted - Confidential

Recommended for you

Presentation nix
Presentation nixPresentation nix
Presentation nix

Kyle Young presents on SSH tricks and configuration tips. He discusses the history and uses of SSH, how to securely connect to SSH servers by verifying fingerprints, and ways to lock down SSH servers and clients through configuration files like sshd_config and ssh_config. He also shares some useful SSH client-side one-liners.

Linux Hardening - Made Easy
Linux Hardening - Made EasyLinux Hardening - Made Easy
Linux Hardening - Made Easy

The document discusses hardening Linux servers against security threats. It begins by introducing the speaker and explaining the importance of hardening systems assuming an attacker has gained access. It then provides recommendations for various hardening techniques including: updating systems, removing unnecessary packages and users, securing SSH access, configuring firewalls and remote logging, auditing systems, and restricting access to things like temporary directories and compilers. The document is a guide that walks through steps to harden a Linux server across several areas.

linuxhardeningsecurity
SSH: Seguranca no Acesso Remoto
SSH: Seguranca no Acesso RemotoSSH: Seguranca no Acesso Remoto
SSH: Seguranca no Acesso Remoto

Apresentação na Pós-Graduação em Segurança da Informação: - Sniffer de senhas em plain text; - Ataque de brute-force no SSH; - Proteção: Firewall, IPS e/ou TCP Wrappers; - Segurança básica no sshd_config; - Chaves RSA/DSA para acesso remoto; - SSH buscando chaves no LDAP; - Porque previnir o acesso: Fork Bomb

sshsegurançafork
- Is sudo a prefix for administrative commands?
- Yes, but also a lot more:
• Control and log access
• Record and play back terminal input and output
• Modular: extend with your own code, now even in
Python
• It even has humor!
What is sudo?
• Default config
%wheel ALL=(ALL) ALL
• (Almost) all permissions to the wheel group
• Still useful:
• Controls access
• No shared password
• You see who did what
A basic /etc/sudoers
• Recording the terminal
• Playback
• Difficult to modify (not cleartext)
• Saved locally, therefore easy to delete with
unlimited access
• Sudo 1.9: central session recording using sudo_logsrvd
Session recording
• Propagates in real-time
• Can’t be modified locally
• Many limitations (aliases, etc.)
LDAP for central management

Recommended for you

Linux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compactLinux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compact

Linux Capabilities: A better root than SUID root Presented at LinuxCon2014, Düsseldorf, Oct. 15th 2014

privilegessuidfedora
Penetration Testing Boot CAMP
Penetration Testing Boot CAMPPenetration Testing Boot CAMP
Penetration Testing Boot CAMP

The document provides instructions on how to configure an SSH server on Linux, perform footprinting and reconnaissance, scanning tools and techniques, enumeration tools and techniques, password cracking techniques and tools, privilege escalation methods, and keylogging and hidden file techniques. It discusses active and passive footprinting, Nmap port scanning, NetBIOS and SNMP enumeration, Windows password hashes, the sticky keys method for privilege escalation, ActualSpy keylogging software, and hiding files using NTFS alternate data streams. Countermeasures for many of these techniques are also outlined.

Ultimate Unix Meetup Presentation
Ultimate Unix Meetup PresentationUltimate Unix Meetup Presentation
Ultimate Unix Meetup Presentation

This document provides an overview of setting up an ultimate UNIX development environment with custom shell functions, package managers, terminal multiplexers, monitoring tools, and shell customizations. It discusses using Homebrew and apt to manage packages, configuring Tmux and custom scripts, monitoring tools like Htop, iftop and Glances, colorizing tools like ccze and grc, shell enhancements like Oh My Zsh, and utilities like Z and ZLE line editor functions.

unixlinuxprogramming
• Extending sudo using Python
• Using the same APIs as C plugins
• API: https://www.sudo.ws/man/sudo_plugin.man.html
• Python plugin documentation:
https://www.sudo.ws/man/sudo_plugin_python.man.html
• No development environment or compilation needed
Python support
• Accessing input and output from user sessions
• Python example:
IO logs API
• Fun, but not always politically correct :)
Defaults insults
czanik@linux-mewy:~> sudo ls
[sudo] password for root:
Hold it up to the light --- not a brain in sight!
[sudo] password for root:
My pet ferret can type better than you!
[sudo] password for root:
sudo: 3 incorrect password attempts
czanik@linux-mewy:~>
Insults
• Until now I talked about sudo <= 1.9.0 (most
“enterprise” & “LTS” distros)
• Since late 2020 most distros changed to 1.9.0 or
later
• Current version is 1.9.14
• Some 1.9.15 features mentioned at the end:
coming soon ☺
• Sudo installers:
https://www.sudo.ws/getting/packages/
Sudo versions

Recommended for you

Docker Security in Production Overview
Docker Security in Production OverviewDocker Security in Production Overview
Docker Security in Production Overview

Delve Labs was present during the GoSec 2016 conference, where our lead DevOps engineer presented an overview of the current options available for securing Docker in production environments. https://www.delve-labs.com

capabilitiesdevopsnamespaces
What’s new in Sudo 1.8?
What’s new in Sudo 1.8?What’s new in Sudo 1.8?
What’s new in Sudo 1.8?

Sudo 1.8 introduces a modular plugin architecture that allows third-party plugins to implement custom security policies and logging. The new architecture includes policy plugins that determine access control and I/O log plugins that record sessions. Sudo's design allows existing functionality and configurations to remain unchanged while gaining extensibility.

linuxsudosecurity
10 Tips for AIX Security
10 Tips for AIX Security10 Tips for AIX Security
10 Tips for AIX Security

In this PowerPoint, learn how a security policy can be your first line of defense. Servers running AIX and other operating systems are frequent targets of cyberattacks, according to the Data Breach Investigations Report. From DoS attacks to malware, attackers have a variety of strategies at their disposal. Having a security policy in place makes it easier to ensure you have appropriate controls in place to protect mission-critical data.

aixpassword policysecurity software
• Introduced in sudo 1.9.4
• Traditionally plain-text logs with minimal information
• Feature introduced due to old syslog constraints
• Nov 18 12:31:33 centos7sudo sudo[30666]: czanik : 3
incorrect password attempts ; TTY=pts/0 ; PWD=/home/czanik ;
USER=root ; COMMAND=/bin/bash
• Nov 18 12:31:43 centos7sudo sudo[30670]: czanik :
TTY=pts/0 ; PWD=/home/czanik ; USER=root ;
COMMAND=/bin/bash
• Nov 18 12:31:49 centos7sudo sudo[30670]: czanik : command
rejected by I/O plugin ; TTY=pts/0 ; PWD=/home/czanik ;
USER=root ; COMMAND=/bin/bash
JSON-formatted logs
Security Starts Here | One Identity - Restricted - Confidential
• JSON-formatted logs have more information in a structured format
Defaults log_format=json
Nov 18 12:40:30 centos7sudo sudo[30891]:
@cee:{"reject":{"reason":"command rejected by I/O
plugin","server_time":{"seconds":1605699630,"nanoseconds":9332939
11,"iso8601":"20201118114030Z","localtime":"Nov 18
11:40:30"},"submit_time":{"seconds":1605699620,"nanoseconds":130
500349,"iso8601":"20201118114020Z","localtime":"Nov 18
11:40:20"},"submituser":"czanik","command":"/bin/bash","runuser":"ro
ot","runcwd":"/home/czanik","ttyname":"/dev/pts/0","submithost":"cent
os7sudo.localdomain","submitcwd":"/home/czanik","runuid":0,"columns"
:118,"lines":60,"runargv":["/bin/bash"]}}
JSON-formatted logs
Security Starts Here | One Identity - Restricted - Confidential
• Use jq or similar to make logs more human readable on the terminal:
{
"sudo": {
"accept": {
"uuid": "616bc9efcf-b239-469d-60ee-deb5af8ce6",
"server_time": {
"seconds": 1643374700,
"nanoseconds": 222446715,
"iso8601": "20220128125820Z",
"localtime": "Jan 28 13:58:20"
},
"submituser": "czanik",
[…]
JSON-formatted logs
Security Starts Here | One Identity - Restricted - Confidential
• Logging:
• Syslog
• Audit plugin API – reachable also from Python for custom
logging
• Sudo 1.9.4 added logging to sudo_logsrvd
Defaults log_servers=172.16.167.150
Logging to sudo_logsrvd
Security Starts Here | One Identity - Restricted - Confidential

Recommended for you

8 steps to protect your cisco router
8 steps to protect your cisco router8 steps to protect your cisco router
8 steps to protect your cisco router

The document provides 8 steps to secure a Cisco router by restricting access, disabling unused services, encrypting passwords, and logging activities. These simple steps include controlling access to ports, restricting telnet access, blocking spoof packets, restricting SNMP, encrypting passwords, disabling services like HTTP, adding security options, and configuring logging to a remote server. Proper configuration following these steps can significantly increase router security based on nmap scans showing all ports filtered after securing the device.

protect cisco routerscisco router
Hadoop Cluster - Basic OS Setup Insights
Hadoop Cluster - Basic OS Setup InsightsHadoop Cluster - Basic OS Setup Insights
Hadoop Cluster - Basic OS Setup Insights

The document discusses setting up a Hadoop cluster with CentOS 6.5 installed on multiple physical servers. It describes the process of installing CentOS via USB, configuring basic OS settings like hostname, users, SSH, firewall. It also covers configuring network settings, Java installation and enabling passwordless SSH login. The document concludes with taking server snapshots for backup/recovery and installing Hadoop services like HDFS, Hive etc using Cloudera Express on the cluster.

hadoophadoop clustercentos setup
Asiabsdcon2013
Asiabsdcon2013Asiabsdcon2013
Asiabsdcon2013

The document discusses automating the deployment of FreeBSD and PC-BSD systems using pc-thinclient utility. It describes using PXE to boot clients over the network and install operating systems from a server. Key steps include setting up the server with DHCP, ports tree and installation files. Customizations like disk layout, packages and scripts allow automating varied installations for multiple clients from a centralized management point. Tips provided optimize the process like using ZFS, SSD and tmpfs for improved scalability.

pc-bsdpxefreebsd
• Sudo_logsrvd sends logs to syslog
• “HOST” field shows where logs are coming from
Nov 18 12:40:16 centos8splunk.localdomain sudo[21028]: czanik : 3 incorrect
password attempts ; HOST=centos7sudo.localdomain ; TTY=pts/0 ;
PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash
Nov 18 12:40:23 centos8splunk.localdomain sudo[21028]: czanik :
HOST=centos7sudo.localdomain ; TTY=pts/0 ; PWD=/home/czanik ; USER=root
; TSID=00000A ; COMMAND=/bin/bash
Nov 18 12:40:30 centos8splunk.localdomain sudo[21028]: czanik : command
rejected by I/O plugin ; HOST=centos7sudo.localdomain ; TTY=pts/0 ;
PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash
• JSON formatting available
Logging to sudo_logsrvd
Security Starts Here | One Identity - Restricted - Confidential
• Sudo_logsrvd collects session recordings to a central
location
• Originally all sudo clients sent recordings directly
• Sudo version 1.9.7 introduced relay mode
• You can have multiple levels of relays to structure your
network
Using sudo_logsrvd in relay mode
Security Starts Here | One Identity - Restricted - Confidential
• Collect recordings even when central server is
unavailable (maintenance or network problem)
• Have a single network connection through the firewall
instead of granting each host access
• Run it on a gateway host to relay from networks
without direct Internet access, like AWS private
networks
Why relay mode?
Security Starts Here | One Identity - Restricted - Confidential
• Configuring the client or the central server is the same
• On the relay:
• Where to forward
• In case of unreliable networks, store first (default: false)
relay_host = 172.16.167.161
store_first = true
• TLS encryption available
Configuring relay mode
Security Starts Here | One Identity - Restricted - Confidential

Recommended for you

Linux security quick reference guide
Linux security quick reference guideLinux security quick reference guide
Linux security quick reference guide

This document provides guidance on securing Linux systems through various configuration and monitoring techniques. It discusses: - Regularly auditing systems for unauthorized permissions and removing unnecessary setuid/setgid permissions. - Locating and removing world-writable and unowned files, which could be altered by intruders. - Using attributes like append-only and immutable to prevent log files from being deleted or binaries from being replaced. - Configuring options like nosuid in /etc/fstab to restrict permissions on partitions.

How to secure ubuntu 12.04
How to secure ubuntu 12.04 How to secure ubuntu 12.04
How to secure ubuntu 12.04

This document provides instructions for hardening the security of an Ubuntu 12.04 LTS server by configuring firewall rules with UFW, securing SSH access, restricting access to su, hardening PHP and Apache configurations, installing intrusion detection tools like PSAD and Fail2Ban, and scanning for rootkits with RKHunter and CHKRootkit. The 18 steps outlined include configuration of sysctl settings, Bind9 DNS, ModSecurity, and auditing tools like LogWatch and Tiger.

Security Onion
Security OnionSecurity Onion
Security Onion

This document provides an overview and demonstration of Security Onion, an open-source Linux distribution for intrusion detection and network security monitoring. It describes Security Onion's tools like Snort, Sguil, Pulled Pork, Snorby and Daemonlogger. The document demonstrates how to install Security Onion, use its tools to analyze network traffic, view alerts and raw packet captures. It also provides challenges for users to further explore Security Onion's capabilities.

• Previously, full root shell access was needed to start an
application from a user-inaccessible directory
• Full root access easily gained using chroot
• Starting with sudo 1.9.3, both can be configured from
/etc/sudoers
Using chroot and cwd
Security Starts Here | One Identity - Restricted - Confidential
• The chroot command needs root privileges
• Using with sudo, it is still possible to sudo chroot /
• Chroot support must be explicitly enabled in sudoers
Using chroot
Security Starts Here | One Identity - Restricted - Confidential
• If directory is not restricted in sudoers:
Defaults:%wheel runchroot=*
• sudo --chroot / -s can do the same ☺
• But at least it is nicely logged:
Sep 24 15:58:55 centos7sudo sudo[8149]: czanik :
TTY=pts/0 ; CHROOT=/ ; PWD=/home/czanik ;
USER=root ; TSID=00001G ; COMMAND=/bin/bash
Using chroot
Security Starts Here | One Identity - Restricted - Confidential
• Directory can be restricted in sudoers:
Defaults:%wheel runchroot=/var/lib/mock/epel7-
x86_64/root
• If chroot or a given directory is not allowed, it is logged:
Sep 25 08:43:32 centos7sudo sudo[2640]: czanik : user
not allowed to change root directory to
/an/interesting/directory ; TTY=pts/0 ;
CHROOT=/an/interesting/directory ; PWD=/home/czanik ;
USER=root ; COMMAND=/bin/bash
Using chroot
Security Starts Here | One Identity - Restricted - Confidential

Recommended for you

Server hardening
Server hardeningServer hardening
Server hardening

The document discusses various methods for hardening Linux security, including securing physical and remote access, addressing top vulnerabilities like weak passwords and open ports, implementing security policies, setting BIOS passwords, password protecting GRUB, choosing strong passwords, securing the root account, disabling console programs, using TCP wrappers, protecting against SYN floods, configuring SSH securely, hardening sysctl.conf settings, leveraging open source tools like Mod_Dosevasive, Fail2ban, Shorewall, and implementing security at the policy level with Shorewall.

remoteoperating systemssh hardening
InSecure Remote Operations - NullCon 2023 by Yossi Sassi
InSecure Remote Operations - NullCon 2023 by Yossi SassiInSecure Remote Operations - NullCon 2023 by Yossi Sassi
InSecure Remote Operations - NullCon 2023 by Yossi Sassi

- The document discusses remote operations and credential exposure during remote management. It highlights the use of various living off the land techniques like RPC, WMI, PSRemoting and RDP. - It provides tips for preventing lateral movement without dedicated security products by leveraging configurations like LogonWorkstations to restrict where accounts can logon. - The key takeaways are to embrace a living off the land mindset, be aware of credential exposure risks during remote operations, and that single configurations can be effective for preventing issues like lateral movement when properly configured and monitored.

cyber securitypowershellrpc
Building Reliability - The Realities of Observability
Building Reliability - The Realities of ObservabilityBuilding Reliability - The Realities of Observability
Building Reliability - The Realities of Observability

Presented at the ATO RTP Meetup Presented by Jeremy Proffit, Director of DevSecOps & SRE for Customer Care and Communications, Ally Title: Building Reliability - The Realities of Observability Abstract: Join me as we discuss true observability, learn what works and what doesn't. We'll not only discuss dashboards, monitoring and alerting, but how these can be built by automation or included in your IAC modules. We'll talk about how to properly alert staff based on priority to keep your staff and yourself sane. And even discuss architecture and how it impacts reliably and why serverless isn't always the best at being reliable.

all things openopen sourceato2024
• Before sudo 1.9.8, only session recording helped in
case of shell or editor access
• Watching recordings is boring and time consuming
• 1.9.8 introduced:
• Logging
• Intercepting
• Works in most cases (does not work for built-in
commands, etc.)
Logging and intercepting sub-commands
Security Starts Here | One Identity - Restricted - Confidential
• Enable with:
Defaults log_subcmds
• Turn on JSON formatting:
Defaults log_format=json
Logging sub-commands
Security Starts Here | One Identity - Restricted - Confidential
I Unnamed (Modified) Row 14 Col 1
czplaptop:/home/czanik # id
uid=0(root) gid=0(root) groups=0(root)
czplaptop:/home/czanik # ls /usr/share/syslog-ng/include/scl/
apache ewmm logmatic snmptrap
cee fortigate mbox solaris
checkpoint graphite netskope sudo
cim graylog2 nodejs sumologic
cisco iptables osquery syslogconf
collectd junos pacct system
default-network-drivers linux-audit paloalto telegram
discord loadbalancer rewrite websense
elasticsearch loggly slack windowseventlog
czplaptop:/home/czanik # exit
Logging sub-commands: editor screenshot
Security Starts Here | One Identity - Restricted - Confidential
• Log without logging subcommands:
Aug 30 13:03:00 czplaptop sudo[10150]: Czanik :
TTY=pts/1 ; PWD=/home/Czanik ; USER=root ;
COMMAND=/usr/bin/joe
Logging sub-commands
Security Starts Here | One Identity - Restricted - Confidential

Recommended for you

Modern Database Best Practices
Modern Database Best PracticesModern Database Best Practices
Modern Database Best Practices

Presented at the ATO RTP Meetup Presented by Peter Zaitsev, Founder of Percona Title: Modern Database Best Practices Abstract: There are now more Database choices available for developers than ever before - there are general purpose databases and specialized databases, single node and distributed databases, Open Source, Proprietary databases and databases available exclusively in the cloud. In this presentation we will cover the best practices of choosing database(s) for your applications, best practices as it comes to application development as well as managing those databases to achieve best possible performance, security, availability at the lowest cost.

all things openato2024open source
Open Source and Public Policy
Open Source and Public PolicyOpen Source and Public Policy
Open Source and Public Policy

All Things Open 2023 Presented at All Things Open 2023 Presented by Deb Bryant - Open Source Initiative, Patrick Masson - Apereo Foundation, Stephen Jacobs - Rochester Institute of Technology, Ruth Suehle - SAS, & Greg Wallace - FreeBSD Foundation Title: Open Source and Public Policy Abstract: New regulations in the software industry and adjacent areas such as AI, open science, open data, and open education are on the rise around the world. Cyber Security, societal impact of AI, data and privacy are paramount issues for legislators globally. At the same time, the COVID-19 pandemic drove collaborative development to unprecedented levels and took Open Source software, open research, open content and data from mainstream to main stage, creating tension between public benefit and citizen safety and security as legislators struggle to find a balance between open collaboration and protecting citizens. Historically, the open source software community and foundations supporting its work have not engaged in policy discussions. Moving forward, thoughtful development of these important public policies whilst not harming our complex ecosystems requires an understanding of how our ecosystem operates. Ensuring stakeholders without historic benefit of representation in those discussions becomes paramount to that end. Please join our open discussion with open policy stakeholders working constructively on current open policy topics. Our panelists will provide a view into how oss foundations and other open domain allies are now rising to this new challenge as well as seizing the opportunity to influence positive changes to the public’s benefit. Topics: Public Policy, Open Science, Open Education, current legislation in the US and EU, US interest in OSS sustainability, intro to the Open Policy Alliance Find more info about All Things Open: On the web: https://www.allthingsopen.org/ Twitter: https://twitter.com/AllThingsOpen LinkedIn: https://www.linkedin.com/company/all-things-open/ Instagram: https://www.instagram.com/allthingsopen/ Facebook: https://www.facebook.com/AllThingsOpen Mastodon: https://mastodon.social/@allthingsopen Threads: https://www.threads.net/@allthingsopen 2023 conference: https://2023.allthingsopen.org/

all things openopen sourceopen source initiative
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...

This document summarizes a presentation about graph-quilt, an open source GraphQL orchestrator library. It discusses the challenges of building a GraphQL orchestrator to unify data from multiple services. Graph-quilt addresses this by allowing services to register their GraphQL schemas and composing them into a unified schema. It also supports features like remote schema extensions, authorization, and adapting existing REST APIs. The presenters believe graph-quilt provides a flexible way to build GraphQL gateways and help more clients adopt GraphQL.

all things openopen sourceato2023
•Logs when logging subcommands:
Aug 30 13:13:14 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/joe
Aug 30 13:13:37 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/sh -c /bin/bash
Aug 30 13:13:37 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash
Aug 30 13:13:37 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/readlink
/proc/10889/exe
Aug 30 13:13:37 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/dircolors -b
/etc/DIR_COLORS
[…]
Aug 30 13:13:37 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/sed -r
s@/*:|([^]):@1n@g;H;x;s@/n@n@
Aug 30 13:13:37 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/tty
Aug 30 13:13:42 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/id
Aug 30 13:13:56 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/ls -A -N --color=none -T
0 /usr/share/syslog-ng/include/scl/
Logging sub-commands
Security Starts Here | One Identity - Restricted - Confidential
• Log with JSON formatting:
Aug 30 13:29:28 czplaptop sudo[11740]:
@cee:{"sudo":{"accept":{"uuid":"18f25b2438-0c44-ddaf-a264-
c70998d319","server_time":{"seconds":1630322968,"nanoseconds":12453428
3,"iso8601":"20210830112928Z","localtime":"Aug 30
11:29:28"},"submit_time":{"seconds":1630322965,"nanoseconds":357407987,
"iso8601":"20210830112925Z","localtime":"Aug 30
11:29:25"},"submituser":"czanik","command":"/usr/bin/joe","runuser":"root","r
uncwd":"/home/czanik","ttyname":"/dev/pts/1","submithost":"czplaptop","subm
itcwd":"/home/czanik","runuid":0,"columns":80,"lines":24,"runargv":["joe","/et
c/issue"],"runenv":["LANG=en_US.UTF-
8","COLORTERM=truecolor","TERM=xterm-
256color","MAIL=/var/mail/root","PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/local
/bin:/usr/local/sbin","LOGNAME=root","USER=root","HOME=/root","SHELL=/bin
/bash","SUDO_COMMAND=/usr/bin/joe
/etc/issue","SUDO_USER=czanik","SUDO_UID=1000","SUDO_GID=100"]}}}
Logging sub-commands
Security Starts Here | One Identity - Restricted - Confidential
• Can prevent applications from running
• Enabling is a two-step process in sudoers
Defaults intercept
• And the actual rule:
czanik ALL = (ALL) ALL, !/usr/bin/who
Intercepting sub-commands
Security Starts Here | One Identity - Restricted - Confidential
• Even if running a shell with full root access:
czanik@czplaptop:~> sudo -s
czplaptop:/home/czanik # who
Sorry, user czanik is not allowed to execute
'/usr/bin/who' as root on czplaptop.
bash: /usr/bin/who: Permission denied
Intercepting sub-commands
Security Starts Here | One Identity - Restricted - Confidential

Recommended for you

The State of Passwordless Auth on the Web - Phil Nash
The State of Passwordless Auth on the Web - Phil NashThe State of Passwordless Auth on the Web - Phil Nash
The State of Passwordless Auth on the Web - Phil Nash

Presented at All Things Open 2023 Presented by Phil Nash - Sonar Title: The State of Passwordless Auth on the Web Abstract: Can we get rid of passwords yet? They make for a poor user experience and users are notoriously bad with them. The advent of WebAuthn has brought a passwordless world closer, but where do we really stand? In this talk we'll explore the current user experience of WebAuthn and the requirements a user has to fulfil to authenticate without a password. We'll also explore the fallbacks and safeguards we can use to make the password experience better and more secure. By the end of the session you'll have a vision of how authentication could look in the future and a blueprint for how to build the best auth experience today. Find more info about All Things Open: On the web: https://www.allthingsopen.org/ Twitter: https://twitter.com/AllThingsOpen LinkedIn: https://www.linkedin.com/company/all-things-open/ Instagram: https://www.instagram.com/allthingsopen/ Facebook: https://www.facebook.com/AllThingsOpen Mastodon: https://mastodon.social/@allthingsopen Threads: https://www.threads.net/@allthingsopen 2023 conference: https://2023.allthingsopen.org/

all things openato2023open source
Total ReDoS: The dangers of regex in JavaScript
Total ReDoS: The dangers of regex in JavaScriptTotal ReDoS: The dangers of regex in JavaScript
Total ReDoS: The dangers of regex in JavaScript

Presented at All Things Open 2023 Presented by Phil Nash - Sonar Title: Total ReDoS: The dangers of regex in JavaScript Abstract: Regular expressions are complicated and can be hard to learn. On top of that, they can also be a security risk; writing the wrong pattern can open your application up to denial of service attacks. One token out of place and you invite in the dreaded ReDoS. But how can a regular expression cause this? In this talk we’ll track down the patterns that can cause this trouble, explain why they are an issue and propose ways to fix them now and avoid them in the future. Together we’ll demystify these powerful search patterns and keep your application safe from expressions that behave in a way that is anything but regular. Find more info about All Things Open: On the web: https://www.allthingsopen.org/ Twitter: https://twitter.com/AllThingsOpen LinkedIn: https://www.linkedin.com/company/all-things-open/ Instagram: https://www.instagram.com/allthingsopen/ Facebook: https://www.facebook.com/AllThingsOpen Mastodon: https://mastodon.social/@allthingsopen Threads: https://www.threads.net/@allthingsopen 2023 conference: https://2023.allthingsopen.org/

all things openato2023open source
What Does Real World Mass Adoption of Decentralized Tech Look Like?
What Does Real World Mass Adoption of Decentralized Tech Look Like?What Does Real World Mass Adoption of Decentralized Tech Look Like?
What Does Real World Mass Adoption of Decentralized Tech Look Like?

Presented at All Things Open 2023 Presented by Karl Mozurkewich - Storj Title: What Does Real World Mass Adoption of Decentralized Tech Look Like? Abstract: We delve into the transformative potential of decentralized technology. Beginning with a brief overview of the rise of centralization with the advent of the internet and the counter-shift marked by blockchain we explore the intrinsic characteristics of decentralized and distributed systems, such as trustless operations, peer-to-peer networks, and enterprise application scalability. Various sectors, including finance, supply chains, media and entertainment, data science and cloud infrastructure are on the brink of disruption. The societal implications are vast, with the potential for greater individual empowerment, a greener planet and more viable resource utilization, but concerns about data security persist. Find more info about All Things Open: On the web: https://www.allthingsopen.org/ Twitter: https://twitter.com/AllThingsOpen LinkedIn: https://www.linkedin.com/company/all-things-open/ Instagram: https://www.instagram.com/allthingsopen/ Facebook: https://www.facebook.com/AllThingsOpen Mastodon: https://mastodon.social/@allthingsopen Threads: https://www.threads.net/@allthingsopen 2023 conference: https://2023.allthingsopen.org/

all things openopen sourceato2023
• Visibility is not always good
• Session recordings can include passwords
Hiding passwords in recordings
Security Starts Here | One Identity - Restricted - Confidential
• Recordings are saved under /var/log/sudo-io/
• No sudo tool to display input
• Files are compressed
zless /var/log/sudo-io/00/00/01/ttyin
passwd bla^Mblabla^Mblabla^M^D
Hiding passwords in recordings
Security Starts Here | One Identity - Restricted - Confidential
• In /etc/sudoers:
Defaults !log_passwords
• Passwords are masked in session recordings:
passwd bla^M********^M********^M^D
Hiding passwords in recordings
Security Starts Here | One Identity - Restricted - Confidential
• The list pseudo-command allows regular users to list
other user’s privileges
• Audit without full admin access
• Introduced in sudo version 1.9.13
bla ALL=(ALL) list
Listing privileges

Recommended for you

How to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractHow to Write & Deploy a Smart Contract
How to Write & Deploy a Smart Contract

Presented at All Things Open 2023 Presented by Anastasia Lalamentik - Kaleido Title: How to Write & Deploy a Smart Contract Abstract: In this talk, Anastasia Lalamentik, Full Stack Engineer at Kaleido, will walk through how Ethereum smart contracts work and go over related concepts like gas fees, the Ethereum Virtual Machine (EVM), the block explorer, and the Solidity programming language. This is vital to anyone who wants to build a blockchain app and is a great introduction to blockchain technology for newcomers to the space. By the end of the talk, attendees will better understand how to: - Write a simple smart contract - Deploy their smart contract to an Ethereum test network through the latest tools like Hardhat and the MetaMask wallet - Test interactions with their deployed smart contract and ensure that everything is working properly Additionally, participants will get to interact with Anastasia's deployed smart contract at the end of the talk. Anastasia’s past talks have attracted and have been attended by a diverse group of participants with a range of experience in the space. Find more info about All Things Open: On the web: https://www.allthingsopen.org/ Twitter: https://twitter.com/AllThingsOpen LinkedIn: https://www.linkedin.com/company/all-things-open/ Instagram: https://www.instagram.com/allthingsopen/ Facebook: https://www.facebook.com/AllThingsOpen Mastodon: https://mastodon.social/@allthingsopen Threads: https://www.threads.net/@allthingsopen 2023 conference: https://2023.allthingsopen.org/

all things openato2023open source
Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
 Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow

Presented at All Things Open 2023 Presented by Paul Brebner - Instaclustr (by Spot by NetApp) Title: Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow Abstract: In this talk we’ll build a Drone delivery application, and then use it to do some Machine Learning “on the fly”. In the 1st part of the talk, we'll build a real-time Drone Delivery demonstration application using a combination of two open-source technologies: Uber’s Cadence (for stateful, scheduled, long-running workflows), and Apache Kafka (for fast streaming data). With up to 2,000 (simulated) drones and deliveries in progress at once this application generates a vast flow of spatio-temporal data. In the 2nd part of the talk, we'll use this platform to explore Machine Learning (ML) over streaming and drifting Kafka data with TensorFlow to try and predict which shops will be busy in advance. Find more info about All Things Open: On the web: https://www.allthingsopen.org/ Twitter: https://twitter.com/AllThingsOpen LinkedIn: https://www.linkedin.com/company/all-things-open/ Instagram: https://www.instagram.com/allthingsopen/ Facebook: https://www.facebook.com/AllThingsOpen Mastodon: https://mastodon.social/@allthingsopen Threads: https://www.threads.net/@allthingsopen 2023 conference: https://2023.allthingsopen.org/

all things openato2023open source
DEI Challenges and Success
DEI Challenges and SuccessDEI Challenges and Success
DEI Challenges and Success

Presented at the All Things Open 2023 Inclusion and Diversity in Open Source Event Presented by Efraim Marquez-Arreaza - Red Hat Title: DEI Challenges and Success Abstract: In today's world, many companies and organizations have Diversity, Equity and Inclusion (DEI) communities. Red Hat Unidos is a DEI community focused on advocating for the Hispanic/Latine community. In this talk, we would like to share our challenges and success during the past 4-years and plans for the future. Find more info about All Things Open: On the web: https://www.allthingsopen.org/ Twitter: https://twitter.com/AllThingsOpen LinkedIn: https://www.linkedin.com/company/all-things-open/ Instagram: https://www.instagram.com/allthingsopen/ Facebook: https://www.facebook.com/AllThingsOpen Mastodon: https://mastodon.social/@allthingsopen Threads: https://www.threads.net/@allthingsopen 2023 conference: https://2023.allthingsopen.org/

all things openato2023open source
bla@czplaptop:~> sudo -l
bla's password:
Matching Defaults entries for bla on czplaptop:
always_set_home,
secure_path=/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin:/usr/local/sbin,
env_reset, env_keep="LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION
LC_TELEPHONE LC_ATIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE",
!insults, ignore_iolog_errors, log_output, log_input
User bla may run the following commands on czplaptop:
(ALL) list
bla@czplaptop:~> sudo -U czanik -l
Matching Defaults entries for czanik on czplaptop:
always_set_home,
secure_path=/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin:/usr/local/sbin,
env_reset, env_keep="LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION
LC_TELEPHONE LC_ATIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE",
!insults, ignore_iolog_errors, log_output, log_input
User czanik may run the following commands on czplaptop:
(ALL) ALL
List privileges
• The long list (-ll) option now also prints the file name
• Arrives in sudo version 1.9.15
List privileges
leap154b:~ # sudo -U mytest -ll
Matching Defaults entries for mytest on leap154b:
always_set_home, secure_path=/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin:/usr/local/sbin, env_reset,
env_keep="LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME
LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE", insults, targetpw
User mytest may run the following commands on leap154b:
Sudoers entry: /etc/sudoers
RunAsUsers: ALL
Commands:
ALL
Sudoers entry: /etc/sudoers.d/foo
RunAsUsers: root
Commands:
ALL
List privileges
• The file name and line number for the rule in the
SOURCE filed of JSON-formatted logs
• Arrives in sudo version 1.9.15
"source":"/etc/sudoers:66:23"
"source":"/etc/sudoers.d/foo:1:15"
SOURCE in JSON logs

Recommended for you

Scaling Web Applications with Background
Scaling Web Applications with BackgroundScaling Web Applications with Background
Scaling Web Applications with Background

Presented at All Things Open 2023 Presented by Lydia Cupery - HubSpot Title: Scaling Web Applications with Background Jobs: Takeaways from Generating a Huge PDF Abstract: Do you need to perform time-consuming or CPU-intensive processes in your web application but are concerned about performance? That’s where background jobs come in. By offloading resource-intensive tasks to separate worker processes, you can improve the scalability of your web application. In this talk, I'll share my experience of using background jobs to scale our web application. I'll discuss the challenges my team faced that led us to adopt background jobs. Then, I'll share practical tips on how to design background jobs for CPU-intensive or time-consuming processes, such as generating huge PDFs and batch emailing. I'll wrap up by going over the performance and cost tradeoffs of background jobs. I'll use Typescript, Express, and Heroku as examples in this talk, but the concepts and best practices that I'll share are applicable to other languages and tools. Find more info about All Things Open: On the web: https://www.allthingsopen.org/ Twitter: https://twitter.com/AllThingsOpen LinkedIn: https://www.linkedin.com/company/all-things-open/ Instagram: https://www.instagram.com/allthingsopen/ Facebook: https://www.facebook.com/AllThingsOpen Mastodon: https://mastodon.social/@allthingsopen Threads: https://www.threads.net/@allthingsopen 2023 conference: https://2023.allthingsopen.org/

all things openato2023open source
Supercharging tutorials with WebAssembly
Supercharging tutorials with WebAssemblySupercharging tutorials with WebAssembly
Supercharging tutorials with WebAssembly

Presented at All Things Open 2023 Presented by Robert Aboukhalil - CZI Title: Supercharging tutorials with WebAssembly Abstract: sandbox.bio is a free platform that features interactive command-line tutorials for bioinformatics. This talk is a deep-dive into how sandbox.bio was built, with a focus on how WebAssembly enabled bringing command-line tools like awk and grep to the web. Although these tools were originally written in C/C++, they all run directly in the browser, thanks to WebAssembly! And since the computations run on each user's computer, this makes the application highly scalable and cost-effective. Along the way, I'll discuss how WebAssembly works and how to get started using it in your own applications. The talk will also cover more advanced WebAssembly features such as threads and SIMD, and will end with a discussion of WebAssembly's benefits and pitfalls (it's a powerful technology, but it's not always the right tool!). Find more info about All Things Open: On the web: https://www.allthingsopen.org/ Twitter: https://twitter.com/AllThingsOpen LinkedIn: https://www.linkedin.com/company/all-things-open/ Instagram: https://www.instagram.com/allthingsopen/ Facebook: https://www.facebook.com/AllThingsOpen Mastodon: https://mastodon.social/@allthingsopen Threads: https://www.threads.net/@allthingsopen 2023 conference: https://2023.allthingsopen.org/

all things openato2023open source
Using SQL to Find Needles in Haystacks
Using SQL to Find Needles in HaystacksUsing SQL to Find Needles in Haystacks
Using SQL to Find Needles in Haystacks

Presented at All Things Open 2023 Presented by K.S. Bhaskar - YottaDB LLC Title: Using SQL to Find Needles in Haystacks Abstract: Database journal files capture every update to a database. A database of a few hundred GB can generate GBs worth of journal files every minute at busy times. Troubleshooting and forensices, especially of rare and intermittent problems, such as which process made what update and when, is an exercise of finding needles in haystacks. A similar problem exists with syslogs. A solution is to load the journal files and syslogs into a database, and use SQL to query the database. Bhaskar will present and demonstrate this with a 100% FOSS stack. Find more info about All Things Open: On the web: https://www.allthingsopen.org/ Twitter: https://twitter.com/AllThingsOpen LinkedIn: https://www.linkedin.com/company/all-things-open/ Instagram: https://www.instagram.com/allthingsopen/ Facebook: https://www.facebook.com/AllThingsOpen Mastodon: https://mastodon.social/@allthingsopen Threads: https://www.threads.net/@allthingsopen 2023 conference: https://2023.allthingsopen.org/

all things openato2023open source
• Recent versions of sudo let you see and control a lot
more activities:
• More detailed, easier to use log messages
• Log sessions through relays
• Less need for root shells: chroot & cwd support
• Track and intercept sub-commands
• Password masking in logs
• Listing privileges
Summary
Security Starts Here | One Identity - Restricted - Confidential
• Sudo website: https://www.sudo.ws/
• My email: peter.czanik@oneidentity.com
• Twitter: @Pczanik
Questions?
Sudo – Giving access while staying in control
Sudo – Giving access while staying in control

Recommended for you

Configuration Security as a Game of Pursuit Intercept
Configuration Security as a Game of Pursuit InterceptConfiguration Security as a Game of Pursuit Intercept
Configuration Security as a Game of Pursuit Intercept

The document discusses configuration security as a game of pursuit-evasion and intercept. It was presented by Wes Widner, Principal Engineer at Automox. The document includes a JSON policy snippet with an ID, statement, actions, effects, resources, and principal allowing the GetObject action on all objects in an S3 bucket for all principals. It has page numbers at the bottom indicating it is from a larger presentation.

all things openato2023open source
Scaling an Open Source Sponsorship Program
Scaling an Open Source Sponsorship ProgramScaling an Open Source Sponsorship Program
Scaling an Open Source Sponsorship Program

Presented at All Things Open 2023 Presented by Carol Huang & Mike Fix - Stripe Title: Scaling an Open Source Sponsorship Program Abstract: ​​We already know this: the open-source ecosystem needs further monetary investment from the companies that benefit most from it. Likewise, companies say they want to participate in these initiatives, but find it hard to dedicate resources to open source funding when there isn’t a clear ROI. This talk discusses how the Open Source Program Office at Stripe built a scalable, sustainable open source sponsorship model that aligns internal company incentives with those of open source maintainers and the community at large. We go over the unique “platformization” of our OSPO that allowed us to create multiple funding models, such as BYOB (Bring Your Own Budget), and share lessons learned from this experience as well as other OSPOs. Find more info about All Things Open: On the web: https://www.allthingsopen.org/ Twitter: https://twitter.com/AllThingsOpen LinkedIn: https://www.linkedin.com/company/all-things-open/ Instagram: https://www.instagram.com/allthingsopen/ Facebook: https://www.facebook.com/AllThingsOpen Mastodon: https://mastodon.social/@allthingsopen Threads: https://www.threads.net/@allthingsopen 2023 conference: https://2023.allthingsopen.org/

all things openato2023open source
Build Developer Experience Teams for Open Source
Build Developer Experience Teams for Open SourceBuild Developer Experience Teams for Open Source
Build Developer Experience Teams for Open Source

Presented at All Things Open 2023 Presented by Arundeep Nagaraj - Amazon Web Services (AWS) Title: Build Developer Experience Teams for Open Source Abstract: Open Source has become the default strategy for many IT organizations and Enterprises. However, the constant challenge with Open Source leaders of these organizations has been - How is my product's developer experience? Is this the right metric to track? How can I scale my team to support our products better? How can I add automation to scale redundant workflows? If my product involves working with developers, how can I scale to the complexity of the requests and reduce Engineering bandwidth? The challenges within support of open source products continues to magnify depending on the end user persona whether they are consumers or contributors to your product. Consumers utilize your product, SDK's and API's and are blocked with using it or run into issues, whereas contributors are advanced users of your software that understands the codebase to provide a meaningful contribution back to the product. The answer to the above is to look at Open Source support as a first-class citizen of your corporate support strategy. To employ the right level of developer focused support as opposed to traditional infrastructure based support is key to scale to the amount of developers using your product. Supporting customers in the open involves more than pure support - building customer / developer experiences (DX) in the open (across platforms and communities) that pivots over the ability of your product's users or developers to be focused on the end-to-end value add. This helps with your active developer growth and retention of users. Key Takeaways: - IT leaders of Open Source will learn to employ strategies to build a DX team that engages on multiple platforms - Work on identifying accurate metrics for product and organization - Innovate on platforms such as Discord to build a bot and a dashboard - Ability to leverage customer feedback and iterate over the customer success flywheel - Distinguish between DX and Developer Advocacy (DA) Find more info about All Things Open: On the web: https://www.allthingsopen.org/ Twitter: https://twitter.com/AllThingsOpen LinkedIn: https://www.linkedin.com/company/all-things-open/ Instagram: https://www.instagram.com/allthingsopen/ Facebook: https://www.facebook.com/AllThingsOpen Mastodon: https://mastodon.social/@allthingsopen Threads: https://www.threads.net/@allthingsopen 2023 conference: https://2023.allthingsopen.org/

all things openato2023open source

More Related Content

Similar to Sudo – Giving access while staying in control

Cent os 5 ssh
Cent os 5 sshCent os 5 ssh
Cent os 5 ssh
Alejandro Besne
 
Basic security &amp; info
Basic security &amp; infoBasic security &amp; info
Basic security &amp; info
Tola LENG
 
Presentation nix
Presentation nixPresentation nix
Presentation nix
fangjiafu
 
Presentation nix
Presentation nixPresentation nix
Presentation nix
fangjiafu
 
Linux Hardening - Made Easy
Linux Hardening - Made EasyLinux Hardening - Made Easy
Linux Hardening - Made Easy
Guy Barnhart-Magen
 
SSH: Seguranca no Acesso Remoto
SSH: Seguranca no Acesso RemotoSSH: Seguranca no Acesso Remoto
SSH: Seguranca no Acesso Remoto
Tiago Cruz
 
Linux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compactLinux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compact
Alessandro Selli
 
Penetration Testing Boot CAMP
Penetration Testing Boot CAMPPenetration Testing Boot CAMP
Ultimate Unix Meetup Presentation
Ultimate Unix Meetup PresentationUltimate Unix Meetup Presentation
Ultimate Unix Meetup Presentation
JacobMenke1
 
Docker Security in Production Overview
Docker Security in Production OverviewDocker Security in Production Overview
Docker Security in Production Overview
Delve Labs
 
What’s new in Sudo 1.8?
What’s new in Sudo 1.8?What’s new in Sudo 1.8?
What’s new in Sudo 1.8?
Tyler Reese
 
10 Tips for AIX Security
10 Tips for AIX Security10 Tips for AIX Security
10 Tips for AIX Security
HelpSystems
 
8 steps to protect your cisco router
8 steps to protect your cisco router8 steps to protect your cisco router
8 steps to protect your cisco router
IT Tech
 
Hadoop Cluster - Basic OS Setup Insights
Hadoop Cluster - Basic OS Setup InsightsHadoop Cluster - Basic OS Setup Insights
Hadoop Cluster - Basic OS Setup Insights
Sruthi Kumar Annamnidu
 
Asiabsdcon2013
Asiabsdcon2013Asiabsdcon2013
Asiabsdcon2013
krispcbsd
 
Linux security quick reference guide
Linux security quick reference guideLinux security quick reference guide
Linux security quick reference guide
Craig Cannon
 
How to secure ubuntu 12.04
How to secure ubuntu 12.04 How to secure ubuntu 12.04
How to secure ubuntu 12.04
John Richard
 
Security Onion
Security OnionSecurity Onion
Security Onion
johndegruyter
 
Server hardening
Server hardeningServer hardening
Server hardening
Teja Babu
 
InSecure Remote Operations - NullCon 2023 by Yossi Sassi
InSecure Remote Operations - NullCon 2023 by Yossi SassiInSecure Remote Operations - NullCon 2023 by Yossi Sassi
InSecure Remote Operations - NullCon 2023 by Yossi Sassi
Yossi Sassi
 

Similar to Sudo – Giving access while staying in control (20)

Cent os 5 ssh
Cent os 5 sshCent os 5 ssh
Cent os 5 ssh
 
Basic security &amp; info
Basic security &amp; infoBasic security &amp; info
Basic security &amp; info
 
Presentation nix
Presentation nixPresentation nix
Presentation nix
 
Presentation nix
Presentation nixPresentation nix
Presentation nix
 
Linux Hardening - Made Easy
Linux Hardening - Made EasyLinux Hardening - Made Easy
Linux Hardening - Made Easy
 
SSH: Seguranca no Acesso Remoto
SSH: Seguranca no Acesso RemotoSSH: Seguranca no Acesso Remoto
SSH: Seguranca no Acesso Remoto
 
Linux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compactLinux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compact
 
Penetration Testing Boot CAMP
Penetration Testing Boot CAMPPenetration Testing Boot CAMP
Penetration Testing Boot CAMP
 
Ultimate Unix Meetup Presentation
Ultimate Unix Meetup PresentationUltimate Unix Meetup Presentation
Ultimate Unix Meetup Presentation
 
Docker Security in Production Overview
Docker Security in Production OverviewDocker Security in Production Overview
Docker Security in Production Overview
 
What’s new in Sudo 1.8?
What’s new in Sudo 1.8?What’s new in Sudo 1.8?
What’s new in Sudo 1.8?
 
10 Tips for AIX Security
10 Tips for AIX Security10 Tips for AIX Security
10 Tips for AIX Security
 
8 steps to protect your cisco router
8 steps to protect your cisco router8 steps to protect your cisco router
8 steps to protect your cisco router
 
Hadoop Cluster - Basic OS Setup Insights
Hadoop Cluster - Basic OS Setup InsightsHadoop Cluster - Basic OS Setup Insights
Hadoop Cluster - Basic OS Setup Insights
 
Asiabsdcon2013
Asiabsdcon2013Asiabsdcon2013
Asiabsdcon2013
 
Linux security quick reference guide
Linux security quick reference guideLinux security quick reference guide
Linux security quick reference guide
 
How to secure ubuntu 12.04
How to secure ubuntu 12.04 How to secure ubuntu 12.04
How to secure ubuntu 12.04
 
Security Onion
Security OnionSecurity Onion
Security Onion
 
Server hardening
Server hardeningServer hardening
Server hardening
 
InSecure Remote Operations - NullCon 2023 by Yossi Sassi
InSecure Remote Operations - NullCon 2023 by Yossi SassiInSecure Remote Operations - NullCon 2023 by Yossi Sassi
InSecure Remote Operations - NullCon 2023 by Yossi Sassi
 

More from All Things Open

Building Reliability - The Realities of Observability
Building Reliability - The Realities of ObservabilityBuilding Reliability - The Realities of Observability
Building Reliability - The Realities of Observability
All Things Open
 
Modern Database Best Practices
Modern Database Best PracticesModern Database Best Practices
Modern Database Best Practices
All Things Open
 
Open Source and Public Policy
Open Source and Public PolicyOpen Source and Public Policy
Open Source and Public Policy
All Things Open
 
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
All Things Open
 
The State of Passwordless Auth on the Web - Phil Nash
The State of Passwordless Auth on the Web - Phil NashThe State of Passwordless Auth on the Web - Phil Nash
The State of Passwordless Auth on the Web - Phil Nash
All Things Open
 
Total ReDoS: The dangers of regex in JavaScript
Total ReDoS: The dangers of regex in JavaScriptTotal ReDoS: The dangers of regex in JavaScript
Total ReDoS: The dangers of regex in JavaScript
All Things Open
 
What Does Real World Mass Adoption of Decentralized Tech Look Like?
What Does Real World Mass Adoption of Decentralized Tech Look Like?What Does Real World Mass Adoption of Decentralized Tech Look Like?
What Does Real World Mass Adoption of Decentralized Tech Look Like?
All Things Open
 
How to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractHow to Write & Deploy a Smart Contract
How to Write & Deploy a Smart Contract
All Things Open
 
Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
 Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
All Things Open
 
DEI Challenges and Success
DEI Challenges and SuccessDEI Challenges and Success
DEI Challenges and Success
All Things Open
 
Scaling Web Applications with Background
Scaling Web Applications with BackgroundScaling Web Applications with Background
Scaling Web Applications with Background
All Things Open
 
Supercharging tutorials with WebAssembly
Supercharging tutorials with WebAssemblySupercharging tutorials with WebAssembly
Supercharging tutorials with WebAssembly
All Things Open
 
Using SQL to Find Needles in Haystacks
Using SQL to Find Needles in HaystacksUsing SQL to Find Needles in Haystacks
Using SQL to Find Needles in Haystacks
All Things Open
 
Configuration Security as a Game of Pursuit Intercept
Configuration Security as a Game of Pursuit InterceptConfiguration Security as a Game of Pursuit Intercept
Configuration Security as a Game of Pursuit Intercept
All Things Open
 
Scaling an Open Source Sponsorship Program
Scaling an Open Source Sponsorship ProgramScaling an Open Source Sponsorship Program
Scaling an Open Source Sponsorship Program
All Things Open
 
Build Developer Experience Teams for Open Source
Build Developer Experience Teams for Open SourceBuild Developer Experience Teams for Open Source
Build Developer Experience Teams for Open Source
All Things Open
 
Deploying Models at Scale with Apache Beam
Deploying Models at Scale with Apache BeamDeploying Models at Scale with Apache Beam
Deploying Models at Scale with Apache Beam
All Things Open
 
Fortifying the Future: Tackling Security Challenges in AI/ML Applications
Fortifying the Future: Tackling Security Challenges in AI/ML ApplicationsFortifying the Future: Tackling Security Challenges in AI/ML Applications
Fortifying the Future: Tackling Security Challenges in AI/ML Applications
All Things Open
 
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
All Things Open
 
Building AlmaLinux OS without RHEL sources code
Building AlmaLinux OS without RHEL sources codeBuilding AlmaLinux OS without RHEL sources code
Building AlmaLinux OS without RHEL sources code
All Things Open
 

More from All Things Open (20)

Building Reliability - The Realities of Observability
Building Reliability - The Realities of ObservabilityBuilding Reliability - The Realities of Observability
Building Reliability - The Realities of Observability
 
Modern Database Best Practices
Modern Database Best PracticesModern Database Best Practices
Modern Database Best Practices
 
Open Source and Public Policy
Open Source and Public PolicyOpen Source and Public Policy
Open Source and Public Policy
 
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
 
The State of Passwordless Auth on the Web - Phil Nash
The State of Passwordless Auth on the Web - Phil NashThe State of Passwordless Auth on the Web - Phil Nash
The State of Passwordless Auth on the Web - Phil Nash
 
Total ReDoS: The dangers of regex in JavaScript
Total ReDoS: The dangers of regex in JavaScriptTotal ReDoS: The dangers of regex in JavaScript
Total ReDoS: The dangers of regex in JavaScript
 
What Does Real World Mass Adoption of Decentralized Tech Look Like?
What Does Real World Mass Adoption of Decentralized Tech Look Like?What Does Real World Mass Adoption of Decentralized Tech Look Like?
What Does Real World Mass Adoption of Decentralized Tech Look Like?
 
How to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractHow to Write & Deploy a Smart Contract
How to Write & Deploy a Smart Contract
 
Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
 Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
 
DEI Challenges and Success
DEI Challenges and SuccessDEI Challenges and Success
DEI Challenges and Success
 
Scaling Web Applications with Background
Scaling Web Applications with BackgroundScaling Web Applications with Background
Scaling Web Applications with Background
 
Supercharging tutorials with WebAssembly
Supercharging tutorials with WebAssemblySupercharging tutorials with WebAssembly
Supercharging tutorials with WebAssembly
 
Using SQL to Find Needles in Haystacks
Using SQL to Find Needles in HaystacksUsing SQL to Find Needles in Haystacks
Using SQL to Find Needles in Haystacks
 
Configuration Security as a Game of Pursuit Intercept
Configuration Security as a Game of Pursuit InterceptConfiguration Security as a Game of Pursuit Intercept
Configuration Security as a Game of Pursuit Intercept
 
Scaling an Open Source Sponsorship Program
Scaling an Open Source Sponsorship ProgramScaling an Open Source Sponsorship Program
Scaling an Open Source Sponsorship Program
 
Build Developer Experience Teams for Open Source
Build Developer Experience Teams for Open SourceBuild Developer Experience Teams for Open Source
Build Developer Experience Teams for Open Source
 
Deploying Models at Scale with Apache Beam
Deploying Models at Scale with Apache BeamDeploying Models at Scale with Apache Beam
Deploying Models at Scale with Apache Beam
 
Fortifying the Future: Tackling Security Challenges in AI/ML Applications
Fortifying the Future: Tackling Security Challenges in AI/ML ApplicationsFortifying the Future: Tackling Security Challenges in AI/ML Applications
Fortifying the Future: Tackling Security Challenges in AI/ML Applications
 
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
 
Building AlmaLinux OS without RHEL sources code
Building AlmaLinux OS without RHEL sources codeBuilding AlmaLinux OS without RHEL sources code
Building AlmaLinux OS without RHEL sources code
 

Recently uploaded

Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Bert Blevins
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
Aurora Consulting
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
shanthidl1
 
The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
Larry Smarr
 
20240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 202420240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 2024
Matthew Sinclair
 
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Erasmo Purificato
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
Lidia A.
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 
Research Directions for Cross Reality Interfaces
Research Directions for Cross Reality InterfacesResearch Directions for Cross Reality Interfaces
Research Directions for Cross Reality Interfaces
Mark Billinghurst
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
Yevgen Sysoyev
 
Manual | Product | Research Presentation
Manual | Product | Research PresentationManual | Product | Research Presentation
Manual | Product | Research Presentation
welrejdoall
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
rajancomputerfbd
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
ArgaBisma
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
huseindihon
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
SynapseIndia
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
ishalveerrandhawa1
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
Stephanie Beckett
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
Awais Yaseen
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
UiPathCommunity
 

Recently uploaded (20)

Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
 
The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
 
20240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 202420240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 2024
 
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 
Research Directions for Cross Reality Interfaces
Research Directions for Cross Reality InterfacesResearch Directions for Cross Reality Interfaces
Research Directions for Cross Reality Interfaces
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
 
Manual | Product | Research Presentation
Manual | Product | Research PresentationManual | Product | Research Presentation
Manual | Product | Research Presentation
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
 

Sudo – Giving access while staying in control

  • 2. Peter Czanik Open Source Evangelist One Identity @PCzanik Security Starts Here | One Identity - Restricted - Confidential Sudo: Giving access while staying in control
  • 3. • Working at the Budapest office of One Identity (formerly known as Balabit) • syslog-ng & sudo upstream • Helping in RPM and FreeBSD packaging • Blogger and speaker About me Security Starts Here | One Identity - Restricted - Confidential
  • 4. • What is sudo? • Some lesser-known features • What’s new? • JSON-formatted logging • Relays • Chroot, working directory • Logging sub-commands • Masking passwords • Getting more precise information Overview Security Starts Here | One Identity - Restricted - Confidential
  • 5. - Is sudo a prefix for administrative commands? - Yes, but also a lot more: • Control and log access • Record and play back terminal input and output • Modular: extend with your own code, now even in Python • It even has humor! What is sudo?
  • 6. • Default config %wheel ALL=(ALL) ALL • (Almost) all permissions to the wheel group • Still useful: • Controls access • No shared password • You see who did what A basic /etc/sudoers
  • 7. • Recording the terminal • Playback • Difficult to modify (not cleartext) • Saved locally, therefore easy to delete with unlimited access • Sudo 1.9: central session recording using sudo_logsrvd Session recording
  • 8. • Propagates in real-time • Can’t be modified locally • Many limitations (aliases, etc.) LDAP for central management
  • 9. • Extending sudo using Python • Using the same APIs as C plugins • API: https://www.sudo.ws/man/sudo_plugin.man.html • Python plugin documentation: https://www.sudo.ws/man/sudo_plugin_python.man.html • No development environment or compilation needed Python support
  • 10. • Accessing input and output from user sessions • Python example: IO logs API
  • 11. • Fun, but not always politically correct :) Defaults insults czanik@linux-mewy:~> sudo ls [sudo] password for root: Hold it up to the light --- not a brain in sight! [sudo] password for root: My pet ferret can type better than you! [sudo] password for root: sudo: 3 incorrect password attempts czanik@linux-mewy:~> Insults
  • 12. • Until now I talked about sudo <= 1.9.0 (most “enterprise” & “LTS” distros) • Since late 2020 most distros changed to 1.9.0 or later • Current version is 1.9.14 • Some 1.9.15 features mentioned at the end: coming soon ☺ • Sudo installers: https://www.sudo.ws/getting/packages/ Sudo versions
  • 13. • Introduced in sudo 1.9.4 • Traditionally plain-text logs with minimal information • Feature introduced due to old syslog constraints • Nov 18 12:31:33 centos7sudo sudo[30666]: czanik : 3 incorrect password attempts ; TTY=pts/0 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash • Nov 18 12:31:43 centos7sudo sudo[30670]: czanik : TTY=pts/0 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash • Nov 18 12:31:49 centos7sudo sudo[30670]: czanik : command rejected by I/O plugin ; TTY=pts/0 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash JSON-formatted logs Security Starts Here | One Identity - Restricted - Confidential
  • 14. • JSON-formatted logs have more information in a structured format Defaults log_format=json Nov 18 12:40:30 centos7sudo sudo[30891]: @cee:{"reject":{"reason":"command rejected by I/O plugin","server_time":{"seconds":1605699630,"nanoseconds":9332939 11,"iso8601":"20201118114030Z","localtime":"Nov 18 11:40:30"},"submit_time":{"seconds":1605699620,"nanoseconds":130 500349,"iso8601":"20201118114020Z","localtime":"Nov 18 11:40:20"},"submituser":"czanik","command":"/bin/bash","runuser":"ro ot","runcwd":"/home/czanik","ttyname":"/dev/pts/0","submithost":"cent os7sudo.localdomain","submitcwd":"/home/czanik","runuid":0,"columns" :118,"lines":60,"runargv":["/bin/bash"]}} JSON-formatted logs Security Starts Here | One Identity - Restricted - Confidential
  • 15. • Use jq or similar to make logs more human readable on the terminal: { "sudo": { "accept": { "uuid": "616bc9efcf-b239-469d-60ee-deb5af8ce6", "server_time": { "seconds": 1643374700, "nanoseconds": 222446715, "iso8601": "20220128125820Z", "localtime": "Jan 28 13:58:20" }, "submituser": "czanik", […] JSON-formatted logs Security Starts Here | One Identity - Restricted - Confidential
  • 16. • Logging: • Syslog • Audit plugin API – reachable also from Python for custom logging • Sudo 1.9.4 added logging to sudo_logsrvd Defaults log_servers=172.16.167.150 Logging to sudo_logsrvd Security Starts Here | One Identity - Restricted - Confidential
  • 17. • Sudo_logsrvd sends logs to syslog • “HOST” field shows where logs are coming from Nov 18 12:40:16 centos8splunk.localdomain sudo[21028]: czanik : 3 incorrect password attempts ; HOST=centos7sudo.localdomain ; TTY=pts/0 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash Nov 18 12:40:23 centos8splunk.localdomain sudo[21028]: czanik : HOST=centos7sudo.localdomain ; TTY=pts/0 ; PWD=/home/czanik ; USER=root ; TSID=00000A ; COMMAND=/bin/bash Nov 18 12:40:30 centos8splunk.localdomain sudo[21028]: czanik : command rejected by I/O plugin ; HOST=centos7sudo.localdomain ; TTY=pts/0 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash • JSON formatting available Logging to sudo_logsrvd Security Starts Here | One Identity - Restricted - Confidential
  • 18. • Sudo_logsrvd collects session recordings to a central location • Originally all sudo clients sent recordings directly • Sudo version 1.9.7 introduced relay mode • You can have multiple levels of relays to structure your network Using sudo_logsrvd in relay mode Security Starts Here | One Identity - Restricted - Confidential
  • 19. • Collect recordings even when central server is unavailable (maintenance or network problem) • Have a single network connection through the firewall instead of granting each host access • Run it on a gateway host to relay from networks without direct Internet access, like AWS private networks Why relay mode? Security Starts Here | One Identity - Restricted - Confidential
  • 20. • Configuring the client or the central server is the same • On the relay: • Where to forward • In case of unreliable networks, store first (default: false) relay_host = 172.16.167.161 store_first = true • TLS encryption available Configuring relay mode Security Starts Here | One Identity - Restricted - Confidential
  • 21. • Previously, full root shell access was needed to start an application from a user-inaccessible directory • Full root access easily gained using chroot • Starting with sudo 1.9.3, both can be configured from /etc/sudoers Using chroot and cwd Security Starts Here | One Identity - Restricted - Confidential
  • 22. • The chroot command needs root privileges • Using with sudo, it is still possible to sudo chroot / • Chroot support must be explicitly enabled in sudoers Using chroot Security Starts Here | One Identity - Restricted - Confidential
  • 23. • If directory is not restricted in sudoers: Defaults:%wheel runchroot=* • sudo --chroot / -s can do the same ☺ • But at least it is nicely logged: Sep 24 15:58:55 centos7sudo sudo[8149]: czanik : TTY=pts/0 ; CHROOT=/ ; PWD=/home/czanik ; USER=root ; TSID=00001G ; COMMAND=/bin/bash Using chroot Security Starts Here | One Identity - Restricted - Confidential
  • 24. • Directory can be restricted in sudoers: Defaults:%wheel runchroot=/var/lib/mock/epel7- x86_64/root • If chroot or a given directory is not allowed, it is logged: Sep 25 08:43:32 centos7sudo sudo[2640]: czanik : user not allowed to change root directory to /an/interesting/directory ; TTY=pts/0 ; CHROOT=/an/interesting/directory ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash Using chroot Security Starts Here | One Identity - Restricted - Confidential
  • 25. • Before sudo 1.9.8, only session recording helped in case of shell or editor access • Watching recordings is boring and time consuming • 1.9.8 introduced: • Logging • Intercepting • Works in most cases (does not work for built-in commands, etc.) Logging and intercepting sub-commands Security Starts Here | One Identity - Restricted - Confidential
  • 26. • Enable with: Defaults log_subcmds • Turn on JSON formatting: Defaults log_format=json Logging sub-commands Security Starts Here | One Identity - Restricted - Confidential
  • 27. I Unnamed (Modified) Row 14 Col 1 czplaptop:/home/czanik # id uid=0(root) gid=0(root) groups=0(root) czplaptop:/home/czanik # ls /usr/share/syslog-ng/include/scl/ apache ewmm logmatic snmptrap cee fortigate mbox solaris checkpoint graphite netskope sudo cim graylog2 nodejs sumologic cisco iptables osquery syslogconf collectd junos pacct system default-network-drivers linux-audit paloalto telegram discord loadbalancer rewrite websense elasticsearch loggly slack windowseventlog czplaptop:/home/czanik # exit Logging sub-commands: editor screenshot Security Starts Here | One Identity - Restricted - Confidential
  • 28. • Log without logging subcommands: Aug 30 13:03:00 czplaptop sudo[10150]: Czanik : TTY=pts/1 ; PWD=/home/Czanik ; USER=root ; COMMAND=/usr/bin/joe Logging sub-commands Security Starts Here | One Identity - Restricted - Confidential
  • 29. •Logs when logging subcommands: Aug 30 13:13:14 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/joe Aug 30 13:13:37 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/sh -c /bin/bash Aug 30 13:13:37 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash Aug 30 13:13:37 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/readlink /proc/10889/exe Aug 30 13:13:37 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/dircolors -b /etc/DIR_COLORS […] Aug 30 13:13:37 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/sed -r s@/*:|([^]):@1n@g;H;x;s@/n@n@ Aug 30 13:13:37 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/tty Aug 30 13:13:42 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/id Aug 30 13:13:56 czplaptop sudo[10874]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/ls -A -N --color=none -T 0 /usr/share/syslog-ng/include/scl/ Logging sub-commands Security Starts Here | One Identity - Restricted - Confidential
  • 30. • Log with JSON formatting: Aug 30 13:29:28 czplaptop sudo[11740]: @cee:{"sudo":{"accept":{"uuid":"18f25b2438-0c44-ddaf-a264- c70998d319","server_time":{"seconds":1630322968,"nanoseconds":12453428 3,"iso8601":"20210830112928Z","localtime":"Aug 30 11:29:28"},"submit_time":{"seconds":1630322965,"nanoseconds":357407987, "iso8601":"20210830112925Z","localtime":"Aug 30 11:29:25"},"submituser":"czanik","command":"/usr/bin/joe","runuser":"root","r uncwd":"/home/czanik","ttyname":"/dev/pts/1","submithost":"czplaptop","subm itcwd":"/home/czanik","runuid":0,"columns":80,"lines":24,"runargv":["joe","/et c/issue"],"runenv":["LANG=en_US.UTF- 8","COLORTERM=truecolor","TERM=xterm- 256color","MAIL=/var/mail/root","PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/local /bin:/usr/local/sbin","LOGNAME=root","USER=root","HOME=/root","SHELL=/bin /bash","SUDO_COMMAND=/usr/bin/joe /etc/issue","SUDO_USER=czanik","SUDO_UID=1000","SUDO_GID=100"]}}} Logging sub-commands Security Starts Here | One Identity - Restricted - Confidential
  • 31. • Can prevent applications from running • Enabling is a two-step process in sudoers Defaults intercept • And the actual rule: czanik ALL = (ALL) ALL, !/usr/bin/who Intercepting sub-commands Security Starts Here | One Identity - Restricted - Confidential
  • 32. • Even if running a shell with full root access: czanik@czplaptop:~> sudo -s czplaptop:/home/czanik # who Sorry, user czanik is not allowed to execute '/usr/bin/who' as root on czplaptop. bash: /usr/bin/who: Permission denied Intercepting sub-commands Security Starts Here | One Identity - Restricted - Confidential
  • 33. • Visibility is not always good • Session recordings can include passwords Hiding passwords in recordings Security Starts Here | One Identity - Restricted - Confidential
  • 34. • Recordings are saved under /var/log/sudo-io/ • No sudo tool to display input • Files are compressed zless /var/log/sudo-io/00/00/01/ttyin passwd bla^Mblabla^Mblabla^M^D Hiding passwords in recordings Security Starts Here | One Identity - Restricted - Confidential
  • 35. • In /etc/sudoers: Defaults !log_passwords • Passwords are masked in session recordings: passwd bla^M********^M********^M^D Hiding passwords in recordings Security Starts Here | One Identity - Restricted - Confidential
  • 36. • The list pseudo-command allows regular users to list other user’s privileges • Audit without full admin access • Introduced in sudo version 1.9.13 bla ALL=(ALL) list Listing privileges
  • 37. bla@czplaptop:~> sudo -l bla's password: Matching Defaults entries for bla on czplaptop: always_set_home, secure_path=/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin:/usr/local/sbin, env_reset, env_keep="LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_TELEPHONE LC_ATIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE", !insults, ignore_iolog_errors, log_output, log_input User bla may run the following commands on czplaptop: (ALL) list bla@czplaptop:~> sudo -U czanik -l Matching Defaults entries for czanik on czplaptop: always_set_home, secure_path=/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin:/usr/local/sbin, env_reset, env_keep="LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_TELEPHONE LC_ATIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE", !insults, ignore_iolog_errors, log_output, log_input User czanik may run the following commands on czplaptop: (ALL) ALL List privileges
  • 38. • The long list (-ll) option now also prints the file name • Arrives in sudo version 1.9.15 List privileges
  • 39. leap154b:~ # sudo -U mytest -ll Matching Defaults entries for mytest on leap154b: always_set_home, secure_path=/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin:/usr/local/sbin, env_reset, env_keep="LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE", insults, targetpw User mytest may run the following commands on leap154b: Sudoers entry: /etc/sudoers RunAsUsers: ALL Commands: ALL Sudoers entry: /etc/sudoers.d/foo RunAsUsers: root Commands: ALL List privileges
  • 40. • The file name and line number for the rule in the SOURCE filed of JSON-formatted logs • Arrives in sudo version 1.9.15 "source":"/etc/sudoers:66:23" "source":"/etc/sudoers.d/foo:1:15" SOURCE in JSON logs
  • 41. • Recent versions of sudo let you see and control a lot more activities: • More detailed, easier to use log messages • Log sessions through relays • Less need for root shells: chroot & cwd support • Track and intercept sub-commands • Password masking in logs • Listing privileges Summary Security Starts Here | One Identity - Restricted - Confidential
  • 42. • Sudo website: https://www.sudo.ws/ • My email: peter.czanik@oneidentity.com • Twitter: @Pczanik Questions?