#Linux - Basic Security
##Restricting Remote IP Addresses
It is always a good idea to restrict the access to users and hosts that you trust. To do this you need to:
Edit the /etc/hosts.deny and create a rule
sshd: ALL
data:text/html, | |
<style type="text/css"> | |
#e { | |
position:absolute; | |
top:0; | |
right:0; | |
bottom:0; | |
left:0; | |
font-size:16px; | |
} |
# coding=UTF-8 | |
from __future__ import division | |
import re | |
# This is a naive text summarization algorithm | |
# Created by Shlomi Babluki | |
# April, 2013 | |
class SummaryTool(object): |
# coding=UTF-8 | |
import nltk | |
from nltk.corpus import brown | |
# This is a fast and simple noun phrase extractor (based on NLTK) | |
# Feel free to use it, just keep a link back to this post | |
# http://thetokenizer.com/2013/05/09/efficient-way-to-extract-the-main-topics-of-a-sentence/ | |
# Create by Shlomi Babluki | |
# May, 2013 |
#Linux - Basic Security
##Restricting Remote IP Addresses
It is always a good idea to restrict the access to users and hosts that you trust. To do this you need to:
Edit the /etc/hosts.deny and create a rule
sshd: ALL
是 | [shì] to be, 是不是? shìbushì? is (it) or is (it) not?; 是否 shìfǒu whether or not, is (it) or is (it) not? | |
不 | [bù] not [bú] (used before tone #4); 不是 bú shì isn't | |
了 | [le] <verb particle marking a new situation or a completed action>; 你来了! Nǐ láile! You have come!; 我累了! Wǒ lèile! I've gotten tired!; 那好了! Nà hǎole! That's OK (now)!; 我只请了一位客人. Wǒ zhǐ qǐngle yí wèi kèren. I invited only one guest. [liǎo] end, finish, settle, dispose of, know clearly, to be able, (=了解 liǎojiě) understand, comprehend; 了了 liǎoliaǒ clearly understand, settle (a debt/etc.), to be intelligent; 了了 liǎole to be over/ended/finnish/settled; 你卖不了! Nǐ mài bùliǎo! You will not be able to sell (it)! [liào] (=瞭 liaò) to survey/watch{Compare with 子 zǐ child} | |
人 | [rén] person; 人类 rénlèi humankind; 有人吗? yǒu rén ma? Is there anybody here?{Compare with 入 rù enter} | |
我 | [wǒ] I, me, my; 我们 wǒmen we, us{Compare with 找 zhǎo seek} | |
在 | [zài] at; 现在 xiànzài now; 存在 cúnzài exist | |
有 | [yǒu] have, there is; 没有 méiyǒu haven't, there isn't; |
#Node - Running in Production
This gist is based on the excellent post by @hacksparrow which is found at http://www.hacksparrow.com/running-express-js-in-production-mode.html. The main principle is that you want the application to detect that it is running on a production server and to use the production configuration. The way to do this is to set the NODE_ENV=production
. To do this you need to do the following:
$ export NODE_ENV=production
But we have a little problem here. The NODE_ENV environment variable will be lost if the server restarts, so it is safer to put it in the .bash_profile file. That way the variable will set again every time the system reboots. You will find the file in your home directory. It's a hidden file, so you can't see it unless you do a ls -la. We will append the export command to the .bash_profile file.
#Linux - Production Server Setup The principle of running a server in production is to run only what is needed. This keeps the server load to a minimum and reduces the security footprint.
See also http://plusbryan.com/my-first-5-minutes-on-a-server-or-essential-security-for-linux-servers
##Setup the Domain Name (DNS)
Point the dns address at the ip address of your server. If the server is rented you should already have a static ip address. If the machine is on your local network you may have to sudo nano /etc/network/interfaces
to edit the ip address file. Your setup should be like:
iface eth0 inet static
#Linux - Cron Basics
Cron is a linux scheduling service which is used primarly on servers. It works by waking up each minute and checking its configuration files (known as crontabs) to see if there is anything to run. Cron is normally started at boot time.
###Typical uses:
#DNS Basics Domain names are a core feature of the internet. It is simply a mechanism to give a friendly name to remove the need to use ip addresses directly. It also has a number of advantages, such as:
#Linux - Running a Node Service (PM2) PM2 is a replacement for Forever which is used to run Node services (see http://devo.ps/blog/2013/06/26/goodbye-node-forever-hello-pm2.html). It has a number of advantages over forever: