New OpenStack 201707
New OpenStack 201707
Features
Open development model.
All of the code is freely available under the Apache 2.0 license.
The project is operated mainly by the OpenStack Foundation.
Releasing updates every six months.
A loosely coupled system.
Multiple independent components collaborate via REST API.
Written in Python.
Providing REST API to users.
Ecosystem
Company and users are connected via OpenStack and create
business opportunities.
• Developing vender proprietary plugins for OpenStack.
• Developing OpenStack Distributions.
1.1.2 OpenStack Releases
Core services
Project name Function
Keystone User management, authentication, authorization
Nova Management of hypervisor and virtual machines
Cinder Block storage management
Glance Virtual machine image management
Swift Object Storage
Neutron Virtual network management
Web UI
Horizon Operation by
Dashboard API
User
Store
Provide VM images
Provide VM images
Glance Swift
VM images Object
virtual network management storage
Neutron for VMs Nova
Virtual network Virtual machines
management
Keystone
Authentication
Authorization
1.2 How to operate OpenStack
OpenStack provides the REST API for using services.
Use tools for sending REST API requests.
Tools for sending REST API requests.
OpenStack dashboard
cURL command
OSS command line tool for send HTTP requests and receive responses.
REST clients
Browser-based GUI tools for REST API.
Project
A project is a container that groups and isolates resources. The administrator can set
resource limits for each projects. Users that are assigned to the same project can share
same resources.
Role
A role is a set of user rights and privileges to perform a specific set of operations.
The administrator assign roles to users.
Region
A region is a set of components that share same API endpoints. An API endpoint is a URI
that is used for send HTTP requests.
Availability zone
A logical set of servers, storages and networks. Different availability zones use different
physical servers, storages and networks.
Module2 Virtual instances
Root Disk
Amount of disk space to use for the root partion ( / ).
Ephemeral Disk
Amount of disk space to use for the ephemeral partition.
When the instance is terminated, the ephemeral disks is erased.
Nova provide ephemeral disks to instances.
2.3.2 Create Flavors (2)
2.4 Virtual networks
Virtual router
(NAT router)
Instance
A user who is assigned admin role can create new external networks
or change existing network settings to external networks.
2.4.5 Create external networks (2)
2.4.6 Display external networks and internal networks
2.4.7 Create virtual routers (1)
2.4.8 Create virtual routers (2)
2.4.9 Create virtual routers (3)
2.4.10 Create virtual routers (4)
Destination
192.168.100.8
Source
192.168.2.5
IP address
192.168.2.5
DHCP-assigned IP
address
user 192.168.100.8
Destination
192.168.2.106 Floating IP
192.168.2.106
Source
192.168.2.5
2.7.2 About NAT with Floating IPs (2)
Destination
192.168.2.5
Source
192.168.100.8
IP address
192.168.2.5
DHCP-assigned IP
address
user 192.168.100.8
Destination
192.168.2.5 Floating IP
192.168.2.106
Source
192.168.2.106
2.7.3 Create Floating IPs (1)
2.7.4 Create Floating IPs (2)
2.7.5 Create Floating IPs (3)
2.7.6 Create Floating IPs (4)
2.8 Virtual instances
2.8.1 Create virtual instances (1)
2.8.2 Create virtual instances (2)
Usage
ssh -i <identity_file> -l <login_name> <IP_address>
ssh -i <identity_file> <login_name>@<IP_address>
Connect to a instance
$ ssh -i keypair.pem -l centos 192.168.2.106
Last login: Sat Jul 1 13:07:52 2017 form 192.168.2.5
[centos@instance ~]$
Option
-i identity_file : Selects a private key file.
-l login_name : Specifies the user to log in as on the remote machine.
-p port : Port to connect to on the remote host.
3.4 OpenSSH server (sshd) configuration file
3.4.1 Setting items
sshd configuration file is /etc/ssh/sshd_config.
Main setting items of /etc/ssh/sshd_config
Setting items
Port Specifies the port number that sshd listens on.
Protocol Specifies the protocol versions sshd supports.
PermitRootLogin Specifies whether root can login.
RSAAuthentication Specifies whether RSA1 authentication is allowed.
PubkeyAuthentication Specifies whether RSA2 and DSA authentication is allowed.
PermitEmptyPaswords Specifies whether empty password is allowed.
PasswordAuthentication Specifies whether password authentication is allowed.
MaxAuthTries Specifies the maximum number of authentication attempts
permitted per connection.
LoginGraceTime The server disconnects after this time if the user has not
successfully logged in.
AllowUsers / DenyUsers A list that allows or deny user connections.
3.4.2 Setting example (1)
Port
SSH default port is 22. The attacker often selects the default port as an attack target.
Changing the port number is more secure setting.
Port 20022
Protocol
SSH version 1 is vulnerable. It is necessary to use only SSH version 2.
Protocol 2
PermitRootLogin
The attacker often selects the root user as an attack target.
Disabling root user login increases security.
PermitRootLogin no
3.4.3 Setting example (2)
RSAAuthentication
Specifies whether RSA1 authentication is allowed. RSA1 is used only in SSH version 1.
It is recommended to comment out if you only use SSH version 2.
#RSAAuthentication yes
PubkeyAuthentication
Specifies whether RSA2 and DSA authentication is allowed. RSA2 and DSA are used in
SSH version2.
PubkeyAuthentication yes
PermitEmptyPassword
When password authentication is allowed, it specifies whether the server allows login
to accounts with empty password strings. It is necessary to set "no".
PermitEmptyPassword no
3.4.4 Setting example (3)
PasswordAuthentication
If public key authentication is set up, password authentication is unnecessary.
It is recommended to set "no".
PasswordAuthentication no
MaxAuthTries
Specifies the maximum number of authentication attempts permitted per connection.
The default is 6. Reducing this number is more secure setting.
MaxAuthTries 3
LoginGraceTime
The server disconnects after this time if the user has not successfully logged in.
If the value is 0, there is no time limit. The default is 120 seconds.
LoginGraceTime 60
3.4.5 Setting example (4)
AllowUsers
By default, login with SSH is allowed for all users.
If specified, login is allowed only for users in this list.
DenyUsers
By default, login with SSH is allowed for all users.
If specified, login is disallowed for users in this list.
usage
sudo <command>
If asked for a password, enter the password of the user who execute
the sudo command.
3.5.2 sudo command configuration file
sudo command configuration file is /etc/sudoers.
Edit the file using the visudo command with root privilege.
Setting example 1
(1) The user who are allowed to execute commands. (who)
userA ALL=(ALL) ALL (2) The host on which the user is allowed to execute commands.
(1) (2) (3) (4) (where)
(3) The user at command execution. (as whom)
(4) The commands allowed to execute. (what)
userA can execute all commands with root privilege.
Setting example 2
%groupA ALL=(ALL) /sbin/shutdown
Important point
Executing visudo will launch the default editor and you will be able to edit
the configuration file. Do not use other editors to edit the configuration file.
Module4 Updating and expanding
EPEL (Extra Packages for Enterprise Linux) packages are usually based on their Fedora
counterparts and will never conflict with or replace packages in CentOS.
From EPEL repository, you can get new packages that are not delivered
in the CentOS standard repository.
Launch
Image instance
size
Fravor
size
Grow
Cloud-init which installed in the instance executes initialization set in the configuration file
at launching. If you want to expand the disk, you need to install cloud-init, growpart, resize2fs
in the image.
4.2.1 Cloud-init configuration file
/etc/cloud/cloud.cfg
users:
- default
…
cloud_init_modules:
- migrator
- bootcmd
- write-files (1)
- growpart
- resizefs
…
cloud_config_modules:
- mounts (2)
…
cloud_final_modules:
- rightscale_userdata (3)
…
4.2.2 Command for grow partitions and file systems
Grow partitions
# yum install cloud-utils-growpart
# growpart /dev/vda 1
# shutdown -r now
Grow file systems
# resize2fs /dev/vda1
Options
Option
-a Show all sockets.
-t Show TCP sockets.
-u Show UDP sockets.
-n Show numerical addresses instead of hostname and protocol name.
-p Show the PID and program name which each socket belongs.
5.1.2 Check port used for connection (2)
Executing system-config-firewall-tui
# system-config-firewall-tui
5.2 Antivirus software
5.2.1 About ClamAV
ClamAV is an open source antivirus software
which support Linux, Windows, BSD, Solaris, macOS.
https://www.clamav.net/
5.2.1 Setting up ClamAV in CentOS 7 (1)
Edit /etc/freshclam.conf
Example
#Example
#DatabaseMirror db.XX.clamav.net
DatabaseMirror db.jp.clamav.net
#FRESHCLAM_DELAY=disabled-warn
Update manually
# freshclam
Scan manually
# clamscan -r -i <Directory path>
With the daemon, scanning is faster because the virus database has already been loaded
into memory.
Module6 Virtual appliance
https://www.turnkeylinux.org/
6.2 Method of using virtual appliances
6.2.1 Download virtual appliance image files
6.2.2 Create virtual appliance images
$ tar xvfz turnkey-moodle-14.1-Jessie-amd64-openstack.tar.gz
turnkey-moodle-14.1-Jessie-amd64/
turnkey-moodle-14.1-Jessie-amd64/turnkey-moodle-14.1-Jessie-amd64-kernel
turnkey-moodle-14.1-Jessie-amd64/turnkey-moodle-14.1-Jessie-amd64-initrd
turnkey-moodle-14.1-Jessie-amd64/turnkey-moodle-14.1-Jessie-amd64.img
$ . openrc.sh
$ cd turnkey-moodle-14.1-Jessie-amd64