PB 1.1.1 pi not redirecting traffic

Posted by LeanMeSilly 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
PB 1.1.1 pi not redirecting traffic
December 16, 2016 03:46PM
The traffic is not been redirected on the pi, I can go to the domain but I its not been redircted and I changed the doamin and its not working its still going back to piratebox whats now pissing me off since I did this very same steps to do it before and it changed it, but not its not and I shutdown -r twice and the device comes back online fine.

Why are you making ti so hard to remove the priatebox branding from this.

I need vhost, redirecting all traffic if there is no vhost, and a means to update stuff without having to restart the device, there is some pages I see or settings cashed if not then there is something strange going on, I edit the html files and it does nothing until I restart the device.

I want to create other folders and there not working eva there redirect to /content don't want this I want to be incontroll ov the content please.

I have read all your posts about it and they all keep changing from version now I bloody stuck.
Re: PB 1.1.1 pi not redirecting traffic
December 16, 2016 04:39PM
Another problem is it seems to be redircting back to www_content content rather the then shared content whats on the USB I getting really fked off now I followed all the tuts and it all leads back to this, why is there even need for another www root, why is there need for any of this your making it more complex then it needs to be.
Re: PB 1.1.1 pi not redirecting traffic
December 20, 2016 08:45PM
Just not true.

The content folder is made for noobs like you... It is moved to the shared folder on OpenWrt and similiar on RPi devices, if it is configured to use an USB stick. So you can just take the content folder to your computer and edit it without the need of learning the command line.
The folder www_content is the *source* for the one in the shared subfolder. Everytime you remove the content folder, it is recreated until you empty it out or disable the configuration option in conf/piratebox.conf. (Config option is in the next version).

Yes, there are multiple points to remove the brand, but it comes to only a few occurencies:

- Change hostname
- Change SSID
- Adjust the Directory listing *source files* in opt/piratebox/src (HEADER.TXT: README.TXT)
- Make you adjustments in your copy of content in share/content

Sorry, I am really pissed, because since the beginning I try to keep it modular as possible. I have drop-in replacements for start & stop scripts, which nobody uses...

If you have good technical ideas to make it better, let us all know.

Matthias


This is only my signature.
Re: PB 1.1.1 pi not redirecting traffic
December 23, 2016 01:01PM
My point is I changed all them and it still messing up, is there away to remove the redirect and recreation full stop?
I read throw the conf files and none said anything about removing these options.

Your path to make it N00B proof as in some places make it more complex, it redirects back to piratebox.lan even when you have edited the files all the tuts on here show you, it will go to the new domain if you enter it, but if you go to another domain it will still go to piratebox, I liked PB's set up part from this really, I been able to install and set up everything on the pi manualy part from the fake DNS and domain name what I would love,

Sorry if you think I am a foolish NOOB but before I posted ONCE I followed tut's and and I reinstalled and tried many ways to make sure I was not at fault here, documentation on all this lacking and I understand it was made to fit one need, but I don't understand why the hold thing wants to revert all the time.

- Change hostname , Changed how all the tuts on here say but revierts all the time not sure why
- Change SSID Changed
- Adjust the Directory listing *source files* in opt/piratebox/src (HEADER.TXT: README.TXT), did this but it bugged out and would no longer let any links work it always redrected.
- Make you adjustments in your copy of content in share/content I took ownership of the folders so a USB drive was not needed, the end project wouldn't have the USB, eathernet or GPI ports anymore to cut down on size and the housing used in the project.

Since you already lock the folders on the main sd card, I don't see the need for all the redircts or the fact for it to replace all the time, there are many good move commands in Linux what could be used for the first time move of the files to the USB.

The Web host side is VERY confusing and makes no sense, I been dealing with web hosting for about 10 years on both platforms and this is the only one that's ever confused the hell out of me, I can't even follow the default setting for that hosting platform as you edited enough for it to make no sense to every other source online.

Once again I can see this is to create one fix need but its locking out so many good ideas for the IMG, I not going to stop learning or following the project but in places it does become over complex.

Maybe make the hosting side a little more like any other hosting platform so people don't have to edit this and that then another then another, this is poinless, to make it stream line and useful and N00B friendly it should have a basic config for it all/

What I think you should do, now you include php enable this by default, and use a config file outside the main www folder, remove any need for the www content folder at all, you can move the www to a usb and use a symbolic link or just change the path address in the host platform, this means you can use one domain name setting in the config file and using php can include all changes across all the pages you include the redirects, but using php should also remove the need for redirects on the uploader and things like this.

At the moment PB is epic, And I didn't have this much trouble with the older versions before 1.1 but I understand you have to tweak and edit things but i really do belieave in your path to make things better you making it more complex then it needs to be.

I understand that you might not agree with me, but you state you want to make it n00b friendly and I am a n00b to this, well it's not n00b friendly, it was much easier for me to set up a basic rasbin image and install php, dns, hostapd,(host I opted for apatch),

I am missing the fake domain, the dns redirect and so on, I still like the smaller footprint of PB, and the simple set up at the start, the project I want it for is for n00bs even more simple then me, they need to be able to upload my php framework, and deploy it.

PB offered the basics what I wanted at the start, board, chat, upload, home page, but when the home page was over riding my work all the time no matter what, even when I edited both www n www content including all other files you said, I went very blue in the face,
Since i wanted to add options of the users to be able to upload there own project sites/pages/blogs so on, I created a directroy system also but even putting a new folder /test/index.php no matter where it was passed would flash the page and take it back to the main piratebox.lan, got do made I even deleted every redirect and it just got stuck in a loop, I even removed the 404 in the config file no look.

I downloaded that image more then once also.


I am a n00b I agree and I didn't mean any disrespect at all with ANY of my posts, but I am not stupid and I know how to follow basic tuts online, and I know new versions means new tweaks so I made sure I followed a good few, but seems I failed at all paths.

If you could help making your mini host work like a normal mini host I be happy and be back on PB asap, if you can't maybe tips on how to get the domain and dns to work on a normal rasbin OS?

Thanks, and sorry if you feet I was disrepecting the project.
Re: PB 1.1.1 pi not redirecting traffic
December 27, 2016 07:21AM
Ok, let me start with something less technical.
First of all, I want to apologize for insulting & being unprofessional with you. When I read you post above, you hit me on the right toe at the right mood and point in time. So, please excuse me.

Quote

My point is I changed all them and it still messing up, is there away to remove the redirect and recreation full stop?
Then something must be missing. Remember, there are a lots of places where the browser cache is playing tricks! Assuming that there is no bug with copying the content folder, you have the following places where the hostname is relevant:

- /opt/piratebox/www/index.html
- /opt/piratebox/www/redirect.html
- /opt/piratebox/www_content/index.html (only the iframe)

I used
grep piratebox.lan /opt/piratebox/ -R
to find the occurrences in the source.

Yes you can disable the redirect, with puuting a # in /opt/piratebox/conf/lighttpd/lighttpd.con in front of the line
server.error-handler-404 = "/redirect.html"

Quote

Your path to make it N00B proof as in some places make it more complex, it redirects back to piratebox.lan even when you have edited the files all the tuts on here show you, it will go to the new domain if you enter it, but if you go to another domain it will still go to piratebox, I liked PB's set up part from this really, I been able to install and set up everything on the pi manually part from the fake DNS and domain name what I would love,
As I said, you might be tricked by your browser cache. It is possible that the change hostname option of the install_piratebox.sh has a bug and does not update the index.html (which are linked together via the filesystem). You might check www/index.html and redirect.html if both contain your new domain name after the usage of the install_piratebox.sh hostname option. If index.html is not updated in the same step, please open an issue on [github.com] including a copy&paste of the steps you did and a copy of the two files (copy & paste is enough).

I think, that you misunderstand how the PirateBox work:

- The DNS redirect does only resolve all dns requests with the local IP address of the box. There is no change in the requested hostname.
- The DNS redirect is supported by a firewall rule, which redirects other requested DNS Servers to the local machine (like a static entry of googles DNS Server 8.8.8.8)
- The 404 error handler and the default domain index page ./index.html are forwarding to the displayed domain into the /content folder. The 404 handler is playing tricks with you, when you do a mistake in your website editing! This behavior might be changed if we make the 404 handler only active for hostnames un-equal your box name (good idea, I'll take a note of that one).
- The webserver has additional configurations to create fake answers to mobile clients on Android and iOS, which unlock the normal browser (especially on iOS, which drops to mobile network if the wifi is not sufficient)

If there are points in the configuration, which do revert back with every reboot, something is going totally wrong.

Quote

The Web host side is VERY confusing and makes no sense, I been dealing with web hosting for about 10 years on both platforms and this is the only one that's ever confused the hell out of me, I can't even follow the default setting for that hosting platform as you edited enough for it to make no sense to every other source online.

Once again I can see this is to create one fix need but its locking out so many good ideas for the IMG, I not going to stop learning or following the project but in places it does become over complex.
I see you point, but I can also see, that you only see the top of the ice.

Let me explain why it is designed as it is and how it changed over time:

When I joined into the project back in Jan 2011, David has only a small howto of 20 single commands to setup a PirateBox out of an OpenWrt router together with a Seagate dockstar. A lot of people showed interest and it grew popularity quickly. It also was pretty clear, that the main audience is not a hacker but people with less or no skill.
In summer 2011, a German hacker made a new version which integrated the dockstar together with the OpenWrt. This solution was a hardly hacked version which enables OpenWrt based routers with only 4MB(or 8Mcool smiley flash disk to run PirateBox... which is nearly nothing in terms of an operating system.
At this time, I already created a bundle of scripts designed to run on Debian and bring the same functionality to notebooks but not as an invasive change. My focus was and is to create a set of scripts, which are beside the system's configuration- the that you can turn on & off piratebox on you notebook, if you need it.
The hacker dropped the project pretty quickly and based on this hack a lot of people ran into A LOT OF issues. So I took over the stuff around Jan 2012 and started to merge both worlds to the same code base.
Later the first RaspberryPi came out and beside of maintaining & improving the OpenWrt part, I needed to get something working on the RPi.. It was never 100 % perfect (below more).

Today, everything in opt/piratebox are 95% identical between both plattforms. Over the years, I aligned the OpenWrt packages to work like a normal OpenWrt package and do not work with ugly package management hacks. The installation problems are dropped to an absolute minimum and the installation is as easy as never been before. The differences are mostly file structure and network/wifi configuration (in OpenWrt done by OS). Everything about using the box and alot of the customizing should be the same.
But, due to the fact, that on OpenWrt is literately no space for anything, it is needed to move a lot of things to different places. The folder "share" is designed to be located directly on a FAT32 USB Stick. This is why "Shared" and "board" inside www are pointed to that folder with hard symbolic links. On OpenWrt, nearly all content is located on the USB stick.. but not only because of space, but it is the most comfortable way for all the non technicians to add/remove content on the box.
Not only the disk space is limited on these small devices. We are talking about CPUs running at 400MHz. This is the reason why I and other put effort in it to avoid dynamic rendered pages. For example "dokuwiki" would do an amazing job for having a dynamic web page to add you content... but it consumes too much power.
So, This is the reason why we do not have a directory listing like h5ai, but this text base version with HEADER.txt and README.txt (in fact you need to adjust the src folder and then remove both files from you shared folder, or run a script to force an overwrite). I still have the fear not being able to run at those tiny device because of a too complex script.

The next big question is about that nasty iframe for the upload. Why do we use it? Because in summary a PHP upload script does not run 100% well on these devices. On lighttpd, the following thing is happening during a file upload:

  Browser - uploads ---> Lighttpd ; Caches the complete file (on UScool smiley
  if file complete,   lighttpd --- transfers via IO read  --> CGI 
  CGI receives ---> writes to disk (on UScool smiley
So, the system ends up with twice or triple IO for reading/writing the uploaded file on the same device, while droopy just places the file directly in the upload folder while getting the data over network.

I started to work on a PHP uploader, which uses the /tmp folder (RAM) on OpenWrt, but this always have the risk of crashing the operating system because of OOM.

Quote

this means you can use one domain name setting in the config file and using php can include all changes across all the pages you include the redirects, but using php should also remove the need for redirects on the uploader and things like this.
As described above, PHP does not solve all the problems. I want to avoid dynamically pages as much as possible to keep it as fast as possible. Adjusting the webpage for customizing is done only by one person (at the creation)... but showing the content is done by each page access. So, we should try to save as much CPU cycles as possible, which means no PHP entry page. Especially not for the redirect, because this is hit far more often.

As much as I decrease the static pre-configuration, I increase the load on the CPU. This creates trouble for the smaller devices and consumes battery for the larger ones. I know, that it is not the easiest options.

Beside of the resource related part of the design choices, there are also much lines of code, which simply avoid pitfalls. There are a pile of things which make the installation as simple as possible.. but we never intended and will never intend to remove the need of the CLI completely. The reason why is, that people should start to learn with it. In fact, this is one of the feedback we always get: "Yes, with PirateBox I started to learn the command line".

Things, which look awkward, but we did to support noobs:

- HEADER.txt and README.txt are always copied if missing. This avoids the issue if somebody deletes it on the USB and directory listing does not work anymore.
- A copy of the content folder is located on the USB stick to enable easier editing of your website on you local PC. This worked out for LibraryBox (sister project) pretty well. Before anybody needs to reflash his box, just remove the folder from your USB stick and you get a fresh copy.
- (OpenWrt) completely automagic installation and with 1.1 auto-reflash
- A lot of helper scripts which avoid using vi (mostly helpful on OpenWrt)

Today, I am glad that some other developers (stylesuxx & TheExpertNoob) joined in working for the RPi. Both sharpened the image for the RPi and the main functions are pretty well done. We are carrying around some legacy stuff, that is true and I am aware of that. For example, I already started to modularize the lighttpd configuration.
It is planned to ship PirateBox 1.2 with a pre-activated PHP if are sure to not open up security issues with that. We want to include h5ai directory listing as an option with 1.2, too.

For the RPi image, we chose Archlinux, because there is a ton of wiki documentation on their webpage. In addition, Archlinux has a very small footprint compared to the newer raspbian OS images which come with a desktop pre-installed :-(

I am working on several things (like lifting PirateBox to a newer OpenWrt version). In fact, it feels like sometimes, I am the only one pushing the project and answering questions. This also means a low motivation for pushing after 6 years now and my piratebox free time is split up between "answering forum", "documenting" or "writing code". Mostly I am answering questions...
---

According to your issues, as I said, it sounds to me, there is a bug with the content folder, which should not be.
About your question for the DNS redirect thing
   dns_redirect="/#/192.168.1.1"

Cheers
Matthias


This is only my signature.
Hey, I forgot my password at the mo,, will sort this later, I love your reply and the history behind the changes, I will be looking at this again so I make sure i have the coffee pot on and go throw each section, yes I can see the problems around the more bigger options like PHP and file storage on smaller devices.

I have tried to mimic the set up on my Pi so far with dnsmasq and hostapd, apache2 and php, what seems to mimic it as well as it can, I liked PB over what I have for the fact of the OS footprint is much smaller, I using rasbin as a base so its got alot of things not needed.

I will keep reading in to this more and see if I can do what I want again with the PB, it does not offer PHP like I wanted it but it offers everything else I needed, I will redo it all from scratch again, like I said I not going to stop following this project, I think little nodes/networks box's like this are more needed now then ever.

I am dyslexic so when I ask things or try and explain things I can come across like a tit lol so don't worry about it I found your posts more informative then anything, and seeing the path its all gone I understand its limitions,

One thing I would like is maybe a way to drop one hosting platform for our own on more powerful devices, and I not saying you should do this, its about all of us hacking the world lol, and if there is a easy nice simple way to do it and I find it out I will be posting it here.

are the html files premade in the img? as that might be first step edit them files and then editing the install script to all match a custom domain, the way I do it is I don't redirct the server or anything on the dns side so it all points to my http server and vhost catchs to see if the domain is part of its list if not it defaults what I hope to add a redrict like yours to a default name in the vhost.

I guess I have the libity to use more resoures, doing this on the pi v1 was much more slow and locked up at times but with the pi 3 I able to do much more, I know I should still use the less is more ideal but the system I want is a mini node with mesh what will then help a small group of users to have there node with there network basics like a node forum, chat, file share, the basics what PB has but then be able to expsand on that with there own node services, I need to look in to mesh next what scares the living hell out of me as I not getting ANY good or useful infomation in the last few years since p2p or meshnet as become a taboo in many peoples eyes since it is harder to monitor.
Re: PB 1.1.1 pi not redirecting traffic
January 03, 2017 08:13PM
Quote

One thing I would like is maybe a way to drop one hosting platform for our own on more powerful devices, and I not saying you should do this, its about all of us hacking the world lol, and if there is a easy nice simple way to do it and I find it out I will be posting it here.
true story.

Quote

are the html files premade in the img? as that might be first step edit them files and then editing the install script to all match a custom domain, the way I do it is I don't redirct the server or anything on the dns side so it all points to my http server and vhost catchs to see if the domain is part of its list if not it defaults what I hope to add a redrict like yours to a default name in the vhost.
99% of the configuration is pre-made. I think only the content of the shoutbox is only generated during bootup.

Quote

I need to look in to mesh next what scares the living hell out of me as I not getting ANY good or useful infomation in the last few years since p2p or meshnet as become a taboo in many peoples eyes since it is harder to monitor.
The first basic information can be found here:
Mesh network - Wikipedia
Wireless mesh network - Wikipedia
How Wireless Mesh Networks Work - howstuffworks.com

The question about protocol is depending on you favors. It is also relevant what you want to do with it.
For RPi you should consider using two wifi adapters because most USB adapters can not run AP mode and P2P mode at the same time.

The Mesh-Network is more like a mind set (no switching, no cables) everything else is technical details.

best regards Matthias
What my aim is, is to set up a small node with all basic website portals preset, for board, chat, file share, and then enable the node owner to enable or disable custom sites for node users.

The basics of all this works since I doing most of it via php, not hard to get that basic framework.

I am using the Pi 3 so I have one wifi card already, what I was thinking of is setting them up to mesh network so other nodes could take and pass traffic along each other, I know this is a more complex task then setting up one little local node what spits out the websites for a few users.

My problem is one dns making sure all nodes don't get confused with one owner using a IP already set up, there be no centarl server, then, having a way to stop domain names mixing, maybe only letting a subdomain be searchable over the mesh so the main node would be nodename.ltd at the moment I have system.node/chat.node and the redirect welcome.node all working find and dandy.

on a single host, I having a problem redircting https traffic and also problem with fake internet connection so modden PC's and phones wont auto connect even tho the nodes are password protected.

We shouldn't have to set things up like this anymore but sadly we do.

Any problem from this point would be making sure traffic was encrypted or protected, I don't understand https much and I am not sure if that would be the best means to protect the traffic from in the middle attacks, One idea was to use client and server side keys but problem here is every day joy wont be able to access it and I can only basic program on windows so ya making a client would be hell for me.

Put the point of the device is a network that does NOT track your every move, apache2 as been set to log nothing same as php, or will in the end I need logs and errors at the moment.

I hope to not store even look for mac address linked to IP's thinks like this, so no trace of the user from the node, another problem is fake nodes not sure how to make it so people will be able to know if the nodes are really trying to track them.

Another reason PB was a better option from me as some annonamity was already done.

At the moment a basic pi3 with a basic but fill linux OS is doing better for me, harder more confusing, and PB is helping me keep a sign on my goals.

The Pi3 in the long run might be the wrong option, tho power is low and resources are good, I don't know I hit a wall at the moment wil it smiling smiley hope to get myself out of this root.
Hi,

I have this same problem, I have changed piratebox.lan/content my url in /opt/piratebox/www/index.html and /opt/piratebox/www/redirect.html but it does not work - the browser gets stuck reloading the page constantly. I've had this problem before and managed to fluke a fix, but now I can't find it again...

Help...

Dave
Re: PB 1.1.1 pi not redirecting traffic
April 11, 2017 07:33PM
Quote

I have this same problem, I have changed piratebox.lan/content my url in /opt/piratebox/www/index.html and /opt/piratebox/www/redirect.html but it does not work - the browser gets stuck reloading the page constantly. I've had this problem before and managed to fluke a fix, but now I can't find it again...
Remove the content folder on the USB stick and fix your URL on /opt/piratebox/www/index.html
The content folder will be placed again on the USB stick during bootup smiling smiley

best regards
Matthias
Thanks Matthias,

I ran

/opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf hostname myname.lan

then changed piratebox.lan/content in both

/opt/piratebox/www/index.html and /opt/piratebox/www/redirect.html

to myname.lan/content

and it seemed to work - thanks for your helpsmiling smiley

Dave