Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
server-utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NoCloud
server-utils
Commits
9c192559
Verified
Commit
9c192559
authored
10 months ago
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
Update files after test
parent
c51c772b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
auto-start-reverseSSHproxy.sh
+12
-12
12 additions, 12 deletions
auto-start-reverseSSHproxy.sh
net-switch.sh
+17
-19
17 additions, 19 deletions
net-switch.sh
reverseSSHproxy.sh
+1
-1
1 addition, 1 deletion
reverseSSHproxy.sh
with
30 additions
and
32 deletions
auto-start-reverseSSHproxy.sh
+
12
−
12
View file @
9c192559
...
@@ -31,40 +31,40 @@ HTTP_STATUS=$(curl -o /dev/null -w "%{http_code}\n" -s -k $URL)
...
@@ -31,40 +31,40 @@ HTTP_STATUS=$(curl -o /dev/null -w "%{http_code}\n" -s -k $URL)
do_sendmail_start
()
{
do_sendmail_start
()
{
cat
<<
EOF
| sendmail -t root
cat
<<
EOF
|
/usr/sbin/
sendmail -t root
Subject: [
$(
hostname
)
] Serveur Tetrix injoignable
Subject: [
$(
hostname
)
] Serveur Tetrix injoignable
Bonjour,
Bonjour,
$(
hostname
)
viens de detecter que Tetrix est injoignable par son IP normale (
$tetrixPublicIPOnOVH
).
$(
hostname
)
viens de detecter que Tetrix est injoignable par son IP normale (
$tetrixPublicIPOnOVH
).
Le syst
è
me d'accès
à
distance à T
é
trix via
$(
hostname
)
(reverseSSHproxyPath) est actif,
Le syst
e
me d'accès
a
distance à T
e
trix via
$(
hostname
)
(reverseSSHproxyPath) est actif,
d
è
s que le r
é
seau passera en mode de secours (4G), ce dernier sera joignable
à
nouveau.
d
e
s que le r
e
seau passera en mode de secours (4G), ce dernier sera joignable
a
nouveau.
Cordialement,
Cordialement,
EOF
EOF
}
}
do_sendmail_stop
()
{
do_sendmail_stop
()
{
cat
<<
EOF
| sendmail -t root
cat
<<
EOF
|
/usr/sbin/
sendmail -t root
Subject: [
$(
hostname
)
] Serveur Tetrix
in
joignable
Subject: [
$(
hostname
)
] Serveur Tetrix
a nouveau
joignable
Bonjour,
Bonjour,
$(
hostname
)
viens de detecter que Tetrix est
à
nouveau joignable par son IP nornale (
$tetrixPublicIPOnOVH
).
$(
hostname
)
viens de detecter que Tetrix est
a
nouveau joignable par son IP nornale (
$tetrixPublicIPOnOVH
).
Le syst
è
me d'accès
à
distance à T
é
trix via
$(
hostname
)
(reverseSSHproxyPath) est désactivé,
Le syst
e
me d'accès
a
distance à T
e
trix via
$(
hostname
)
(reverseSSHproxyPath) est désactivé,
d
è
s que le r
é
seau repassera en mode de normal (Fibre), ce dernier sera joignable
à
nouveau.
d
e
s que le r
e
seau repassera en mode de normal (Fibre), ce dernier sera joignable
a
nouveau.
Cordialement,
Cordialement,
EOF
EOF
}
}
if
[
[
-f
"
$stateFile
"
]
]
;
then
if
[
-f
"
$stateFile
"
]
;
then
$
state
=
`
cat
$stateFile
`
state
=
`
cat
$stateFile
`
# check if tetrix is reachable (status code 200)
# check if tetrix is reachable (status code 200)
if
[
$HTTP_STATUS
-eq
200
]
;
then
if
[
$HTTP_STATUS
-eq
200
]
;
then
if
[
[
$state
!=
"normal"
]
]
;
then
if
[
$state
!=
"normal"
]
;
then
# Switch on normal mode
# Switch on normal mode
cd
$reverseSSHproxyPath
cd
$reverseSSHproxyPath
docker-compose down
docker-compose down
...
@@ -72,7 +72,7 @@ if [[ -f "$stateFile" ]]; then
...
@@ -72,7 +72,7 @@ if [[ -f "$stateFile" ]]; then
do_sendmail_start root
do_sendmail_start root
fi
fi
else
else
if
[
[
$state
==
"normal"
]
]
;
then
if
[
$state
==
"normal"
]
;
then
# Switch on back up mode
# Switch on back up mode
cd
$reverseSSHproxyPath
cd
$reverseSSHproxyPath
docker-compose up
-d
docker-compose up
-d
...
...
This diff is collapsed.
Click to expand it.
net-switch.sh
+
17
−
19
View file @
9c192559
...
@@ -45,18 +45,18 @@ change_dns() {
...
@@ -45,18 +45,18 @@ change_dns() {
curl
-s
-X
PUT
--header
"Authorization: Bearer
${
APIKEY
}
"
\
curl
-s
-X
PUT
--header
"Authorization: Bearer
${
APIKEY
}
"
\
--header
"Content-Type: application/json"
\
--header
"Content-Type: application/json"
\
-d
"{
\"
rrset_values
\"
: [
\"
${
CURRENTIP
}
\"
],
\"
rrset_ttl
\"
: "
300
"}"
\
-d
"{
\"
rrset_values
\"
: [
\"
${
CURRENTIP
}
\"
],
\"
rrset_ttl
\"
: "
300
"}"
\
https://api.gandi.net/v5/livedns/domains/tetras-libre.fr/records/tetrix
x
/A
https://api.gandi.net/v5/livedns/domains/tetras-libre.fr/records/tetrix/A
}
}
do_sendmail_start
()
{
do_sendmail_start
()
{
cat
<<
EOF
| sendmail -t
$recipient
cat
<<
EOF
|
/usr/sbin/
sendmail -t
$recipient
Subject: [
$(
hostname
)
] Bascule du r
é
seau en
$1
Subject: [
$(
hostname
)
] Bascule du r
e
seau en
mode secours (4G)
Bonjour,
Bonjour,
La bascule automatique du r
é
seau viens de s'activer sur
$(
hostname
)
. Passage en
$1
.
La bascule automatique du r
e
seau viens de s'activer sur
$(
hostname
)
. Passage en
mode secours (4G)
.
Pour utiliser gitlab, vous devez ajouter ces lignes dans ~/.ssh/config :
Pour utiliser gitlab, vous devez ajouter ces lignes dans ~/.ssh/config :
...
@@ -64,7 +64,7 @@ host gitlab.tetras-libre.fr
...
@@ -64,7 +64,7 @@ host gitlab.tetras-libre.fr
Port 2223
Port 2223
La bascule se fait via un changement de DNS qui peut mettre un peu de temps
à
ce propager (3h) max.
La bascule se fait via un changement de DNS qui peut mettre un peu de temps
a
ce propager (3h) max.
Pendant ce temps vous pouvez ajouter les lignes suivantes dans /etc/hosts:
Pendant ce temps vous pouvez ajouter les lignes suivantes dans /etc/hosts:
$aquilaPublicIPOnOVH
nextcloud.tetras-libre.fr
$aquilaPublicIPOnOVH
nextcloud.tetras-libre.fr
...
@@ -72,7 +72,7 @@ $aquilaPublicIPOnOVH gitlab.tetras-libre.fr
...
@@ -72,7 +72,7 @@ $aquilaPublicIPOnOVH gitlab.tetras-libre.fr
$aquilaPublicIPOnOVH
dolibarr.tetras-libre.fr
$aquilaPublicIPOnOVH
dolibarr.tetras-libre.fr
$aquilaPublicIPOnOVH
passbolt.tetras-libre.fr
$aquilaPublicIPOnOVH
passbolt.tetras-libre.fr
En cas de probl
è
me, contactez
$adminemail
En cas de probl
e
me, contactez
$adminemail
Cordialement,
Cordialement,
EOF
EOF
...
@@ -80,17 +80,17 @@ EOF
...
@@ -80,17 +80,17 @@ EOF
do_sendmail_stop
()
{
do_sendmail_stop
()
{
cat
<<
EOF
| sendmail -t
$recipient
cat
<<
EOF
|
/usr/sbin/
sendmail -t
$recipient
Subject: [
$(
hostname
)
] Bascule du r
é
seau en
$1
Subject: [
$(
hostname
)
] Bascule du r
e
seau en
mode normal (Fibre)
Bonjour,
Bonjour,
La bascule automatique du r
é
seau viens de s'activer sur
$(
hostname
)
. Passage en
$1
.
La bascule automatique du r
e
seau viens de s'activer sur
$(
hostname
)
. Passage en
mode normal (Fibre)
.
Pour utiliser gitlab, pensez
à
supprimer les lignes concernant gitlab.tetras-libre.fr dans ~/.ssh/config.
Pour utiliser gitlab, pensez
a
supprimer les lignes concernant gitlab.tetras-libre.fr dans ~/.ssh/config.
La bascule se fait via un changement de DNS qui peut mettre un peu de temps
à
ce propager (3h) max.
La bascule se fait via un changement de DNS qui peut mettre un peu de temps
a
ce propager (3h) max.
Pendant ce temps vous pouvez ajouter les lignes suivantes dans /etc/hosts:
Pendant ce temps vous pouvez ajouter les lignes suivantes dans /etc/hosts:
$tetrixPublicIPOnOVH
nextcloud.tetras-libre.fr
$tetrixPublicIPOnOVH
nextcloud.tetras-libre.fr
...
@@ -98,20 +98,18 @@ $tetrixPublicIPOnOVH gitlab.tetras-libre.fr
...
@@ -98,20 +98,18 @@ $tetrixPublicIPOnOVH gitlab.tetras-libre.fr
$tetrixPublicIPOnOVH
dolibarr.tetras-libre.fr
$tetrixPublicIPOnOVH
dolibarr.tetras-libre.fr
$tetrixPublicIPOnOVH
passbolt.tetras-libre.fr
$tetrixPublicIPOnOVH
passbolt.tetras-libre.fr
En cas de probl
è
me, contactez
$adminemail
En cas de probl
e
me, contactez
$adminemail
EOF
EOF
}
}
# check if file exist
# check if file exist
if
[
[
-f
"
$stateFile
"
]
]
;
then
if
[
-f
"
$stateFile
"
]
;
then
$
state
=
`
cat
$stateFile
`
state
=
`
cat
$stateFile
`
# Check if current ip is different of normal ip
# Check if current ip is different of normal ip
if
[
[
$tetrixPublicIPOnOVH
==
$currentIP
]
]
;
then
if
[
$tetrixPublicIPOnOVH
==
$currentIP
]
;
then
if
[
[
$state
!=
"normal"
]
]
;
then
if
[
$state
!=
"normal"
]
;
then
# Switch on normal mode
# Switch on normal mode
pid
=
`
ps aux |
grep
test.sh |
grep
-v
grep
|
awk
'{print $2}'
`
pid
=
`
ps aux |
grep
test.sh |
grep
-v
grep
|
awk
'{print $2}'
`
kill
$pid
kill
$pid
...
@@ -120,7 +118,7 @@ if [[ -f "$stateFile" ]]; then
...
@@ -120,7 +118,7 @@ if [[ -f "$stateFile" ]]; then
do_sendmail_start
do_sendmail_start
fi
fi
else
else
if
[
[
$state
==
"normal"
]
]
;
then
if
[
$state
==
"normal"
]
;
then
# Switch on back up mode
# Switch on back up mode
bash
$reverseSSHProxyPath
&
bash
$reverseSSHProxyPath
&
change_dns
$APIKEY
$aquilaPublicIPOnOVH
change_dns
$APIKEY
$aquilaPublicIPOnOVH
...
...
This diff is collapsed.
Click to expand it.
reverseSSHproxy.sh
+
1
−
1
View file @
9c192559
#!/bin/bash
#!/bin/bash
HTTPS_PORT
=
8
080
HTTPS_PORT
=
8
443
SSHPORT_INT
=
2223
SSHPORT_INT
=
2223
SSHPORT
=
2222
SSHPORT
=
2222
PROXY_HOST
=
aquila.tetras-libre.fr
PROXY_HOST
=
aquila.tetras-libre.fr
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment