$ sudo mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
wordpress用DB設定。
MariaDB [(none)]> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.004 sec)
MariaDB [(none)]>
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress.* TO "DBアドミン名"@"localhost" IDENTIFIED BY "パスワード";
Query OK, 0 rows affected (0.004 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.002 sec)
ログに認証エラーが出た。ケルベロス認証などは使わないので無効化で対処する。
[ERROR] mysqld: Server GSSAPI error (major 851968, minor 2529639093) : gss_acquire_cred failed -Unspecified GSS failure. Minor code may provide more information. Keytab FILE:/etc/krb5.keytab is nonexistent or empty.
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache user chosen to provide access to the same directories as httpd
;user = apache
user = nginx
; RPM: Keep a group allowed to write in log dir.
;group = apache
group = nginx
$ sudo certbot certonly --standalone -d zassoul.com -m "Email-Address" --agree-tos
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for zassoul.com
Using the webroot path /usr/share/nginx/WP for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Subscribe to the EFF mailing list (email: "Email-Address").
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/zassoul.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/zassoul.com/privkey.pem
Your cert will expire on 2020-12-07. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
GoogleCloud SDK>gcloud compute images create nested-ubuntu-1604-lts --source-image-project=ubuntu-os-cloud --source-image=ubuntu-1604-xenial-v20181004 --licenses="https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx" Created [https://www.googleapis.com/compute/v1/projects/propane-passkey-xxxxx/global/images/nested-ubuntu-1604-lts]. NAME PROJECT FAMILY DEPRECATED STATUS nested-ubuntu-1604-lts propane-passkey-xxxxx READY
#ping 10.10.10.10 source 192.168.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.10.10.10, timeout is 2 seconds: Packet sent with a source address of 192.168.1.2 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 160/160/160 ms
IPSecステータス
#show crypto session Crypto session current status
Interface: Tunnel1 Profile: IKEv2_Profile Session status: UP-ACTIVE Peer: 35.231.219.234 port 4500 Session ID: 2209 IKEv2 SA: local 192.168.1.2/4500 remote 35.231.219.234/4500 Active IPSEC FLOW: permit ip 0.0.0.0/0.0.0.0 0.0.0.0/0.0.0.0 Active SAs: 2, origin: crypto map
crypto ipsec transform-set TS esp-aes 256 esp-sha256-hmac mode tunnel ! crypto ipsec profile GCP_Profile set transform-set TS set pfs group16 set ikev2-profile IKEv2_Profile ! ! crypto map GCP_map 5 ipsec-isakmp set peer <GCPのIPアドレス> set transform-set TS set pfs group16 set ikev2-profile IKEv2_Profile match address GCP_ACL ! ! interface Vlan100 description to 192.168.1.0/24 ip address 192.168.1.2 255.255.255.0 crypto map GCP_map ! ip access-list extended GCP_ACL permit ip 192.168.0.0 0.0.255.255 10.10.10.0 0.0.0.255 ! !
通信確認
Ping確認
#ping 10.10.10.10 source 192.168.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.10.10.10, timeout is 2 seconds: Packet sent with a source address of 192.168.1.2 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 160/162/164 ms
IP-Secステータス
#show crypto session Crypto session current status
Interface: Vlan100 Profile: IKEv2_Profile Session status: UP-ACTIVE Peer: 35.231.219.234 port 4500 Session ID: 2208 IKEv2 SA: local 192.168.1.2/4500 remote <GCPのIPアドレス>/4500 Active IPSEC FLOW: permit ip 192.168.0.0/255.255.0.0 10.10.10.0/255.255.255.0 Active SAs: 2, origin: crypto map
$ conf # set system name-server 8.8.8.8 (Google先生スミマセン) # commit # exit $ sudo su # wget beta版URL # exit $ add system image file $ show system image The system currently has the following image(s) installed:
set interfaces vti vti1 address '10.10.10.1/30' ~途中省略~ set vpn ipsec esp-group ESP compression 'disable' set vpn ipsec esp-group ESP lifetime '3600' set vpn ipsec esp-group ESP mode 'tunnel' set vpn ipsec esp-group ESP pfs 'dh-group14' set vpn ipsec esp-group ESP proposal 1 encryption 'aes256' set vpn ipsec esp-group ESP proposal 1 hash 'sha256' set vpn ipsec ike-group IKE ikev2-reauth 'no' set vpn ipsec ike-group IKE key-exchange 'ikev2' set vpn ipsec ike-group IKE lifetime '3600' set vpn ipsec ike-group IKE proposal 1 dh-group '14' set vpn ipsec ike-group IKE proposal 1 encryption 'aes256' set vpn ipsec ike-group IKE proposal 1 hash 'sha256' set vpn ipsec ipsec-interfaces interface 'eth0' set vpn ipsec site-to-site peer B.B.B.B authentication id '10.200.10.20' set vpn ipsec site-to-site peer B.B.B.B authentication mode 'pre-shared-secret' set vpn ipsec site-to-site peer B.B.B.B authentication pre-shared-secret 'password' set vpn ipsec site-to-site peer B.B.B.B authentication remote-id '192.168.1.2' set vpn ipsec site-to-site peer B.B.B.B connection-type 'initiate' set vpn ipsec site-to-site peer B.B.B.B default-esp-group 'ESP' set vpn ipsec site-to-site peer B.B.B.B ike-group 'IKE' set vpn ipsec site-to-site peer B.B.B.B ikev2-reauth 'inherit' set vpn ipsec site-to-site peer B.B.B.B local-address '10.200.10.20' set vpn ipsec site-to-site peer B.B.B.B vti bind 'vti1' set vpn ipsec site-to-site peer B.B.B.B vti esp-group 'ESP'
これでトンネル間の疎通が取れた。
vyos@VPN1:~$ ping 10.10.10.2 interface vti1 PING 10.10.10.2 (10.10.10.2) from 10.10.10.1 vti1: 56(84) bytes of data. 64 bytes from 10.10.10.2: icmp_seq=1 ttl=255 time=6.92 ms 64 bytes from 10.10.10.2: icmp_seq=2 ttl=255 time=6.86 ms
ちなみにVyOS1.1.8(以前)の場合,show crypto session や show vpn ipsec sa でステータスがアップになるが,疎通が取れない。VyOS側で確認するとトンネルインタフェースがAdmin Down状態となってしまう。(原因不明)
vyos@VPN2:~$ sh int vti vti1 vti1@NONE: mtu 1500 qdisc noqueue state DOWN group default link/ipip 10.200.10.20 peer B.B.B.B inet 10.10.20.1/30 scope global vti1 valid_lft forever preferred_lft forever
local crypto endpt.: 10.1.1.10, remote crypto endpt.: B.B.B.B plaintext mtu 1422, path mtu 1500, ip mtu 1500, ip mtu idb GigabitEthernet1 current outbound spi: 0x3478CA01(880331265) PFS (Y/N): N, DH group: none
inbound esp sas: spi: 0x9AF7C1FF(2599928319) transform: esp-256-aes esp-sha256-hmac , in use settings ={Tunnel UDP-Encaps, } conn id: 2068, flow_id: CSR:68, sibling_flags FFFFFFFF80000048, crypto map: Tunnel1-head-0 sa timing: remaining key lifetime (k/sec): (4607998/1485) IV size: 16 bytes replay detection support: Y Status: ACTIVE(ACTIVE)
inbound ah sas:
inbound pcp sas:
outbound esp sas: spi: 0x3478CA01(880331265) transform: esp-256-aes esp-sha256-hmac , in use settings ={Tunnel UDP-Encaps, } conn id: 2067, flow_id: CSR:67, sibling_flags FFFFFFFF80000048, crypto map: Tunnel1-head-0 sa timing: remaining key lifetime (k/sec): (4607999/1485) IV size: 16 bytes replay detection support: Y Status: ACTIVE(ACTIVE)
outbound ah sas:
outbound pcp sas:
c1000v#sh crypto session Crypto session current status
Interface: Tunnel1 Profile: IKEv2_Profile Session status: UP-ACTIVE Peer: B.B.B.B port 4500 Session ID: 6 IKEv2 SA: local 10.1.1.10/4500 remote B.B.B.B/4500 Active IPSEC FLOW: permit ip 0.0.0.0/0.0.0.0 0.0.0.0/0.0.0.0 Active SAs: 2, origin: crypto map
■ Vyos 抜粋 set interfaces loopback lo address ‘172.16.1.2/32’ set interfaces vti vti1 address ‘192.168.48.233/29’ set interfaces vti vti1 ip ospf dead-interval ’20’ set interfaces vti vti1 ip ospf hello-interval ‘5’ set interfaces vti vti1 ip ospf network ‘broadcast’ set interfaces vti vti1 ip ospf priority ‘1’ set interfaces vti vti1 ip ospf retransmit-interval ‘5’ set interfaces vti vti1 ip ospf transmit-delay ‘1’ set interfaces vti vti1 mtu ‘1422’ set protocols ospf area 0 network ‘192.168.254.0/24’ set protocols ospf area 0 network ‘10.10.20.0/24′ set protocols ospf log-adjacency-changes ‘detail’ set protocols static route 0.0.0.0/0 next-hop 10.10.10.1 distance ‘1’ —- set vpn ipsec esp-group ESP_AWS compression ‘disable’ set vpn ipsec esp-group ESP_AWS lifetime ‘3600’ set vpn ipsec esp-group ESP_AWS mode ‘tunnel’ set vpn ipsec esp-group ESP_AWS pfs ‘enable’ set vpn ipsec esp-group ESP_AWS proposal 1 encryption ‘aes256’ set vpn ipsec esp-group ESP_AWS proposal 1 hash ‘sha256’ set vpn ipsec ike-group IKE_AWS dead-peer-detection action ‘hold’ set vpn ipsec ike-group IKE_AWS dead-peer-detection interval ’30’ set vpn ipsec ike-group IKE_AWS dead-peer-detection timeout ‘120’ set vpn ipsec ike-group IKE_AWS lifetime ‘3600’ set vpn ipsec ike-group IKE_AWS proposal 1 dh-group ’14’ set vpn ipsec ike-group IKE_AWS proposal 1 encryption ‘aes256’ set vpn ipsec ike-group IKE_AWS proposal 1 hash ‘sha256’ set vpn ipsec ipsec-interfaces interface ‘eth0’ set vpn ipsec logging log-modes ‘all’ set vpn ipsec nat-traversal ‘enable’ set vpn ipsec site-to-site peer Global IP authentication mode ‘pre-shared-secret’ set vpn ipsec site-to-site peer Global IP authentication pre-shared-secret ‘aws’ set vpn ipsec site-to-site peer Global IP authentication remote-id ‘192.168.1.2’ set vpn ipsec site-to-site peer Global IP connection-type ‘respond’ set vpn ipsec site-to-site peer Global IP ike-group ‘IKE_BB’ set vpn ipsec site-to-site peer Global IP ikev2-reauth ‘inherit’ set vpn ipsec site-to-site peer Global IP local-address ‘10.200.10.50’ set vpn ipsec site-to-site peer Global IP vti bind ‘vti1’ set vpn ipsec site-to-site peer Global IP vti esp-group ‘ESP_BB’