Disk Check

Badblock

블록은 OS 상의 파일 시스템에서 파일이 저장되는 단위를 의미한다. 각 파일 시스템에 따라 그 크기가 자동으로 결정되며, 수동으로 설정할 수 있다.

1
# dumpe2fs -h /dev/DEV_NAME
cs


위의 유틸을 통해 해당 디스크 디바이스의 블록을 확인할 수 있다.


이 블록에 문제가 생겨 파일 시스템에 파일을 읽고 쓰는 것이 정상적으로 동작하지 않는 경우, 배드블록 (badblock)으로 판단한다.

배드블록이 생성된 디스크를 계속 사용하게 되면, 운용중인 장비가 다운되는 등 치명적인 문제가 발생할 수 있으므로, 교체 해주는 것이 좋다.


중요 데이터의 경우, 하기의 복구 과정 이후에 백업을 필수로 시행하고, 디스크를 빠른 시일 내에 교체하는 것이 좋다.


1
# badblocks -v /dev/DEV_NAME
cs

badblocks 명령을 사용하여 해당 장치의 배드블록을 검사할 수 있다. -o 옵션을 추가하여 해당 블록의 번호를 출력할 수 있다.



File System recovery

리눅스 상에서 파일 시스템을 검사하거나 복구하는 유틸을 사용하여 디스크 상태를 확인할 수 있다.

1
# fsck [-t FILE_SYSTEM] /dev/DEV_NAME
cs


fsck 명령을 이용하여 해당 디스크의 상태를 체크할 수 있으며, 5개의 phase를 거치게 된다.


Phase1

Check blocks and sizes

Phase2

Check Pathnames

Phase3

Check connectivity

Phase4

Check reference counts

Phase5

Check cycle groups

검사 후 복구하기 위해서는 a(묻지 않고 복구) 또는 r(물어본 후 복구) 옵션을 사용하면 된다.

Lost+Found

리눅스 파일 시스템에서 자주 볼 수 있는 디렉토리로, 모든 파일 시스템은 자신의 루트 디렉토리에 이 디렉토리를 가져야 하며, newfs에 의해 생성된다. 존재하지 않을 경우, /etc/mklost+found 명령으로 생성할 수 있다.
fsck는 문제가 있는 파일을 이 디렉토리에 위치시킨다.


DELL OMSA (Open Manage) Badblock recovery

virtual disk bad block medium error

To display the controller ID

1
# omreport storage controller
cs


To display the Controller's Virtual Disk

1
# omreport storage vdisk controller=ID
cs


To clear the blocks

1
# omconfig storage vdisk action=clearvdbadblocks controller=C_ID vdisk=VD_ID
cs


'System Engineering > Linux' 카테고리의 다른 글

Tools: ab  (0) 2018.08.30
Find files and directory which is using disks very highly  (0) 2018.08.17
Apache: Security settings  (0) 2018.08.03
Apache: httpd set-up  (0) 2018.08.03
DNS on Linux: BIND  (0) 2018.07.27

Apache security

SSL/TLS

HTTP server and client can use security channel. SSL/TLS is the answer.
HTTP over SSL uses 443 port to establish connection.
Apache uses mod_ssl to using HTTPS.

With ISRG Internet Security Research Group, we can use free SSL certification.
(But it has to renew every 90 days)

The Link above is the guide to install SSL certification via certbot utility.


After installation, you can check the httpd configuration file.


1
2
3
4
5
6
7
8
9
RewriteEngine on
RewriteCond %{SERVER_NAME} =www1.hy.cdn-cpart.site
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,NE,R=permanent]
 
<IfModule mod_ssl.c>
NameVirtualHost *:443
</IfModule>
Include /etc/httpd/conf/httpd-le-ssl.conf
 
cs

Rewrite*

Redirect the http connection request to https connection

Include ...

httpd-le-ssl.conf is the virtual host configuration file that using https connection

In the ssl configuration file

1
2
3
SSLCertificateFile /etc/letsencrypt/live/www1.hy.cdn-cpart.site/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www1.hy.cdn-cpart.site/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/www1.hy.cdn-cpart.site/chain.pem
cs


You can check the SSL certification, private key, and CA's certification.



Security Configuration

- AllowOverride FileInfo: To control file upload

- Header set X-XXS-Protection "1; mode=block": To prevent XSS (Cross Site Scripting) attack

- Block remote root login

- Use normal user on User/Group account in apache

- Directory Indexes removal

- FollowSymLinks removal

- LimitReqeustBody: To limit the file upload size

- Stop the unused / weak services



CORS

Set Header set Access-Control-* on the apache


'System Engineering > Linux' 카테고리의 다른 글

Find files and directory which is using disks very highly  (0) 2018.08.17
Check and recover disk badblocks  (0) 2018.08.16
Apache: httpd set-up  (0) 2018.08.03
DNS on Linux: BIND  (0) 2018.07.27
DNS Query Tools: nslookup and dig  (0) 2018.07.27

Apache

Install

Install httpd via yum

1
yum install httpd
cs


Virtual Host

1
2
3
4
5
6
7
8
9
vi /etc/httpd/conf/httpd.conf
 
Listen 80
 
NameVirtualHost *:80
<VirtualHost *:80>
    ServerName www.DOMAIN
    DocumentRoot /var/www/html/DIR_DOC_ROOT
</VirtualHost>
cs


Listen on 80 port via http

NameVirtualHost

Set the virtual host with IP address and port.

<VirtualHost>

Take the server's info.
You can use multiple virtual hosts with IP address-based, domain-based, port-based method.


Before you start the httpd service, you have to check system's firewall policy which is 'iptables'


MIME-Type

1
2
3
vi /etc/httpd/conf/httpd.conf
 
TypesConfig /etc/mime.types
cs


You can set the MIME-Types on the file. Or, use AddType like this.


1
2
3
vi /etc/httpd/conf/httpd.conf
 
AddType application/x-tar .tgz
cs


And here is the DefaultType that is considered when MIME-type is not set.


1
DefaultType text/plain
cs



Content Compression

1
LoadModule deflate_module modules/mod_deflate.so
cs


To transfer compressed content, Apache uses mod_deflate module. It is default module after Apache 2.2.


1
2
3
4
5
6
7
8
9
10
11
12
vi /etc/httpd/conf/httpd.conf
 
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html
 
    DeflateCompressionLevel 9
 
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 
</IfModule>
cs


AddOutputFilterByType DEFLATE

Using deflate module to compress specific type

DeflateCompressionLevel

Set the level of compression. The value is in range(1 ~ 9) that higher number means high compression rate and need more CPU resources.

BrowserMatch

To take care of User-Agent which is the browser and it's bug.

- Mozilla/4 and 4.x has issue that it could not take the deflate filter.
- Microsoft Internet Explorer notify to server that Mozilla/4 itself.

1
Content-Encoding: gzip
cs

You can check the compressed content via header in the browser's development mode.

gzip

GNU zip file format which is Lempel-Ziv coding combination with 32bit CRC

deflate

zlib data format combination with deflate compression mechanism.



Cache-Control

Apache uses mod_expires module to control Expires and Cache-Control: max-age HTTP headers.

1
2
3
4
5
6
vi ./httpd.conf
 
<IfModule mod_expires.c>
        ExpiresActive On
        ExpiresByType text/html "access plus 1 minutes"
</IfModule>
cs



'System Engineering > Linux' 카테고리의 다른 글

Check and recover disk badblocks  (0) 2018.08.16
Apache: Security settings  (0) 2018.08.03
DNS on Linux: BIND  (0) 2018.07.27
DNS Query Tools: nslookup and dig  (0) 2018.07.27
SSH security settings  (0) 2018.07.27

BIND


bind: dns 서버 구축 프로그램


bind-utils: DNS
서버 질의를 위해 사용되는 유틸리티 제공


bind-libs: bind
bind-utils가 사용하는 라이브러리 패키지


bind-chroot: chroot
환경에서 bind 사용을 위한 파일 제공


Install bind

1
yum install bind*
cs




DNS는 기본적으로 UDP 53번 포트로 동작하며, DNS 헤더를 포함한 메시지 크기가 512바이트를 초과할 경우에 TCP 53번 포트로 변경하여 동작하도록 설

계되어 있다. 또한, 마스터와 슬레이브 네임 서버 간, 존 전송 시에도 많은 양의 데이터를 전송하기 때문에 TCP를 사용한다.

/var/named/named.ca 루트 네임 서버는 전 세계 13개로 운영되며, TCP로 동작하게 되어 부하를 발생하지 않게 하기 위함이다.

루트 네임서버 정보 갱신은 rs.internic.net/domain/named.root 파일을 다운받아 named.ca파일을 덮어 씌우면 된다.



bind settings

/etc/named.conf

1
2
3
4
5
zone "." IN {
        type hint;
        file "named.ca";
};
 
cs



chroot

보안 등의 이유로 가상의 새로운 루트 디렉토리를 지정하여 서비스를 사용하도록 하는 것. DNS 서비스의 경우, /var/named/chroot를 최상위 디렉토리로 인식하게 하여 사용한다.


OPTIONS section in named.conf

1
2
3
4
5
6
7
8
9
10
11
12
options {
//      listen-on port 53 { 127.0.0.1; };
        listen-on port 53 { any; };
//      listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
//      allow-query     { localhost; };
//      allow-transfer  { ; };  2nd NS's address
//      masters { ; }; master NS's address in 2nd NS
 
cs


외부 접근 설정, 2차 네임 서버 또는 마스터 네임 서버 지정 옵션 등 추가


/etc/resolve.conf - 리졸버 설정 파일

1
2
3
4
search sample-test.com
nameserver 119.
nameserver 168.
 
cs

자신의 도메인을 search 지시자에 명시하고, 네임서버로 사용할 자신의 IPnameserver 지시자에 명시한다.


/etc/host.conf - 호스트 설정 파일

1
2
3
multi on
order hosts, bind
 
cs

hosts 파일과 DNS 질의 순서 설정.
multi:
시스템 내의 hosts 파일에 복수의 IP 주소를 설정하는 옵션


/etc/named.rfc1912.zones - 각 존 파일 명시

1
2
3
4
5
6
zone "sample-test.com" IN {
        type master;
        file "sample-test.com.zone";
        allow-update { none; };
};
 
cs

-       /etc/named.rfc1912.zones 파일에 도메인 존 추가 및 존 파일 명시 (이 경우 named.conf 파일에 includenamed.rfc1912.zones 파일을 명시해야 한다. 아닐경우 /etc/named.conf에 작성)


/var/named/new_zone.zone - DNS 데이터베이스 존 파일

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$TTL 1D
@       IN SOA  ns.sample-test.com.     admin.sample-test.com. (
                                        20180727        ; serial
                                        1D              ; refresh
                                        1H              ; retry
                                        1W              ; expire
                                        1D )            ; minimum
        IN NS           ns.sample-test.com.
        IN A            119.x.x.x
ns      IN A            119.x.x.x
www     IN A            119.x.x.x
web     IN CNAME        www
;       IN NS           ns2.sample-test.com.
;ns2    IN A            IPv4_address_of_2nd_NS
cs

-       Zone 파일 상단에 TTL 기본 값을 명시해 준다.

-       @은 현재 zone을 의미하며, SOA에 권한을 가진 네임 서버를 명시하고, 관리자 메일을 적는다. @의 혼용을 막기 위해 ‘.’을 사용한다.

n  Serial: zone 파일 레코드의 갱신 정보. 보통 생성/수정된 날짜를 작성

n  Refresh: 서브 네임 서버가 마스터 네임 서버의 갱신 내용을 확인하기 위해 체크하는 시간

n  Retry: 서브 네임 서버가 마스터 네임 서버에 접속 시도 실패 시, 재시도할 시간

n  Expire: 서브 네임 서버가 가져온 마스터 네임서버의 정보의 만료 시간

n Minimum: TTL 값 설정 부분. 존 파일 상단 $TTL과 같음


Access control on zone file

1
2
3
[root@localhost ~]# ll /var/named/sample-test.com.zone
-rw-r--r-- 1 root named 340 Jul 27 14:33 /var/named/sample-test.com.zone
 
cs

-       named 데몬에서 접근 가능하도록 존 파일의 소유권을 변경해 준다.

-       named-checkconf: named.conf 파일 유효성 검사 유틸
named-checkzone: zone
파일 유효성 검사 유틸


Restart the named

1
2
3
4
[root@localhost ~]# service named restart
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]
 
cs



1
2
3
4
5
[root@localhost ~]# ss -ant
State      Recv-Q Send-Q        Local Address:Port          Peer Address:Port
LISTEN     0      3            119.x.x.x:53                       *:*
LISTEN     0      3                 127.0.0.1:53                       *:*
 
cs


Test with dig or nslookup


'System Engineering > Linux' 카테고리의 다른 글

Apache: Security settings  (0) 2018.08.03
Apache: httpd set-up  (0) 2018.08.03
DNS Query Tools: nslookup and dig  (0) 2018.07.27
SSH security settings  (0) 2018.07.27
HTTP Header Sample Analysis - www.daum.net  (0) 2018.07.24

DNS Query Tools

nslookup

n  nslookup [DOMAIN]: 해당 도메인의 IP 주소 출력

n  nslookup [IP]: 해당 IP의 도메인 출력 (Reverse DNS lookup)

n  nslookup -type=[RECORD_TYPE] [DOMAIN]: 해당 레코드 타입 쿼리 수행

n  set [OPTIONS]를 통해 옵션 값 설정

n  set all: 적용된 옵션 값 출력



dig

n  dig @NS DOMAIN [QUERY_TYPE] [QUERY_CLASS]: 해당 네임 서버로 도메인과 관련된 옵션 지정 후 질의


-b

Source IP를 다른 IP로 지정

-f

Batch 동작 시 파일 이름 지정

-m

Debugging

-4/-6

IP 버전 강제 지정

-t

레코드 타입

-c

클래스

-x

Reverse lookup

+trace

루트 네임서버부터 경로 추적

+short/comments/question/
authority/additional/stats

section만 출력

+all

모든 section 출력

+multiline

긴 레코드 라인 형식으로 출력

 


'System Engineering > Linux' 카테고리의 다른 글

Apache: httpd set-up  (0) 2018.08.03
DNS on Linux: BIND  (0) 2018.07.27
SSH security settings  (0) 2018.07.27
HTTP Header Sample Analysis - www.daum.net  (0) 2018.07.24
FTP server set up  (0) 2018.06.16

SSH security settings

Add wheel group user

1
2
[root@localhost ~]# useradd -G wheel user_name
 
cs

Or you can edit /etc/group directly


wheel 그룹에 속한 사용자를 만들거나 그룹에 추가


Edit /etc/pam.d/su

1
2
3
4
5
6
7
8
9
10
11
12
13
#%PAM-1.0
auth            sufficient      pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth           sufficient      pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
auth            required        pam_wheel.so use_uid
auth            include         system-auth
account         sufficient      pam_succeed_if.so uid = 0 use_uid quiet
account         include         system-auth
password        include         system-auth
session         include         system-auth
session         optional        pam_xauth.so
 
cs

pam_wheel.so use_uid 부분을 추가


Change group of su command and edit acl

1
2
3
4
5
[root@localhost ~]# which su
/bin/su
[root@localhost ~]# ll /bin/su
-rwsr-x---1 root wheel 34904 Nov 23  2013 /bin/su
 
cs

wheel 그룹으로 제한할 명령어의 접근 권한을 변경

4750 - 750 means rwx r-x --- and 4 means set UID

setUID 설정으로 root 계정 외에는 해당 파일을 변경할 수 없게 설정

Set sshd to do not permit root access

Edit /etc/ssh/sshd_config

1
2
42 PermitRootLogin no
 
cs

ssh로 root 접근이 불가하도록 ssh 데몬 설정 파일 수정


* You can do this sequence at sudo command

'System Engineering > Linux' 카테고리의 다른 글

DNS on Linux: BIND  (0) 2018.07.27
DNS Query Tools: nslookup and dig  (0) 2018.07.27
HTTP Header Sample Analysis - www.daum.net  (0) 2018.07.24
FTP server set up  (0) 2018.06.16
Linux: swap  (0) 2018.06.11

www.daum.net Chrome 샘플




-       GET 메소드를 이용하여 https://www.daum.net/ URL을 입력하여 정상적으로 동작을 완료하고 200 응답 코드를 받음.

-       해당 호스트의 IP203.133.167.16이고 https 프로토콜 포트인 443번 포트로 연결됨

-       Referrer는 해당 리소스를 요청할 때, 참조되는 URL을 의미하며, 어디서부터 요청 연쇄가 시작되었는지 확인할 수 있다.

-       현재 referrer 정책은 no-referrer-when-downgrade, user-agent인 브라우저에게 해당 정책이 없다고 알리는 기본 값이다. 프로토콜의 보안 레벨이 동일할 때, 해당 URLreferrer로서 보내진다.


-       클라이언트가 받길 원하는 MIME type과 선호도(가중치)를 나열하여 서버 측에서 리소스를 원활하게 응답할 수 있도록 Accept 헤더에 명시한다.

-       전송받을 수 있는 인코딩 알고리즘은 3가지이며, 언어 또한 가중치로 선호도를 표시할 수 있다.

-       가중치는 선호도를 의미하므로 절대적인 값은 아니다.

-       데이터 송수신을 위한 커넥션을 유지한다.

-       서버에서 클라이언트 식별을 위해 쿠키 값들을 전송한다.

-       서버의 도메인 네임과 포트는 www.daum.net이고, 명시되지 않은 포트는 URL의 프로토콜 포트 기본 값을 사용한다.

-       요청하는 서버가 향상된 버전의 사이트로 리디렉트 가능하도록 설정한다. HTTP 요청을 HTTPS로 리디렉션

-       User-agent 헤더에서 클라이언트의 브라우저 정보를 표시한다.


-       해당 리소스의 캐시된 사본을 클라이언트로 보내기 전에 오리진 서버에 검사 요청을 보내야 하고, 요청이나 응답 메시지를 저장하지 않는다.

-       서버 측에서 커넥션을 닫았다.

-       본문 컨텐츠 전송 시 사용된 인코딩 알고리즘은 gzip이며 컨텐츠는 ko-KR 언어를 사용한다. 컨텐츠의 길이는 49874 bytes, MIME type html 문서, charsetUTF-8 인코딩을 사용한다.

-       응답 메시지는 Date 헤더에 표시된 날짜에 생성되었고, Expires에 명시된 일시에 만료되어, 재검사가 필요해진다.

-       p3p (Platform for Privacy Preferences): W3C에서 개발한 프라이버시 보호 관련 표준 기술. P3p를 적용한 사이트에서는 http 헤더 또는 xml 파일을 통해 해당 사이트에서 취급하는 개인정보 레벨, 성격 등을 브라우저에 알린다.

-       CP는 적용할 압축 정책을 의미하며, p3p 정책이 3글자로 압축되어 나열되어 있고, p3p 공식 페이지에서 확인 가능하다. 규정으로 강제하고 있는 항목은 아니다. 또한 페이지 내에 HTML 태그로 설정 가능하다.

-       Pragmahttp/1.0 일반 헤더로, cache-control과 기능이 같다. http/1.0 클라이언트를 위해 헤더에 포함되었다.

-       Vary는 서버의 응답 메시지에 영향을 줄 수 있는 클라이언트의 요청 메시지 내의 헤더를 의미한다. 다음 요청 시 클라이언트는 Accept-encoding (클라이언트가 받을 수 있는 인코딩) 값을 포함시킨다.

-       익스플로러 호환성 보기는 10을 기준으로 최신 표준 모드로 렌더링.

-       X-ua-device-type: 클라이언트 장비는 pc를 사용한다.


'System Engineering > Linux' 카테고리의 다른 글

DNS Query Tools: nslookup and dig  (0) 2018.07.27
SSH security settings  (0) 2018.07.27
FTP server set up  (0) 2018.06.16
Linux: swap  (0) 2018.06.11
리눅스 Core dump  (0) 2018.05.24

Set up the FTP server for file backup on CentOS 7


1. Install vsftpd on the server


1
yum install -y vsftpd

cs


2. Edit the configuration of vsftpd


1
vi /etc/vsftpd/vsftpd.conf
cs


 Here is my config file >>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
# When SELinux is enforcing check for SE bool ftp_home_dir
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
# When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
xferlog_file=/var/log/xferlog
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
chroot_local_user=YES
allow_writeable_chroot=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
# Make sure, that one of the listen options is commented !!
listen_ipv6=NO
 
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
 
idle_session_timeout=600
use_localtime=YES
force_dot_files=YES
max_clients=2
max_per_ip=2
 
cs


3. open the port on firewalld


1
2
3
firewall-cmd --permanent --add-service=ftp
firewall-cmd --permanent --add-port=21/tcp
firewall-cmd --reload
cs


 If you want to check the port is accurately opened >>

1
firewall-cmd --list-port

cs


4. Create user for ftp client and set to nologin


1
2
3
4
5
useradd ftp_user
passwd ftp_user
 
usermod -/sbin/nologin ftp1
chmod +rw -/home/ftp_user

cs


and create the chroot_list file for ftp user login list, write the ftp user name on it

1
vi /etc/vsftpd/chroot_list
cs


5. Done. Start/restart the vsftpd daemon and connect via FTP client like 'Filezilla'


1
systemctl restart vsftpd
cs


'System Engineering > Linux' 카테고리의 다른 글

SSH security settings  (0) 2018.07.27
HTTP Header Sample Analysis - www.daum.net  (0) 2018.07.24
Linux: swap  (0) 2018.06.11
리눅스 Core dump  (0) 2018.05.24
리눅스마스터 1급 2차 노트  (0) 2017.04.17

SWAP partition in Linux, similar with virtual memory in Windows.


When the memory got out of range, the program will be located in swap partition.

But the speed is slower than the RAM because swap partition is on the disk.


Goods

-Give more memory spaces to insufficient RAM

-Allocate the program that is need fast memory


Bads

-Can not control the portion of swap dynamically

-Increase disk usage

-Does not always lead performance enhancement

'System Engineering > Linux' 카테고리의 다른 글

HTTP Header Sample Analysis - www.daum.net  (0) 2018.07.24
FTP server set up  (0) 2018.06.16
리눅스 Core dump  (0) 2018.05.24
리눅스마스터 1급 2차 노트  (0) 2017.04.17
리눅스 시스템 프로그래밍 노트  (0) 2017.02.02

"Core dump"란 UNIX 계열에서 프로그램이 비정상적으로 종료되는 경우에 프로그램이 종료될 당시의 메모리 상태를 기록하여 생성된 파일을 말합니다. 이 파일은 해당 프로그램에 어떤 문제가 있었는지 디버깅 하는 용도로 사용된다고 합니다.

그러면 왜 error 나 log 등의 이름이 아닌가 하면, DRAM 반도체를 사용하지 않던 시절에는 "Magnetic Core Memory" 라는 RAM을 사용했고, 그 이름이 아직까지 이어져 사용되고 있다고 합니다.


Magnetic core memory에 대하여 설명하자면,

전자기기, 안테나 등에 자주 사용되는 Ferrite(페라이트) 자성체로된 고리에 케이블이 통과하는 모양의 격자 구조로 되어있는 메모리 입니다. 코어 1개가 1비트의 저장용량을 지니며, 한 코어에 읽기 케이블 1가닥, 쓰기 케이블 2가닥이 지나갑니다. 각 케이블에 전류를 흘려 해당 코어들에 자화를 일으켜 전류 방향에 따라 0 또는 1을 기록하는 방식입니다.


또한 Core dump 파일은 크기가 매우 커서 계속 생성되도록 하면 디스크 용량을 계속 차지하기

 때문에 생기지 않도록 막는것이 보통이라고 합니다. 따라서 이름에 core가 들어갔지만 삭제해도 시스템에 영향을 미치는 파일이 아니고 오히려 파일 시스템 관리 측면에서 정리 대상 우선순위가 높은 파일이라 할 수 있습니다.



echo “source <(kubectl completion bash | sed s/kubectl/k/g)” >> ~/.basgrc

'System Engineering > Linux' 카테고리의 다른 글

FTP server set up  (0) 2018.06.16
Linux: swap  (0) 2018.06.11
리눅스마스터 1급 2차 노트  (0) 2017.04.17
리눅스 시스템 프로그래밍 노트  (0) 2017.02.02
리마 1급 1차 노트  (0) 2017.01.31

+ Recent posts