Can Install Media be served from the Foreman Server?

Hi,

I'm not at all skilled in how Passenger is handling URLs with Foreman.
What I can gather is that it looks like Passenger is passing all URLs
through to the Foreman App. I would like to setup a URL path like
/media/… on Foreman's Apache server to serve the install medias I need to
supply (and if that works, a repos url as well). Is there a good way to
accomplish this? e.g. just simple apache alias and directory directives,
or does something need to be done with passenger?

I know Katello has the feature set for this, but it's more overhead than
I'm able to provide, and I'm going to be sneaker-netting the media/repo
files to this on a USB hard disk because its in an isolated lab network.
Standing up another server just for static repo/media files doesn't seem
to be an option either.

Thank you kindly for the ideas!

I always mount the iso on /var/lib/foreman/public/<distro>/ or copy the
files in there, they'll be server right from http://<foreman_url>/<distro>

hope it helps

··· On Tuesday, October 27, 2015 at 4:17:29 PM UTC+1, Sean Alderman wrote: > > Hi, > > I'm not at all skilled in how Passenger is handling URLs with Foreman. > What I can gather is that it looks like Passenger is passing all URLs > through to the Foreman App. I would like to setup a URL path like > /media/... on Foreman's Apache server to serve the install medias I need to > supply (and if that works, a repos url as well). Is there a good way to > accomplish this? e.g. just simple apache alias and directory directives, > or does something need to be done with passenger? > > I know Katello has the feature set for this, but it's more overhead than > I'm able to provide, and I'm going to be sneaker-netting the media/repo > files to this on a USB hard disk because its in an isolated lab network. > Standing up another server just for static repo/media files doesn't seem > to be an option either. > > Thank you kindly for the ideas! >

Personally, I'd suggest using a second vhost
(media.myforeman.company.com ?) to host the files on, and CNAME it
back to the foreman IP. Then you don't have to mess with Foreman's
files at all.

However, technically, anything in ~foreman/public/ should be
accessible, for example:

greg@topaz:/usr/share/foreman/public$ sudo mkdir foo
greg@topaz:/usr/share/foreman/public$ echo "<body>Yay</body>" > /tmp/test.html
greg@topaz:/usr/share/foreman/public$ sudo mv /tmp/test.html foo/test.html
greg@topaz:/usr/share/foreman/public$ curl -k https://topaz/foo/test.html
Connection to topaz closed.
[greg:/tmp]$ curl -k https://topaz/foo/test.html
<body>Yay</body>

Hope that helps,
Greg

··· On 27 October 2015 at 15:17, Sean Alderman wrote: > Hi, > > I'm not at all skilled in how Passenger is handling URLs with Foreman. What > I can gather is that it looks like Passenger is passing all URLs through to > the Foreman App. I would like to setup a URL path like /media/... on > Foreman's Apache server to serve the install medias I need to supply (and if > that works, a repos url as well). Is there a good way to accomplish this? > e.g. just simple apache alias and directory directives, or does something > need to be done with passenger? > > I know Katello has the feature set for this, but it's more overhead than I'm > able to provide, and I'm going to be sneaker-netting the media/repo files to > this on a USB hard disk because its in an isolated lab network. Standing up > another server just for static repo/media files doesn't seem to be an option > either.

Hey Greg, thanks for the reply.

That seems to work as long as I have the URL to the file. Along the way I
took care of selinux contexts and directory permissions.

If I try and get a directory index I get a 404. I added
/etc/httpd/conf.d/05-foreman.d/01-build.conf:

<Directory /usr/share/foreman/public/build/media>
Options +Indexes
</Directory>

There are no errors in the Apache logs, so I'm guessing that the above
config is meaningless. From /var/log/foreman/production.log:

2015-10-27 15:09:40 [app] [I]
>
> Started GET "/build/media/scientific/7/x86_64/" for 192.168.1.129 at 2015
-10-27 15:09:40 -0400
2015-10-27 15:09:40 [app] [F]
> ActionController::RoutingError (No route matches [GET]
"/build/media/scientific/7/x86_64"):
> /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/rack/
thread_handler_extension.rb:77:in process_request&#39; &gt; /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:inaccept_and_process_next_request'
>
/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in
main_loop&#39; &gt; /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/ request_handler.rb:441:inblock (3 levels) in start_threads'

If it matters, I'm running Foreman 1.9.2 on Scientific 7.latest. The CNAME
option isn't available, the Foreman Server's getting it's IP from an
upstream DHCP server, so I can't do IP based vhost either.

Anyway, thanks for taking a look. If something else comes to mind, let me
know!

··· On Tuesday, October 27, 2015 at 2:16:51 PM UTC-4, Greg Sutcliffe wrote: > > On 27 October 2015 at 15:17, Sean Alderman > wrote: > > Hi, > > > > I'm not at all skilled in how Passenger is handling URLs with Foreman. > What > > I can gather is that it looks like Passenger is passing all URLs through > to > > the Foreman App. I would like to setup a URL path like /media/... on > > Foreman's Apache server to serve the install medias I need to supply > (and if > > that works, a repos url as well). Is there a good way to accomplish > this? > > e.g. just simple apache alias and directory directives, or does > something > > need to be done with passenger? > > > > I know Katello has the feature set for this, but it's more overhead than > I'm > > able to provide, and I'm going to be sneaker-netting the media/repo > files to > > this on a USB hard disk because its in an isolated lab network. > Standing up > > another server just for static repo/media files doesn't seem to be an > option > > either. > > Personally, I'd suggest using a second vhost > (media.myforeman.company.com ?) to host the files on, and CNAME it > back to the foreman IP. Then you don't have to mess with Foreman's > files at all. > > However, technically, anything in ~foreman/public/ *should* be > accessible, for example: > > greg@topaz:/usr/share/foreman/public$ sudo mkdir foo > greg@topaz:/usr/share/foreman/public$ echo "Yay" > > /tmp/test.html > greg@topaz:/usr/share/foreman/public$ sudo mv /tmp/test.html foo/test.html > greg@topaz:/usr/share/foreman/public$ curl -k https://topaz/foo/test.html > Connection to topaz closed. > [greg:/tmp]$ curl -k https://topaz/foo/test.html > Yay > > Hope that helps, > Greg >

Thank to both of you for the assist. I guess I was hung up on not being
about to view the directory indexes from the browser. Grabbing individual
files seems to work fine, which is good enough for Yum and Provisioning!

··· On Tuesday, October 27, 2015 at 8:03:54 PM UTC-4, Alessandro Vozza wrote: > > I always mount the iso on /var/lib/foreman/public// or copy the > files in there, they'll be server right from http:/// > > hope it helps > > On Tuesday, October 27, 2015 at 4:17:29 PM UTC+1, Sean Alderman wrote: >> >> Hi, >> >> I'm not at all skilled in how Passenger is handling URLs with Foreman. >> What I can gather is that it looks like Passenger is passing all URLs >> through to the Foreman App. I would like to setup a URL path like >> /media/... on Foreman's Apache server to serve the install medias I need to >> supply (and if that works, a repos url as well). Is there a good way to >> accomplish this? e.g. just simple apache alias and directory directives, >> or does something need to be done with passenger? >> >> I know Katello has the feature set for this, but it's more overhead than >> I'm able to provide, and I'm going to be sneaker-netting the media/repo >> files to this on a USB hard disk because its in an isolated lab network. >> Standing up another server just for static repo/media files doesn't seem >> to be an option either. >> >> Thank you kindly for the ideas! >> >

Sorry to dig this old thread of mine up, but I was hoping to recycle the
question about enabling indexes on a directory underneath
/usr/lib/foreman/public.

Now running under Foreman 1.10.2 on Scientific Linux 7.2, I've setup a
directory under /usr/lib/foreman/public, and added a config file under
/etc/httpd/conf.d/foreman.d/ with a Directory Directive for the path, and
an Options +Indexes +FollowSymlinks directive. I've also setup the selinux
context on all the directory and files underneath to foreman_lib_t. Still,
Foreman produces a 404 anytime I hit a directory either with a trailing /
or not. There are no errors in either the foreman_error.log or error_log,
and I have no selinux denied messages when receiving the 404. Is because
the directory in question is nested inside the mod_passenger root, so
mod_autoindex isn't processing the directory handlers?

I realize Greg's suggestion that this isn't a recommended way of doing it,
but for the time being, I have no other options. Just hoping for a hint to
get this config right.

Thanks again!

··· On Thursday, October 29, 2015 at 2:37:40 PM UTC-4, Sean A wrote: > > Thank to both of you for the assist. I guess I was hung up on not being > about to view the directory indexes from the browser. Grabbing individual > files seems to work fine, which is good enough for Yum and Provisioning! > > On Tuesday, October 27, 2015 at 8:03:54 PM UTC-4, Alessandro Vozza wrote: >> >> I always mount the iso on /var/lib/foreman/public// or copy the >> files in there, they'll be server right from http:/// >> >> hope it helps >> >> On Tuesday, October 27, 2015 at 4:17:29 PM UTC+1, Sean Alderman wrote: >>> >>> Hi, >>> >>> I'm not at all skilled in how Passenger is handling URLs with Foreman. >>> What I can gather is that it looks like Passenger is passing all URLs >>> through to the Foreman App. I would like to setup a URL path like >>> /media/... on Foreman's Apache server to serve the install medias I need to >>> supply (and if that works, a repos url as well). Is there a good way to >>> accomplish this? e.g. just simple apache alias and directory directives, >>> or does something need to be done with passenger? >>> >>> I know Katello has the feature set for this, but it's more overhead than >>> I'm able to provide, and I'm going to be sneaker-netting the media/repo >>> files to this on a USB hard disk because its in an isolated lab network. >>> Standing up another server just for static repo/media files doesn't seem >>> to be an option either. >>> >>> Thank you kindly for the ideas! >>> >>