debian-pi / raspbian-ua-netinst

Raspbian (minimal) unattended netinstaller
Other
1.17k stars 153 forks source link

Can I specify a proxy? #15

Closed GlowTube closed 6 years ago

GlowTube commented 10 years ago

Trying to install jessie via ua-netinst... but I am behind a firewall and must specify an http proxy for external access. Is there an option in installer-config.txt for this?

At the moment I get

E: Unknown suite jessie

but I suspect this is due to lack of external access, as folks have commented that jessie has been installed successfully via this method before. Thanks!

hifi commented 10 years ago

You might be able to export some env variables in installer config (as it's a shell script) to enable HTTP proxy. You'd need to see if cdebootstrap has any support for proxies and/or the wget implementation of busybox. I don't know as I've never had the need for it.

On a whim google suggests that if you export the environment variable 'http_proxy' with the URL of your proxy (http://host:port/) it might or might not work.

diederikdehaas commented 10 years ago

If you insert the following lines between 'echo "Starting install process..."' and 'cdebootstrap-static --arch=armhf ...' in scripts/etc/init.d/rcS http_proxy=your_proxy_url:port export http_proxy

And recreate the image, then it should work. I've created a bit more elaborate solution here: https://github.com/diederikdehaas/raspbian-ua-netinst/commit/22475c51037afc23e7af4390cd2bbf97112b074a (which I'll probably offer as a pull request later)

diederikdehaas commented 10 years ago

I just verified hifi's suggestion and adding those 2 lines to installer-config.txt does the trick :-) So there's no need to modify scripts/etc/init.d/rcS and recreating the image.

diederikdehaas commented 10 years ago

@GlowTube Does adding the following lines to installer-config.txt

http_proxy=http://proxy-server:proxy-port/
export http_proxy

fix the issue for you?

bennettp123 commented 9 years ago

@diederikdehaas Worked fine for me. Thanks for your testing. :)

Mausy5043 commented 8 years ago

@diederikdehaas I've prepared PR #345 in the hopes of closing this issue.

Gurr3 commented 8 years ago

My code from installer-config

customproxy=proxyuser:proxypass@proxyserver:proxyport/
export http_proxy=http://$customproxy
export ftp_proxy=http://$customproxy
export https_proxy=https://$customproxy

which is then echoed into places in post-install

echo "http_proxy=http://$customproxy; export http_proxy" >> /rootfs/etc/bash.bashrc
echo "ftp_proxy=http://$customproxy; export ftp_proxy" >> /rootfs/etc/bash.bashrc
echo "https_proxy=https://$customproxy; export https_proxy" >> /rootfs/etc/bash.bashrc

echo "Acquire::http:Proxy \"http://"$customproxy"\";" >> /rootfs/etc/apt/apt.conf.d/50apt-proxy
echo "Acquire::https:Proxy \"https://"$customproxy"\";" >> /rootfs/etc/apt/apt.conf.d/50apt-proxy
echo "Acquire::ftp:Proxy \"http://"$customproxy"\";" >> /rootfs/etc/apt/apt.conf.d/50apt-proxy

its also included in rc.local to allow some automatic setup on first boot.

Note that using a password with special characters eg ( or space are required to be url encoded (%28, %20) with this solution

Mausy5043 commented 8 years ago

:+1:

Have you tested this? Does the installer run from behind the proxy? The reason I ask is that you seem to modify the installed system. So, I'm wondering how the installer would behave.

Gurr3 commented 8 years ago

Yes its tested, the installer runs with the changes made in installer-config, eg. export http_proxy=....

The post-install parts is just to carry over into the installed system so it doesn't need to be reconfigured or updated later.

Mausy5043 commented 8 years ago

:cool: :+1:

diederikdehaas commented 8 years ago

Thanks @Gurr3 :+1: Just one question:

export ftp_proxy=http://$customproxy

Why does the ftp proxy start with http?

Gurr3 commented 8 years ago

afaik the protocol specified is what you use to communicate with the proxy, eg. you're not ftp'ing the proxy. This seems consistent with the arch wiki scripts, and looking at them the https_proxy should maybe be http:// as well :confused:

diederikdehaas commented 8 years ago

You're right and it makes sense ... in a way.

OTOH, I still find all the protocol switching odd. Those different protocols were made for a reason. Also, in the case of https, it also places a lot of trust on the connection to the proxy (if that is over http). While your browser indicates you're using a secure channel so it's safe to provide your username and password, those will be send in the clear to the proxy. Or I have just shown my lack of familiarity with proxies :wink:

diederikdehaas commented 8 years ago

@Mausy5043 what's the reason this issue is added to the v1.1.0 milestone?

Milestones indicate that those issues need to be resolved before it gets released ... and I don't consider this item important for it.

Mausy5043 commented 8 years ago

Based on Gurr3's comments I was under the impression that this could be fixed in v1.1.x. If you think it's more work than I expected feel free to change milestone.

goranche commented 8 years ago

defining milestones is not about how much work it's supposed (/expected) to take

Mausy5043 commented 6 years ago

Current proxy support is not going to change unless someone can provide a working and tested PR.

Closing this issue. If you feel the closure is in error, please feel free to re-open and add new information.