Skip to content

Commit

Permalink
Merge pull request #2 from Otus-DevOps-2018-09/cloud-bastion
Browse files Browse the repository at this point in the history
Cloud bastion
  • Loading branch information
Kirill-Garbar authored Oct 16, 2018
2 parents 1abbafa + 156fd82 commit 0e326bb
Show file tree
Hide file tree
Showing 3 changed files with 241 additions and 2 deletions.
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
# Kirill-Garbar_infra
Kirill-Garbar Infra repository
# Выполнено ДЗ №

- [X] Основное ДЗ
- [X] Задание со *

## В процессе сделано:
- Созданы две ВМ. Одна с внутренним. Одна с внешним и внутренним IP - пограничный сервер.
- Проработаны несколько вариантов подключения через proxy по SSH
- Проработан метод создания алиасов для SSH.
- Проработана подключение по SSH keys.
- Развёрнут по инструкции OpenVPN с надстройкой pritunl. Настроено использование с let's encrypt и сервисом sslip.io.

## Подключение к someinternalhost в одну команду. Три способа.
- ssh -o ProxyCommand="ssh -i ~/.ssh/appuser [email protected] nc %h %p" [email protected]
- ssh -o ProxyCommand="ssh -W %h:%p -i ~/.ssh/appuser [email protected]" [email protected]
- ssh -tt -i ~/.ssh/appuser -A [email protected] ssh -tt 10.156.0.2

## Вариант решения для подключения командой ssh someinternalhost.
Добавить Host в файл config в директории .ssh.
```
Host someinternalhost
HostName 10.156.0.2
User appuser
IdentitiesOnly yes
IdentityFile ~/.ssh/appuser
ProxyCommand ssh -i ~/.ssh/appuser [email protected] nc %h %p
```

## Данные для подключения
```
bastion_IP = 35.187.10.59
someinternalhost_IP = 10.156.0.2
```

## Как проверить работоспособность:
- Перейти по ссылке https://35.187.10.59.sslip.io

## PR checklist
- [X] Выставил label с номером домашнего задания
- [X] Выставил label с темой домашнего задания
191 changes: 191 additions & 0 deletions cloud-bastion.ovpn
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
#{
# "push_auth": false,
# "sync_secret": "G8JKq5DHvo9hXLBLcXJDRuarSc09Q0AZ",
# "token_ttl": 172800,
# "organization_id": "5bc4ea6ecb8db1303bee5d05",
# "user": "test",
# "disable_reconnect": false,
# "sync_token": "FZNpeFqiVb2YEoGIvyaaJpx5ctD2w9Ll",
# "sync_hash": "cc6431ba1a9a52a5bb8bf5705fb7d51c",
# "server_id": "5bc4eaaccb8db1303bee5d53",
# "user_id": "5bc4ea6fcb8db1303bee5d0b",
# "server": "test_pritunl",
# "token": false,
# "version": 1,
# "push_auth_ttl": 172800,
# "sync_hosts": [
# "https://35.187.10.59"
# ],
# "organization": "KirillGarbar",
# "password_mode": "pin"
#}
setenv UV_ID 39a9d15d6f894827a74c1934e6d20ed9
setenv UV_NAME guarded-skies-5206
client
dev tun
dev-type tun
remote 35.187.10.59 11948 udp
nobind
persist-tun
cipher AES-128-CBC
auth SHA1
verb 2
mute 3
push-peer-info
ping 10
ping-restart 60
hand-window 70
server-poll-timeout 4
reneg-sec 2592000
sndbuf 393216
rcvbuf 393216
max-routes 1000
remote-cert-tls server
comp-lzo no
auth-user-pass
key-direction 1
<ca>
-----BEGIN CERTIFICATE-----
MIIFcTCCA1mgAwIBAgIIRDztGEkXW40wDQYJKoZIhvcNAQELBQAwRjEhMB8GA1UE
CgwYNWJjNGVhNmVjYjhkYjEzMDNiZWU1ZDA1MSEwHwYDVQQDDBg1YmM0ZWE2ZWNi
OGRiMTMwM2JlZTVkMDYwHhcNMTgxMDE1MTkyODQ3WhcNMjgxMDE0MTkyODQ3WjBG
MSEwHwYDVQQKDBg1YmM0ZWE2ZWNiOGRiMTMwM2JlZTVkMDUxITAfBgNVBAMMGDVi
YzRlYTZlY2I4ZGIxMzAzYmVlNWQwNjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC
AgoCggIBAN6LTDBujwOMX589P2kNyYwCt8vDplQnlocgK3F4VAakSS9Fey7Y17x3
MavBEnoW2Pstik99g8xmoyFH0jYemgrjsbMBsciGRr0YYaOLVvXQNx3cLonlG2Zu
zaPRGjJujm4PXF5JI30woFu+WCAO07SVCOzKNn0raWBr5+1xFIo06w8u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TkinAK9x68mJVrBt/8E+s2m4hvgLY
lYQYsknXwE6Xz1VrNR5WCW/AxH+VXfFXEDzVWfbspJlPG6tUF4eIw3O8YXnFMi0L
rP1mLnfIWj969NsJAgR+uB43J/T3BnPWTIZ/Yrfn3/yqw5eCrQP/GOKIXtizdtTb
Eur93v4JvmiLszvNV9I9FFBkQLAH4NOkB+pKYdHKP4AMy2F+FPSMRc6sJFma8l5J
vzBMtl/1Yzgp4MTxr8LuGYjXueHrcCtLMC5GqHhOSN/vKsW6VEq8ADIr4FwCCUNo
gfFNyVA=
-----END CERTIFICATE-----
</ca>
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
98102e23e1fde661fb91401d19db1e3e
bd55fa6f8f44bc41a977c2d9cccbc26e
d10a06d02de3a26831d9d85f3479813a
0843f83013607a5a5a4fd3a54c24b1e3
dfeb454bf8fa6c57dc91abc1ce612131
99c71ee6f32879f267c0b3c0c55b901b
d0873344b8e4ee87086ea817c2f8fee7
21021641d34b8e4bf18c39df22957674
698c6a396420ab403367c526fa954651
628d4d5bb87b4801acd71fb744a2ace9
bc64fbe88ccd900f8f022b2ddedf85ca
043c5a80fbcf8603359c1d34f94c56a6
85dd6d73a571bda41d9811706ebf99c8
4b57146915c085305d70039884c96109
4b8358e39e991047151c70d1d6dd2b74
4a41c52ec0cd038f789d5b95c8bb4d25
-----END OpenVPN Static key V1-----
</tls-auth>
<cert>
-----BEGIN CERTIFICATE-----
MIIFgTCCA2mgAwIBAgIJAIwHDPc0dTzgMA0GCSqGSIb3DQEBCwUAMEYxITAfBgNV
BAoMGDViYzRlYTZlY2I4ZGIxMzAzYmVlNWQwNTEhMB8GA1UEAwwYNWJjNGVhNmVj
YjhkYjEzMDNiZWU1ZDA2MB4XDTE4MTAxNTE5Mjg0OFoXDTI4MTAxNDE5Mjg0OFow
RjEhMB8GA1UECgwYNWJjNGVhNmVjYjhkYjEzMDNiZWU1ZDA1MSEwHwYDVQQDDBg1
Ym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LIm/6ov
1oFPmFKfTV0PFUJP7Brj0950h5S7tiN+bjOaY3jm2H9REmt+vyq+dfphDnlhpcSv
onz7PlaWTDLf4OFojEno+y7D7D5Xz4T6MYAP5thePmSgdd62IjDEzb90JGPOoDY/
jx882zTb13Eoahe7lkou1nmDQQv7d1V/huFqQN1wSOXW/bXeeVOIo5WIadS6zJ0H
Wo2uD3kW6Xv6ikHdT0g3Kg49+ZRP+P6syB97LNpn7NebRpFJPt88fWjExLEOBpMo
AisCggEBAIHg7Fv5kgqE1E18KksdLCL6bGzNlptDN2XRESSK61sQ7wKw8sHaOtgJ
iq9FSirclQYQwh6YVpe6NSfPP/hkhLPqACTIPmyV6xXioVKfqJhqTHFOw046m6SB
X1scWUF1Sm60zbEP1K6FzbX0YaNKC84hhc8y1zxYuCaV0QGvZ3oW6GuZsdpvGC/0
C51nPUKjHkugFVWyr2k5FUWmMeNdAdVSjj8fDBEhW2wJkQ6PAPqRIku+wiCmiYZ5
5oqmPpYgtQFZnPLVy5m9dQZ5WAcMT62HF5Z+QwPKXOxQTxqdsDxO5a8UuALCU6oi
CSJmJTLcraJ91HYvoJDtrGaKUp1PgFU=
-----END PRIVATE KEY-----
</key>
10 changes: 10 additions & 0 deletions setupvpn.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" > /etc/apt/sources.list.d/mongodb-org-3.4.list
echo "deb http://repo.pritunl.com/stable/apt xenial main" > /etc/apt/sources.list.d/pritunl.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 0C49F3730359A14518585931BC711F9BA15703C6
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A
apt-get --assume-yes update
apt-get --assume-yes upgrade
apt-get --assume-yes install pritunl mongodb-org
systemctl start pritunl mongod
systemctl enable pritunl mongod

0 comments on commit 0e326bb

Please sign in to comment.