LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
LinkBack Search this Thread
Old 05-09-2012, 01:37 PM   #1
DrakeTungsten
LQ Newbie
 
Registered: May 2012
Posts: 2

Rep: Reputation: Disabled
How to disable USB and Network access?


How do I turn off USB (flash drive storage) and disable network access? I want to build a PC that is dedicated to just viewing a PDF document. I don't want the user to be able to copy the document to a flash drive or email it or otherwise copy it anywhere else. I do not have a Linux distro preference. The PC needs no other functionality other than displaying the document.
 
Old 05-09-2012, 01:39 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,380

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
You would have to look at setting up some module rules to disable the EHCI/UHCI modules which provide USB plug-n-play support, then set up IPtable rules to drop all outgoing and incoming connections.
 
1 members found this post helpful.
Old 05-09-2012, 02:17 PM   #3
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Ubuntu 10.10, Slackware 64-current
Posts: 2,046

Rep: Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747
LQ Search function on "disable USB", security forum only provides 54 hits besides this thread: http://www.linuxquestions.org/questi...archid=5286173
 
1 members found this post helpful.
Old 05-09-2012, 02:23 PM   #4
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 216Reputation: 216Reputation: 216
network could be disabled simply by not starting it at startup (chkconfig network off <-- in RHEL distro and Suse) and if maybe user would start it, then a "misconfigured" eth config files with no gateway pointing out to the internet would do.
- linux net config
- linux networking

Last edited by lithos; 05-09-2012 at 02:28 PM.
 
1 members found this post helpful.
Old 05-09-2012, 03:43 PM   #5
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,380

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
Lithos' solution to network is a better option than IPtables, not sure why I didn't think of that first.
 
1 members found this post helpful.
Old 05-09-2012, 04:03 PM   #6
273
Senior Member
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid + various in VMs.
Posts: 1,807

Rep: Reputation: 315Reputation: 315Reputation: 315Reputation: 315
Could you not blacklist the network and USB drivers? In fact, can't you just compile the kernel without them?
Or just put glue in the network and USB ports?
 
1 members found this post helpful.
Old 05-09-2012, 09:22 PM   #7
chrism01
Guru
 
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 14,985

Rep: Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677
The system may need to talk to itself (127.0.0.1), so I'd just go into the relevant dir and set 'ONBOOT=no' in the ifcfg-ethX file(s).
Only root can restart network usually, but check that.
As for USB, prob best to create a kernel with no USB support.
Glue is going a bit far unless you will never(!) need either of those fns.
 
1 members found this post helpful.
Old 05-09-2012, 10:13 PM   #8
DrakeTungsten
LQ Newbie
 
Registered: May 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
I would want USB functionality as on option for myself, at least to get the PDF file onto the hard drive, so I don't want to compile a kernel without USB support. (It's been over ten years since I compiled a kernel, but my memory of the experience is that it would be a last resort rather than one of a few "why not try this..." options.)

I was not familiar with the concept of black-listing drivers, nor was I aware that GRUB could pass parameters to the OS to disable hardware. One or both of these will likely be the way I go.

The simplicity of purposely misconfiguring the eth config files originally appealed to me. Although lithos was talking about doing so in relation to the gateway, I don't want the PC to have LAN access, so I thought about misconfiguring to give the machine an IP address that is not on my LAN, and make sure the user can't switch to DHCP, but then I realized that somebody could configure another machine on the network to be on the same subnet as my locked-down machine. So purposeful ethernet misconfiguration seems to be out.

Thanks for the replies.

Last edited by DrakeTungsten; 05-09-2012 at 10:27 PM.
 
Old 05-10-2012, 05:09 AM   #9
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Ubuntu 10.10, Slackware 64-current
Posts: 2,046

Rep: Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747
Quote:
Originally Posted by DrakeTungsten View Post
I would want USB functionality as on option for myself, at least to get the PDF file onto the hard drive, so I don't want to compile a kernel without USB support.
The first thing I would suggest trying is look at the groups and see if you have something one like plugdev. There is a little bit of variation between distributions, and whether or not they still use HAL (Hardware Abstraction Layer), and what not, but there is likely a group that you can unassign from users other than yourself that will prohibit them from mounting USB devices.
 
Old 05-10-2012, 05:28 AM   #10
273
Senior Member
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid + various in VMs.
Posts: 1,807

Rep: Reputation: 315Reputation: 315Reputation: 315Reputation: 315
Quote:
Originally Posted by chrism01 View Post
Glue is going a bit far unless you will never(!) need either of those fns.
Yes, sorry, I was being silly.
 
Old 05-10-2012, 11:08 AM   #11
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,380

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
Glue is awesome... I would also like to see the usb/nic plugs hooked up to a car battery so if they do try to plug something in ZAP!
 
Old 05-10-2012, 12:56 PM   #12
cascade9
Senior Member
 
Registered: Mar 2011
Location: Brisneyland
Distribution: Debian, aptosid
Posts: 2,916

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Easiest way is to turn off USB and the network chip in the BIOS. (provided that you have a netowrk and USB support from the motherboard, if not just remove the USB and network controller cards).
 
Old 05-10-2012, 01:27 PM   #13
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,380

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
Quote:
Originally Posted by cascade9 View Post
Easiest way is to turn off USB and the network chip in the BIOS. (provided that you have a netowrk and USB support from the motherboard, if not just remove the USB and network controller cards).
Just don't forget the car battery...
 
Old 05-10-2012, 08:36 PM   #14
chrism01
Guru
 
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 14,985

Rep: Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677
Its irrelevant if someone adds another machine to the network; either this box has networking (over & above 127.0.0.1) or it doesn't.
If it doesn't (as you seem to want), then what's the problem?
I guess if you are paranoid & you have a DHCP server on the LAN, simply reserve the wanted/unwanted IP addr to the MAC address, then no-one else can steal it.
You can even reserve it as a static ip, which the DHCP server can also do.
Example 20.2 http://www.linuxtopia.org/online_boo...ng-server.html

Setting the ifcfg-eth0 file to have an entry 'ONBOOT=no' isn't 'mis-configuring' it, its simply telling the OS not to start it at boot time.
As long as you ensure that eg 'service network restart' and related cmds are only avail to root, you are gold.

I think you are over-thinking this...

As for USB, you can probably just comment it out in /etc/modprobe.conf (or /etc/modprobe.d/*.conf).

BTW, which distro & version are you using; we can give much better advice tuned to a specific OS/ver.
 
Old 05-13-2012, 12:46 AM   #15
jschiwal
Moderator
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 652Reputation: 652Reputation: 652Reputation: 652Reputation: 652Reputation: 652
You can disable mounting of removable drives from the desktop using polkit rules. This assumes that the users don't have root access.
Mounting external drives manually would require root unless you configure particular devices in /etc/fstab with the "user" option.

Removing an internal cable to a usb port, or gluing shut the port, would also disable USB mice and keyboards.

Last edited by jschiwal; 05-13-2012 at 01:53 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How 2 Disable USB Pendrive access only in Fedora14 Sreekanth.Nv Linux - Newbie 4 07-23-2011 05:13 AM
Network user cannot access usb drive Neruocomp Linux - General 1 02-15-2011 03:49 PM
how to disable for a user, the access to usb pen abd_bela Debian 1 05-15-2010 02:17 PM
Disable write access on USB ports mario.almeida Linux - Security 4 10-16-2009 01:32 AM
I lose ftp access when I disable shell access for user captainObvious Linux - General 3 11-13-2004 05:49 PM


All times are GMT -5. The time now is 02:36 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration