46
Securing Network Access with Open Source Solutions Nick Owen 9/19/09 @wikidsystems [email protected]

Securing Network Access with Open Source solutions

Embed Size (px)

DESCRIPTION

My presentation from Atlanta Linux Fest on how to allow users secure access to your network using open source technologies. Examples include how to add two-factor authentication to Apache, OpenVPN, Astaro, NX etc.

Citation preview

Page 1: Securing Network Access with Open Source solutions

Securing Network Access with Open Source Solutions

Nick Owen

9/19/09

@wikidsystems

[email protected]

Page 2: Securing Network Access with Open Source solutions

Letting the Good Guys In

• You must setup a firewall, but it is just a bump in the road for the attacker

• You need to open ports for access• You need to provide services • You need to do it as securely as

possible

Page 3: Securing Network Access with Open Source solutions

Is this your Network?

• Lots of firewall rules

• Multiple password datastores

• Lots of protocols

• Static passwords

Page 4: Securing Network Access with Open Source solutions

Our Goal:Securely allow access to the network with simplicity and flexibility.

Page 5: Securing Network Access with Open Source solutions

What's important?

• Security!• Meet Regulatory/Compliance

requirements• Flexibility – add/remove pieces• Users are happy-ish• Admins are happy-ish

Page 6: Securing Network Access with Open Source solutions

What are we going to do?

• Authenticate user• Through encrypted tunnels• Using authentication protocols• To secure applications!

Page 7: Securing Network Access with Open Source solutions

There's more than one way...

• A number of two-factor solutions

• Multiple Authentication Protocols

• Many applications

Page 8: Securing Network Access with Open Source solutions

To skin this cat

• SSH• Astaro• OpenVPN• Apache/Squid• NX• Postgresql

Page 9: Securing Network Access with Open Source solutions

Who or what is connecting?

Evil Princess Duck Bot Sweet Chicky Chirpalot

Page 10: Securing Network Access with Open Source solutions

Static Passwords

• The most frequent password: '123456', followed by 'password'

• Password reuse• Passwords are clearly a 20th Century

Technology

Page 11: Securing Network Access with Open Source solutions

Trivia

• What was Dan Kaminsky's Wordpress password?

Page 12: Securing Network Access with Open Source solutions

Certs & Keys • Certificates

– Offline brute-force of passphrase– Is there a passphrase?– Integration across apps is the real

problem

• SSH Keys– Love them, but there are audit issues– Is there a passphrase?– No key expiration system

Page 13: Securing Network Access with Open Source solutions

One-time passwords

• A number of Open Source options:– WiKID, Opie, FreeToken, OTP Auth

• Passwords work everywhere• Just need to change the back-end• Shared Secret or Public key

Page 14: Securing Network Access with Open Source solutions

About SMS

• Trivia: What security question got attackers control of Paris Hilton's cell phone account?

Page 15: Securing Network Access with Open Source solutions

Flexibility comes from Protocols

• Radius• LDAP• TACACS+• SAML• etc

Page 16: Securing Network Access with Open Source solutions

Why I like Radius

• Simple. Server, Port, Shared Secret• It's a pretty standard standard• All commercial VPN products support it• Can do ACL• Freeradius is an excellent product• Even MS supports proxy radius auth now!

Page 17: Securing Network Access with Open Source solutions

PAM rules!

• Once you grok PAM, you get:• SSH• Sudo• Login• SFTP• Etc, etc, etc

Page 18: Securing Network Access with Open Source solutions

PAM Radius

• Edit /etc/raddb/server:radiusserverIPaddress shared_secret 1

• Edit /etc/pam.d/sshd (for example)auth sufficient /lib/security/pam_radius_auth.so

Page 19: Securing Network Access with Open Source solutions

Pam radius example

#%PAM-1.0

auth include system-auth

auth sufficient /lib/security/pam_radius_auth.so

account include system-auth

account sufficient /lib/security/pam_radius_auth.so

password include system-auth

session optional pam_keyinit.so force revoke

session include system-auth

Page 20: Securing Network Access with Open Source solutions

SSH • Create an SSH Gateway box

– All users auth using 2 Factor to the GW– Keys on Gateway for SSO to boxes– No password file on Gateway boxes– No remote root access– Sudo requires 2nd OTP

• Use the command line token :)

Page 21: Securing Network Access with Open Source solutions

Astaro & WiKID

• A detailed example• Two-factor authentication & VPN

Access• Using Radius• PPTP vpn

Page 22: Securing Network Access with Open Source solutions

Configure Radius on Astaro

Page 23: Securing Network Access with Open Source solutions

Enable Radius

Page 24: Securing Network Access with Open Source solutions

Point it to the OTP or Radius server

Page 25: Securing Network Access with Open Source solutions

Associate the Group with a VPN

Page 26: Securing Network Access with Open Source solutions

Create A WiKID Domain

Page 27: Securing Network Access with Open Source solutions

Create a Radius Network Client

Page 28: Securing Network Access with Open Source solutions

Add Shared Secret

Page 29: Securing Network Access with Open Source solutions

Done!

Page 30: Securing Network Access with Open Source solutions

For the End-User

Page 31: Securing Network Access with Open Source solutions

Select Domain & Enter PIN

Page 32: Securing Network Access with Open Source solutions

Enter OTP & Connect

Page 33: Securing Network Access with Open Source solutions

OpenVPN

Create an /etc/pam.d/openvpn file

Add to client.conf or client.opvn:auth-user-pass

Add to server.conf:plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so

openvpn

Page 34: Securing Network Access with Open Source solutions

Apache!

• Http-auth, & most web apps• CMSs• Web-DAV• Webmail• Wordpress• PHPBB, Etc, etc

Page 35: Securing Network Access with Open Source solutions

Apache Radius ExampleInstall mod-auth-radius$ sudo apt-get install libapache-mod-auth-radius

In your httpd.conf add:AddRadiusAuth radius_server:1812 shared_secret 5AddRadiusCookieValid 60

Remember Radius is port 1812 *UDP*

Page 36: Securing Network Access with Open Source solutions

Apache Radius Example con't

Enter this into your apache2.conf:<location> Options Indexes FollowSymlinks AuthType Basic AuthName "WiKID RADIUS authentication" AuthBasicAuthoritative Off AuthBasicProvider radius AuthRadiusAuthoritative on AuthRadiusActive On Require valid-user</location>Restart Apache!

Page 37: Securing Network Access with Open Source solutions

Squid• Configure auth_param to use pam:

auth_param basic program /usr/lib/squid/pam_auth

• Then set the ACL rules, delete the other http_access rules:

acl pam proxy_auth REQUIRED

http_access allow pam

Page 38: Securing Network Access with Open Source solutions

SSL Attacks

• Malicious WiFi APs• DNS-Cache poisoning• Malware• SSL stripping

Page 39: Securing Network Access with Open Source solutions

Prevent MITM attacks with Mutual HTTPS Auth

• In WiKID, add a “Registered URL” to the domain

• The Server will store a hash of the site's SSL cert.

• When the user requests an OTP, the token gets the SSL and compares the two

• If OK, it launches the browser to the URL

Page 40: Securing Network Access with Open Source solutions

Remote Desktop

• FreeNX, NoMachine, Tacix, NeatX (google)

• Remote X, VNC, RDP, desktop sharing and session shadowing

• Tunneled through SSH• Auth via pam: /etc/pam.d/sshd• Quite Fast

Page 41: Securing Network Access with Open Source solutions

Postgresql

Edit the pg_hba.conf: host all all 192.168.0.0/24 pam postgresql

Edit your /etc/pam.d/postgresql

What about MySQL?

Page 42: Securing Network Access with Open Source solutions

Pretty Lame Diagram

VPN, SSH, HTTPS Gateway

Desktop, Mail, Web

Auth/Radius Server

RADIUS, LDAP, etc

SSH, RDP, VNC, HTTPS

Page 43: Securing Network Access with Open Source solutions

Join the cause!

• If Linux geeks aren't leading the way to increased security, who will?

• Static passwords are teh suxxor• Demand two-factor authentication!• Contribute!

Page 44: Securing Network Access with Open Source solutions

The next Dan Kaminsky?• Protect SSH with two-factor• Have root password > 5 characters,

don't use it, use sudo• Protect sudo with two-factor• WordPress – protect /wordpress/wp-

admin/ with two-factor • Switch to Postgresql & use two-factor• Only open ports are 22, 80 and 443

Page 45: Securing Network Access with Open Source solutions

More Information

• http://www.kernel.org/pub/linux/libs/pam/• http://freeradius.org/pam_radius_auth/• http://sourceforge.net/projects/tacplus/• http://www.wikidsystems.com/

– WiKID Documentation Center →Integration How-tos

• Downloads → Network Clients – Ruby, Python, PHP, C#, Java

Page 46: Securing Network Access with Open Source solutions

Any questions?

[email protected]@wikidsystems