⬆️ ⬇️

We assemble superbmord by means of lighttpd 1.4.x

To writing this habratopic, I was inspired by this post .



So, we need to get access to all home devices with webmords, for example, from work from the corporate network, where access is allowed only to the standard port 80, let it be a WEB camera (10.0.1.3), a webmord geexbox (10.0.1.4) and an ADSL router through which we get IPTV (10.0.1.5:8080).



What we have:

Server with lighttpd in a data center located somewhere far away from our house.

A small lokalka covering the entire apartment with Cisco 8xx on the border and a static external IP (62.213.122.2).



Stage one - we bring our webmoney behind NAT.

')

We go to our router and in the configuration terminal we type approximately the following:



ip nat inside source static tcp 10.0.1.3 80 interface Virtual-PPP1 8081

ip nat inside source static tcp 10.0.1.4 80 interface Virtual-PPP1 8082

ip nat inside source static tcp 10.0.1.5 8080 interface Virtual-PPP1 8083




The command format is “ip nat inside source static <protocol> <Internal IP> <port> interface <external interface of the router> <external port>”



Now you can go to the second stage - setting up lighttpd.



Stage two - lighttpd setup.



To make our cunning plan a reality, we need mod_proxy from the standard lighttpd delivery. Add it to server.modules:



server.modules = (

"mod_access",

"mod_accesslog",

"mod_proxy"

)



And let's proceed to setting up our virtualhost:



$HTTP["host"] =~ "(^|\.)cam\.habrahabr\.ru$" { #

proxy.server = ("" => ( ( #

"host" => "62.213.122.2", # IP

"port" => 8081 ) ) ) #

accesslog.filename = "/var/log/lighttpd/camera.log" #

}



$HTTP["host"] =~ "(^|\.)geexbox\.habrahabr\.ru$" {

proxy.server = ("" => ( (

"host" => "62.213.122.2",

"port" => 8082 ) ) )

accesslog.filename = "/var/log/lighttpd/geexbox.log"

}



$HTTP["host"] =~ "(^|\.)adsl\.habrahabr\.ru$" {

proxy.server = ("" => ( (

"host" => "62.213.122.2",

"port" => 8083 ) ) )

accesslog.filename = "/var/log/lighttpd/adsl.log"

}





restart lighttpd and enjoy =)

service lighttpd restart

Source: https://habr.com/ru/post/69928/



All Articles