Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nest
Puppet
Commits
3d6ba47e
Commit
3d6ba47e
authored
Nov 28, 2020
by
James T. Lee
Browse files
gitlab: Add port forwarding for its SSH service
parent
b68eb351
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
0 deletions
+89
-0
manifests/lib/port_forward.pp
manifests/lib/port_forward.pp
+80
-0
manifests/service/gitlab.pp
manifests/service/gitlab.pp
+9
-0
No files found.
manifests/lib/port_forward.pp
0 → 100644
View file @
3d6ba47e
define
nest::lib::port_forward
(
Stdlib
::
Port
$port
,
Enum
[
'tcp'
,
'udp'
]
$proto
,
Optional
[
Stdlib
::
IP
::
Address
::
V4
]
$source_ip4
,
Optional
[
Stdlib
::
IP
::
Address
::
V4
]
$destination_ip4
,
Optional
[
Stdlib
::
IP
::
Address
::
V6
]
$source_ip6
,
Optional
[
Stdlib
::
IP
::
Address
::
V6
]
$destination_ip6
,
)
{
if
$source_ip4
and
$destination_ip4
{
firewall
{
default
:
provider
=>
iptables
,
;
"100
${name}
dnat (v4)"
:
table
=>
nat
,
chain
=>
'PREROUTING'
,
destination
=>
$source_ip4
,
proto
=>
$proto
,
dport
=>
$port
,
jump
=>
'DNAT'
,
todest
=>
$destination_ip4
,
;
"100
${name}
(v4)"
:
chain
=>
'FORWARD'
,
destination
=>
$destination_ip4
,
proto
=>
$proto
,
dport
=>
$port
,
action
=>
accept
,
;
"100
${name}
snat (v4)"
:
table
=>
nat
,
chain
=>
'POSTROUTING'
,
destination
=>
$destination_ip4
,
proto
=>
$proto
,
sport
=>
$port
,
jump
=>
'SNAT'
,
tosource
=>
$source_ip4
,
;
}
}
if
$source_ip6
and
$destination_ip6
{
firewall
{
default
:
provider
=>
ip6tables
,
;
"100
${name}
dnat (v6)"
:
table
=>
nat
,
chain
=>
'PREROUTING'
,
destination
=>
$source_ip6
,
proto
=>
$proto
,
dport
=>
$port
,
jump
=>
'DNAT'
,
todest
=>
$destination_ip6
,
;
"100
${name}
(v6)"
:
chain
=>
'FORWARD'
,
destination
=>
$destination_ip6
,
proto
=>
$proto
,
dport
=>
$port
,
action
=>
accept
,
;
"100
${name}
snat (v6)"
:
table
=>
nat
,
chain
=>
'POSTROUTING'
,
destination
=>
$destination_ip6
,
proto
=>
$proto
,
sport
=>
$port
,
jump
=>
'SNAT'
,
tosource
=>
$source_ip6
,
;
}
}
}
manifests/service/gitlab.pp
View file @
3d6ba47e
...
@@ -53,6 +53,15 @@ class nest::service::gitlab {
...
@@ -53,6 +53,15 @@ class nest::service::gitlab {
provider
=>
ip6tables
,
provider
=>
ip6tables
,
}
}
nest::lib::port_forward
{
'gitlab ssh'
:
port
=>
22
,
proto
=>
tcp
,
source_ip4
=>
'104.156.227.40'
,
destination_ip4
=>
'172.18.0.2'
,
source_ip6
=>
'2001:19f0:300:2005::40'
,
destination_ip6
=>
'fc00:18::2'
,
}
nest::lib::revproxy
{
'gitlab.james.tl'
:
nest::lib::revproxy
{
'gitlab.james.tl'
:
destination
=>
'172.18.0.2'
,
destination
=>
'172.18.0.2'
,
ip
=>
[
'104.156.227.40'
,
'2001:19f0:300:2005::40'
],
ip
=>
[
'104.156.227.40'
,
'2001:19f0:300:2005::40'
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment