Cách đảm bảo an ninh cho hệ thống Linux của bạn - Phần 3

Thứ hai - 10/01/2011 21:44

Xóa tệp một cáchan ninh và duyệt nặc danh

Howyour secure your Linux system

Ngườigiám hộ: Linux không làm cho máy tính của bạn tự độngkhông thể thâm nhập được

Tutorial:Linux doesn't make your system impenetrable automatically

By Mayank Sharma

Theo:http://www.techradar.com/news/software/operating-systems/how-your-secure-your-linux-system-915651?artc_pg=3

Bàiđược đưa lên Internet ngày: 04/01/2010

Lờingười dịch: Bài này dạy cách xóa tệp để không đểlại dấu vết gì và cách sử dụng các proxy để hoạtđộng trên Internet như một người nặc danh, đảm bảoan ninh cho máy tính của bạn khi sử dụng với GNU/Linux.

Bạn nghĩ việc địnhdạng lại đĩa là đủ ư? Hãy nghĩ lại đi

Việc loại bỏ mộttệp từ đĩa dường như giống một hoạt đồng bìnhthường: chỉnh nháy phải vào tệp đó và gửi nó tớisọt rác. Những người dùng dòng lệnh có thể sử dụnglệnh rm để làm việc y hệt.

Tiếc thay, không cóphương pháp nào thực sự xóa được một tệp hoặc mộtthư mục. Chúng chỉ thôi miên hệ thống tệp để quênđi nơi một tệp nằm trên đĩa. Những vị trí tự do mớicủa đĩa sau đó sẽ được bổ sung tới kho của hệthống tệp địa chỉ tự do, và có thể trỏ tới cáctệp mới.

Điều đó làm việcđược trên lý thuyết, nhưng trong thực tế thì kíchthước kinh dị đó của các phân vùng có nghĩa là nhữngvị trí đĩa mà giữ tệp bị xóa đó có thể thực sựche giấu chúng đủ lâu cho các công cụ phục hồi dựngchúng dậy được.

Thinkformatting a disk is enough? Think again

Removinga file f-rom the disk seems like a simple operation: just right-clickon the file and send it to the trash. Command line users may use therm command do do the same thing.

Unfortunately,none of these methods actually de-letes a file or a folder. They justhypnotise the filesystem to forget whe-re a file is located in thedisk. These newly liberated disk locations are then added to thefilesystem's pool of free address, and can point to new files.

Thatworks in theory, but in practice the humongous size of partitionsmeans that the disk locations that hold the de-leted file may actuallyharbour them long enough for recovery tools to reconstruct them.

SRM

Đó là nới mà cácmảnh vụn tới. Các mảnh vụn ghi đè một không gian tệptrên đĩa để chắc chắn không gian đó chỉ có chứarác. Bạn cũng có thể muốn sử dụng - lựa chọn loạibỏ để chắc chắn nó xóa tệp gốc rồi.

Việc chẻ vụn mộttệp có thể là một công việc lâu la, khi nó ghi đè vịtrí đó 25 lần. Bạn có thể điều khiển số lượng lầnghi lại với n lần, như thế này:

That'swhe-re shred comes in. Shred overwrites a file's space on the disk tomake sure the space containsonly garbage. You might also want to use the --remove option to makesure it de-letes the original file as well.

Shreddinga file can be a lengthy affair, as it overwrites the location 25times. You can manipulate the number of rewrites with the -n switch,like this:

$ shred --remove -n 5 -vtop-secret.txt
shred: top-secret.txt: pass 1/5 (random)...
shred: top-secret.txt: pass 2/5 (ffffff)...
shred:top-secret.txt: pass 3/5 (random)...
shred: top-secret.txt: pass4/5 (000000)...
shred: top-secret.txt: pass 5/5 (random)...
shred: top-secret.txt: removing
shred: top-secret.txt:renamed to 0000
shred: 0000: renamed to 000
shred: 000:renamed to 00
shred: 00: renamed to 0
shred: top-secret.txt:removed

Mảnh vụn làm việctốt trên các thiết bị như /dev/sdb, mà chúng phủđịnh việc sử dụng của - loại bỏ chuyển mạch, vìbạn sẽ không muốn loại bỏ thiết bị. Có một cáihang ở đây. Mảnh vụn giả thiết là hệ thống tệp ghiđè tệp đúng vị trí. Điều này có thể trả nó vềtrừ phi trong các hệ thống tệp hiện đại được ghilại như là ext3.

Mảnh vụn cũng khôngxóa được các dấu vết của các dữ liệu đang bị xóatrong một vài chỗ, như trong các tệp hoán đổi, trongRAM, và trong nhật ký của hệ thống tệp. Một chiếnlược xóa có an ninh và hiệu quả đòi hỏi các công cụxóa có an ninh.

Shredworks well on devices like /dev/sdb, which negates the use of the--remove switch, because you wouldn't want to remove the device.There's a caveat here. Shred assumes the filesystem rewrites the filein place. This would render it useless on modern journalledfilesystems such as ext3.

Shredalso fails to wipe traces of the data being de-leted in severalplaces, such as the swap, RAM, and the filesystem journal. Aneffective and secure deletion strategy requires the secure de-letetools.

Xóa có an ninh

Các công cụ xóa cóan ninh bao gồm srm để loại bỏ các tệp một cáchan ninh, smemsswap để xóa sạch các dấuvết của dữ liệu khỏi bộ nhớ vật lý và chuyển đổiSWAP, và sfill để đảm bảo không gian trống trênđĩa không trỏ tới các tệp cũ đã bị xóa. Các công cụnày sử dụng một thuật toán mật mã được thiết kếđặc biệt để chắc chắn các tệp được xóa là khôngthể phục hồi lại được.

Một khi nó đượccài đặt, hãy chắc chắn bạn loại bỏ tệp hoặc mộtthư mục với:

$ srm -v../the-hole/eicar.com.txt

Sử dụng /dev/urandomcho đầu vào ngẫu nhiên.

Chế độ xóa an ninh (38lần đặc biệt)
Xóa ../the-hole/eicar.com.txt*********************************** *** Removed

tệp../the-hole/eicar.com.txt ... Done.

Secure-de-lete

Thesecure-de-lete tools include srm to securely remove the files, smemand sswap to wipe traces of data f-rom the physical and SWAP memory,and sfill to ensure the free space on the disk doesn't point to oldde-leted files. The tools make use of cryptographic algorithmsespecially designed to make sure de-leted files are unrecoverable.

Onceit's installed, make sure you remove the file or a directory with:

$srm -v ../the-hole/eicar.com.txt
Using /dev/urandom for randominput.
Wipe mode is secure (38 special passes)
Wiping../the-hole/eicar.com.txt *********************************** ***Removed file ../the-hole/eicar.com.txt ... Done

Bổ sung -r đểxóa một cách đệ qui một thư mục. Khi bạn làm xong,phải chắc chắn bạn quét sạch các dấu vết khỏi RAMcủa bạn với smem, mà nó có thể lấy một số lượngthời gian đáng kể phụ thuộc vào kích thước của bộnhớ vật lý mà nó phải quét sạch. Bạn có thể tăngtốc quá trình này với -l, mà nó giảm thiểu sốlượng các bước ghi lại (điều này là ít an ninh hơn).

Thực hiện xong quitrình bằng việc vô hiệu hóa hoán đổi với swapoff, việc quét nó sẽ xóa với sswap, và sau đó kích hoạt lại nó bằngswapon . Lệnh sfill sẽ trởnên thuận tiện khi bạn đang dọn một đĩa. Hãy sử dụngnó từ một đĩa Live CD trên một phân vùng không mount đểquét sạch không gian trống.

Addthe -r switch to recursively de-lete a directory. When you're done,make sure you wipe off residual traces f-rom your RAM with smem, whichmay take a considerable amount of time depending on the size of thephysical memory it has to wipe. You can speed up the process with the-l switch, which reduces the number of rewrite passes (this is lesssecure).

Topoff the process by disabling swap with swapoff ,wiping it clean with sswap , and thenre-enabling it with swapon . The sfill commandcomes in handy when you are discarding a disk. Use it f-rom a live CDon an unmounted partition to wipe the free space.

Loại bỏ rác

Chúng có thể khôngtệ như hệ điều hành khác, nhưng tất cả các phát tánLinux có xu hướng tích cóp nhiều rác qua một khoảng thờigian. Nhưng sao lại nói Linux chứ?

Các tệp rác là disản của trạng thái dư thừa các ứng dụng mà bạn cóchạy trên đỉnh của nhân của bạn. Bạn có thể gimthói quen của chúng đối với việc thu thập những thứra khỏi đường mà các ứng dụng được thiết lập đểtrao cho bạn một kinh nghiệm tốt hơn của người sửdụng. Và không chỉ làm tất cả các tệp nhật ký, cáctệp Internet tạm thời và một loạt các bộ nhớ đệmcho các ứng dụng tích tụ lại để chiếm một số lượngđáng kể không gian đĩa, chúng đặt ra một mối đe dọalớn cho tính riêng tư của bạn.

Thay vì đi tiếp quahệ thống tệp và làm rỗng một loạt các thư mục tạmtmp/ , hãy sử dụng BleachBit. Đây là một cửacho việc loại bỏ tất cả những tạp nhạp mà các ứngdụng đã giữ lại.

Removejunk

Theymight not be as bad as the other operating system, but all Linuxdistros tend to accumulate a lot of crud over a period of time. Butwhy blame Linux?

Thejunk files are the legacy of the plethora of apps you have running ontop of your kernel. You can pin their habit of collecting fluff to ofthe way the applications are configured to give you a better userexperience. And not only do all those log files, the temporaryinternet files and the various app caches accumulate to take up aconsiderable amount of disk space, they pose a great threat to yourprivacy.

Insteadof trolling through the filesystem and emptying the various tmp/directories, use BleachBit. It's a one-stop shop for removing all thecrud that the apps have preserved.

Bleachbit

BleachBit có một tậphợp khoảng 70 trình dọn sách được xác định trước,mỗi thứ trong đó làm việc trên một ứng dụng cụ thểnhư Firefox, Google Chrome, Adobe Reader, OpenOffice.org và hơnnữa. Những trình dọn sạch này được bật sang xóa sạchđể xóa hết các ứng dụng và trao lại cho chúng mộthiệu năng tốt hơn.

BleachBit nhẹ cân nhấtlà sẵn sàng trong các kho của tất cả các phát tán, dùbạn có thể muốn chộp lấy thư được xây dựng mớinhất từ website của nó. Dự án này cũng tung ra bộ cáctrình dọn sạch phần thưởng cho những phiên bản cũhơn.

Giao diện người sửdụng GUI của BleachBit được chia thành 2 khung. Một bêntay trái bạn chọn các ứng dụng mà bạn muốn xóa; cáinày mở rộng để trao cho bạn nhiều sự lựa chọn hơnđặc biệt đối với ứng dụng đó. Khung bên tay phải,bạn có một giải thích ngắn gọn đối với mỗi lựachọn được đánh dấu này.

BleachBithas a set of about 70 pre-defined cleaners, each of which works on aparticular app such as Firefox, Google Chrome, Adobe Reader,OpenOffice.org and more. The cleaners are tuned to wipe the deadweight off the applications and give them a performance boost.

Thelightweight BleachBit is available in the repositories of all majordistributions, though you might want to grab the latest build f-romits website. The project also releases bonus cleaner packs for olderversions.

TheBleachBit GUI is divided into two frames. On the left-hand side youse-lect the apps that you wish to clean; this expands to give you moreoptions specific to that app. In the right-hand frame, you get abrief explanation of each of these checkable options.

Làmsạch

Đểlàm sạch một vùng, như là bộ nhớ đệm của Firefox,chỉ đơn giản nháy vào ô chọn cạnh nó. Một số hoạtđộng làm sạch đòi hỏi bạn phải giăng lưới qua mộtvị trí rộng lớn và liên quan tới hơn một hành độngxóa đơn giản. BleachBit sẽ làm ấm bạn khi chọn mộttác vụ như vậy mà có thể mất thời gian đáng kể, vídụ, quét sạch bộ nhớ hoán đổi.

Trướckhi bạn yêu cầu BleachBit vứt đi những tệp vô dụngtrong các ứng dụng mà bạn đã chọn, hãy sử dụng númPreview - xem trước để rà soát lại danh sách các tệp nósẽ xóa. Nếu bạn thấy một tệp mà bạn không muốnxóa, như là bộ nhớ đệm của một người sử dụngFirefox nào đó, thì bạn có thể bổ sung nó vào một danhsách trắng.

Đâylà một danh sách các tệp mà BleachBit sẽ không độngtới, thậm chí nếu trình xóa rộng hơn mà chúng đã đượcđánh dấu để xóa. Bạn có thể chỉ định bất kỳ cáctệp hoặc thư mục nào để bỏ qua tab Whitelisttheo Edit> Preferences.

BleachBitcũng có một giao diện dòng lệnh. Ví dụ, lệnh sau đâysẽ xóa các cookies trong Firefox và Google Chrome:

$bleachbit --de-lete firefox.cookies google_chrome.cookies

Hãysử dụng - preview để có một danh sách các tệp trướckhi loại bỏ. Giao diện dòng lệnh CLI làm cho BleachBit cóthể viết script được để chạy hàng ngày một cách tựđộng.

Getcleaning

Toclean an area, such as Firefox's cache, simply click on the checkboxnext to it. Some cleanup operations require you to trawl through alarge location and involve more than a simple de-lete operation.BleachBit will warn you when se-lecting such a task that might take upa considerable amount of time, for example, wiping the swap memory.

Beforeyou ask BleachBit to zap the useless files in the apps you'vese-lected, use the Preview button to review the list of files it'llde-lete. If you encounter a file that you don't want to de-lete, suchas the cache of a particular Firefox user, you can add it to awhitelist.

Thisis a list of files that BleachBit will not touch, even if the broadercleaner that they come under has marked them for removal. You canspecify any files or folders to bypass under the Whitelist tab underEdit > Preferences.

BleachBitalso has a command line interface. For example, the following commandcleans cookies under Firefox and Google Chrome:

$bleachbit --de-lete firefox.cookies google_chrome.cookies

Usethe --preview switch to get a list of files before removal. The CLImakes BleachBit scriptable for automated daily runs.

Để bổ sung mộtcông việc cron để xóa các tệt được tạo ra thườngxuyên, như các nhật ký được xoay vòng và các cookieshàng ngày lúc 2.00 sáng, hãy soạn thảo crontab với crontab-e và bổ sung dòng sau:

0 2 * * * bleachbit--de-lete firefox.cookies google_chrome. cookies system.rotated_logs

Nếu hàng ngày mà làquá thường xuyên, thì bạn nên ít nhất chạy ứng dụngtrước khi tạo các bản sao. Bạn cũng có thể sử dụngBleachBit để tăng tốc những ứng dụng nhất định nàođó, làm sạch phát tán bàng việc sửa các phím tắt bịhỏng, xóa các gói ngôn ngữ và làm rỗng RAM vật lý vàbộ nhớ hoán đổi.

Toadd a cron job to nuke regularly cre-ated files, such as rotated logsand cookies daily at 2.00 am, edit the crontab with crontab -e andadd the following line:

02 * * * bleachbit --de-lete firefox.cookies google_chrome. cookiessystem.rotated_logs

Ifdaily sounds too frequent, you should at least run the app beforecreating backups. You can also use BleachBit to speed up certainapps, house clean the distro by fixing broken shortcuts, de-letelanguage packs and empty physical RAM and swap memory.

Browseanonymously

Duyệt một cách ẩndanh

Kéo một Keyser Sozelên Internet - làm cho nó nghĩ bạn không tồn tại...

Trên Internet, đôi khidạng tốt nhất về tính riêng tư là vô danh. Khó cho mộtkẻ tấn công với tới bạn nếu chúng không vồ đượcbạn trên mạng. Và không ai dấu các dấu vết của bạntốt hơn là sự kết hợp của Privoxy và Tor.

Tor bảo vệ sự riêngtư thông qua một mạng phân tán của rơ le chạy bởinhững người tự nguyện lan truyền khắp thế giới. Điềunày giúp ngăn ngừa bất kỳ ai giám sát các kết nốiInternet của bạn khỏi việc biết bạn viếng thăm sitenào. Tor làm việc với các trình duyệt web, các chươngtrình thông điệp tức thì (chat) và nhiều ứng dụng dựatrên TCP khác. Nhưng một loạt các giao thức ứng dụng vàcác chương trình có liên quan có thể bị đánh lừa vàotrong việc phát lộ thông tin về người sử dụng, mà lànơi mà Privoxy tới. Tor phụ thuộc vào Privoxy và các khảnăng lọc của nó để cải thiện tính riêng tư.

Pulla Keyser Soze on the internet – make it think you don't exist…

Onthe internet, sometimes the best form of privacy is being anonymous.It's difficult for an attacker to get to you if they can't pinpointyou on the network. And no one covers your tracks better than thecombination of Privoxy and Tor.

Torprotects privacy via a distributed network of relays run byvolunteers spread across the world. This helps prevent anybodymonitoring your internet connections f-rom learning what sites youvisit.

Torworks with web browsers, instant messaging programs and many otherTCP-based apps. But the various app protocols and associated programscan be coaxed into revealing information about the user, which iswhe-re Privoxy comes into the picture. Tor depends on Privoxy and itsfiltering capabilities to enhance privacy.

Privoxy

Bắt đầu bằng việckéo Privoxy từ các kho của phát tán của bạn, rỗi vàocác thiết lập tiên tiến của trình duyệt của bạn nơimà bạn có thể thay đổi các thiết lập proxy của nó. Ởđây chỉ điền trong 127.0.0.1 cho proxy của HTTP, và chỉđịnh cổng 8118. Đó là tất cả những điều phải làm.

Khi bạn làm xong, hãybắt đầu Privoxy với /etc/ init.d/privoxy start. Bạnbây giờ có thể truy cập giao diện Privoxy từhttp://config.privoxy.org or http://p.p.

Để móc Privoxy vớiTor, bạn trước hết cần thiết lập kho các gói củaTor. Điều này là dễ dàng thực hiện bằng việc bổsung dòng sau đây vào cài đặt Ubuntu hoặc Debian của bạn:

debhttp://deb.torproject.org/torproject.org main

Thay thế bằng tên phát tán của bạn, như Karrmic, hoặc sid.Rồi bổ sung khóa GPG được sử dụng để ký các góibằng việc chạy thứ sau:

gpg --keyserverkeys.gnupg.net --recv 886DDD89 gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -

Beginby pulling Privoxy f-rom your distro repositories, then head into yourbrowser's advanced settings whe-re you can change its proxy settings.Here just fill in 127.0.0.1 for the HTTP proxy, and specify 8118 asthe port. That's all there's to it.

Whenyou're done, start the Privoxy daemon with /etc/ init.d/privoxystart. You can now access Privoxy's interface f-romhttp://config.privoxy.org or http://p.p.

Tohook up Privoxy with Tor, you first need to set up Tor's packagerepository. This is easily done by adding the following line to yourUbuntu or Debian installation:

debhttp://deb.torproject.org/torproject.org main

Replace with the name for your distro, like karmic, orsid. Then add the GPG key used to sign the packages by running thefollowing:

gpg--keyserver keys.gnupg.net --recv 886DDD89 gpg --exportA3C4F0F979CAA22CDBA8 F512EE8CBC9E886DDD89 | sudo apt-key add -

Ifyou use Yum, cre-ate a torproject.repo under /etc/ yum/repos.d withthe following content:

Nếu bạn sử dụng Yum,hãy tạo một torproject.repo trong /etc/ yum/repos.d vớinội dung sau:

[torproject]
name=Torand Vidalia
enabled=1
autorefresh=0
baseurl=http://deb.torproject.org/torproject.org/rpm/
DISTRIBUTION/
type=rpm-md gpgcheck=1
gpgkey=http://deb.torproject.org/torproject.org/rpm/RPMGPG-KEY-torproject.org

Một lần nữa thaythế PHÁT-TÁN bằng tên của phiên bản của Fedora hoặcCentOS, như là centos5 hoặc fc13. Bây giờ đặtTor thông qua trình quản lý gói, mà nó cũng sẽ kéo trongcác gói bổ sung như trình kiểm soát giao diện người sửdụng Vidalia Tor.

Phải chắc chắn bạnkhông cài đặt ứng dụng Polipo web proxy, vì chúng ta đangsử dụng Privoxy và 2 thứ này có thể xung đột vì chúnghoạt động trên cùng một cổng.

Bước cuối cùng làđể Privoxy và Tor nói chuyện với nhau. Để làm thế chỉcần sửa tệp thiết lập của Privoxy trong /etc/privoxyvà bỏ bình luận cho dòng sau:

# forward-socks4a /127.0.0.1:9050

Also uncomment the followinglines to make sure the local network is still reachable:

# forward 192.168.*.*/ .
#forward 10.*.*.*/ .
# forward 127.*.*.*/

Tuyệt vời! Bây giờtất cả giao thông Internet của chúng ta mà đi qua cácproxy Tor và Privoxy được đánh mặt nạ.

Againreplace DISTRIBUTION with the name of your Fedora or CentOS release,such as centos5 or fc13. Now fetch Tor via the package manager, whichwill also pull in additional packages like the Vidalia Tor GUIcontroller.

Makesure you don't install the Polipo web proxy app, since we are usingPrivoxy and the two might conflict because they operate on the sameport.

Thelast step is to get Privoxy and Tor to talk to each other. For thisjust edit the Privoxy config file under /etc/privoxy and uncommentthe following line:

#forward-socks4a / 127.0.0.1:9050

Alsouncomment the following lines to make sure the local network is stillreachable:

#forward 192.168.*.*/ .
# forward 10.*.*.*/ .
# forward127.*.*.*/

Presto!Now all our internet traffic that passes through the Tor and Privoxyproxies is masked.

Dịch tài liệu: LêTrung Nghĩa

letrungnghia.foss@gmail.com


Tổng số điểm của bài viết là: 0 trong 0 đánh giá

Click để đánh giá bài viết

  Ý kiến bạn đọc

Những tin mới hơn

Những tin cũ hơn

Về Blog này

Blog này được chuyển đổi từ http://blog.yahoo.com/letrungnghia trên Yahoo Blog sang sử dụng NukeViet sau khi Yahoo Blog đóng cửa tại Việt Nam ngày 17/01/2013.Kể từ ngày 07/02/2013, thông tin trên Blog được cập nhật tiếp tục trở lại với sự hỗ trợ kỹ thuật và đặt chỗ hosting của nhóm phát triển...

Bài đọc nhiều nhất trong năm
Thăm dò ý kiến

Bạn quan tâm gì nhất ở mã nguồn mở?

Thống kê truy cập
  • Đang truy cập101
  • Máy chủ tìm kiếm8
  • Khách viếng thăm93
  • Hôm nay10,910
  • Tháng hiện tại30,234
  • Tổng lượt truy cập32,259,619
Bạn đã không sử dụng Site, Bấm vào đây để duy trì trạng thái đăng nhập. Thời gian chờ: 60 giây