/etc/sysconfig/selinux

SELinux
SELinux(Security-Enhanced Linux) is a security extension module of the Linux kernel developed mainly by NSA(national security agency) in the united states. We will add the “secure OS” function to the Linux kernel. It is not the name of the distribution.

The biggest feature is that each process is designed to move with minimal authority considering the risk of root privilege.
The main functions are the following five. ref: security academy study meeting

1. MAC (Mandatory Access Control)
Only security administrator can set security

2. TE (Type Enforcement)
Access control for each process

3. Row Based Access Control(RBAC)
By assigning the administrative authority to the user, it is possible to avoid a mistake in operation with the conventional root

4. Domain transition
Allow only preset privilege escalation (deeply related to TE of 2)

5. Audit log
It is possible to logs of operations inside and outside the authority.

[vagrant@localhost tests]$ cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

disabled なので無効化されています。

getenforceでも見れるようです。

[vagrant@localhost tests]$ getenforce
Disabled

What is cookie?

A cookie is information stored in smartphone or PC from the website you are viewing. There are various contents such as the data and time of visiting the site, the number of visits, etc are recorded there.

So why does the website need to store information?

Cookie
Thanks to cookies to be able to see the website comfortably. For example, if you access a site once logged in by entering ID and password, such as Facebook or Twitter, after a while, you can go in without having to enter ID and password. This is thanks to the cookie where the login information is stored.

Or, while you are shopping at a shopping site, you log out with the item in the cart. After a while, if you access the same shopping site again, the items in the cart will not disappear and remain firmly. This is thanks to the cookie which stored the cart information.

In this way, cookie are extremely helpful in making the access and operation of the Web convenient, and enabling the provision of various services. Actually, if you do not enable cookies, inconvenience arises that websites are not displayed properly or you can not shop. Many of internet banking can not be used unless cookies are enabled.

Also, with cookies, websites can learn shopping history, user interests and topics, so they are also heavily used in corporate marketing analysis.

mkdir -p option

mkdir -p option (–parents option)
If there is no directory without describing an error and create it.

[vagrant@localhost tests]$ ls
index.php test
[vagrant@localhost tests]$ mkdir -p test
[vagrant@localhost tests]$ ls
index.php test
[vagrant@localhost tests]$ mkdir -p test2
[vagrant@localhost tests]$ ls
index.php test test2

iptables vs ip6tables

ip6tables is used to set, manage and check the table of the IPv6 packet filter rules of the Linux kernel. There is a possibility that several different tables are defined. Each table contains a built in chain. It can also contain user-defined chains. Each rule specifies what to do for matched packet. This is called a “target” and sometimes jumps to a user-defined chain in the same table.

# service iptables stop
# service ip6tables stop
# chkconfig iptables off
# chkconfig ip6tables off

/etc/sudoers

“/etc/sudoers” is the configuration file that describe the users that can be changed with the sudo command and the commands that can be executed.

[vagrant@localhost ~]$ sudo cat /etc/sudoers
## Sudoers allows particular users to run various commands as
## the root user, without needing the root password.
##
## Examples are provided at the bottom of the file for collections
## of related commands, which can then be delegated out to particular
## users or groups.
##
## This file must be edited with the 'visudo' command.

## Host Aliases
## Groups of machines. You may prefer to use hostnames (perhaps using
## wildcards for entire domains) or IP addresses instead.
# Host_Alias     FILESERVERS = fs1, fs2
# Host_Alias     MAILSERVERS = smtp, smtp2

## User Aliases
## These aren't often necessary, as you can use regular groups
## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname
## rather than USERALIAS
# User_Alias ADMINS = jsmith, mikem


## Command Aliases
## These are groups of related commands...

## Networking
# Cmnd_Alias NETWORKING = /sbin/route, /sbin/ifconfig, /bin/ping, /sbin/dhclient, /usr/bin/net, /sbin/iptables, /usr/bin/rfcomm, /usr/bin/wvdial, /sbin/iwconfig, /sbin/mii-tool

## Installation and management of software
# Cmnd_Alias SOFTWARE = /bin/rpm, /usr/bin/up2date, /usr/bin/yum

## Services
# Cmnd_Alias SERVICES = /sbin/service, /sbin/chkconfig

## Updating the locate database
# Cmnd_Alias LOCATE = /usr/bin/updatedb

## Storage
# Cmnd_Alias STORAGE = /sbin/fdisk, /sbin/sfdisk, /sbin/parted, /sbin/partprobe, /bin/mount, /bin/umount

## Delegating permissions
# Cmnd_Alias DELEGATING = /usr/sbin/visudo, /bin/chown, /bin/chmod, /bin/chgrp

## Processes
# Cmnd_Alias PROCESSES = /bin/nice, /bin/kill, /usr/bin/kill, /usr/bin/killall

## Drivers
# Cmnd_Alias DRIVERS = /sbin/modprobe

# Defaults specification

#
# Refuse to run if unable to disable echo on the tty.
#
Defaults   !visiblepw

#
# Preserving HOME has security implications since many programs
# use it when searching for configuration files. Note that HOME
# is already set when the the env_reset option is enabled, so
# this option is only effective for configurations where either
# env_reset is disabled or HOME is present in the env_keep list.
#
Defaults    always_set_home

Defaults    env_reset
Defaults    env_keep =  "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS"
Defaults    env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"
Defaults    env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES"
Defaults    env_keep += "LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE"
Defaults    env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"

#
# Adding HOME to env_keep may enable a user to run unrestricted
# commands via sudo.
#
# Defaults   env_keep += "HOME"

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin

## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
##      user    MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL

## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS

## Allows people in group wheel to run all commands
# %wheel        ALL=(ALL)       ALL

## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL

## Allows members of the users group to mount and unmount the
## cdrom as root
# %users  ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom

## Allows members of the users group to shutdown this system
# %users  localhost=/sbin/shutdown -h now

## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d

おう、なんか凄いことになってるな。Cmndが多いな。

curl -K -L -o ${directory_path} ‘URL’

curl -k
Ignore SSL error and continue processing(-K)
Server-side certificate is invalid, client-side root certificate is invalid, etc.

curl -k http://www.sample.com

curl -L
make redirect(-L)

curl -L http://www.example.com

save the downloaded data as a file

vim.tar.bz2 http://ftp2.jp.vim.org/pub/vim/unix/vim-8.1.tar.bz2

Check the packages installed on Linux

A command to return the package list(yum list installed, rpm -qa)
you can obtain a list of package names you want to search by piping to grep command to search for caracter strings.

[vagrant@localhost ~]$ yum list installed | grep gcc
gcc.x86_64                         4.4.7-23.el6                      @base
gcc-c++.x86_64                     4.4.7-23.el6                      @base
libgcc.x86_64                      4.4.7-23.el6                      @base

うん、インストールされているようだね。
[vagrant@localhost ~]$ yum list installed | grep perl
perl.x86_64 4:5.10.1-144.el6 @base
perl-CPAN.x86_64 1.9402-144.el6 @base
perl-DBD-MySQL.x86_64 4.013-3.el6 @base
perl-DBI.x86_64 1.609-4.el6 @base
perl-Digest-SHA.x86_64 1:5.47-144.el6 @base
perl-Error.noarch 1:0.17015-4.el6 @base
perl-ExtUtils-MakeMaker.x86_64 6.55-144.el6 @base
perl-ExtUtils-ParseXS.x86_64 1:2.2003.0-144.el6 @base
perl-Git.noarch 1.7.1-9.el6_9 @base
perl-Module-Pluggable.x86_64 1:3.90-144.el6 @base
perl-Pod-Escapes.x86_64 1:1.04-144.el6 @base
perl-Pod-Simple.x86_64 1:3.13-144.el6 @base
perl-Test-Harness.x86_64 3.17-144.el6 @base
perl-devel.x86_64 4:5.10.1-144.el6 @base
perl-libs.x86_64 4:5.10.1-144.el6 @base
perl-version.x86_64 3:0.77-144.el6 @base
[vagrant@localhost ~]$ perl -v

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

Copyright 1987-2009, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using “man perl” or “perldoc perl”. If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

gcc

GNU Compiler Collection
gcc is a compiler developed and published by the GNU project. It is packaged with compilers of various programming languages. It is standardly used in many UNIX based OSs, and in open source OS, it is often used for compiling OS itself.