Skip to content

Commit

Permalink
Merge pull request #41 from mikedep333/proxies_and_custom_ports
Browse files Browse the repository at this point in the history
Proxies and custom ports
  • Loading branch information
mikedep333 authored Oct 29, 2021
2 parents f7a47fb + 202aea8 commit d2a6ef4
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
46 changes: 37 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The SELinux policy for Pulp 3.Y releases.
## Building

```
sudo yum install -y selinux-policy-devel policycoreutils
sudo yum install -y selinux-policy-devel policycoreutils
git clone https://github.com/pulp/pulpcore-selinux
cd pulpcore-selinux
Expand All @@ -17,9 +17,9 @@ make -f /usr/share/selinux/devel/Makefile pulpcore_rhsmcertd.pp
## Installing

```
semodule -i pulpcore_port.pp
semodule -i pulpcore.pp
semodule -i pulpcore_rhsmcertd.pp
sudo semodule -i pulpcore_port.pp
sudo semodule -i pulpcore.pp
sudo semodule -i pulpcore_rhsmcertd.pp
```

## Labeling pulpcore\_port
Expand All @@ -28,20 +28,48 @@ semodule -i pulpcore_rhsmcertd.pp

Apply the `pulpcore_port_t` SELinux type to ports 24816 and 24817 with:

`semanage port -a -t pulpcore_port_t -p tcp 24816-24817`
`sudo semanage port -a -t pulpcore_port_t -p tcp 24816-24817`


## Uninstalling

Uninstall in the following order:

```
semanage port -d -t pulpcore_port_t -p tcp 24816-24817
semodule -r pulpcore_rhsmcertd
semodule -r pulpcore
semodule -r pulpcore_port
sudo semanage port -d -t pulpcore_port_t -p tcp 24816-24817
sudo semodule -r pulpcore_rhsmcertd
sudo semodule -r pulpcore
sudo semodule -r pulpcore_port
```

# Additional configuration

## Adding support for remote repos running on custom ports

**Optional** By default, pulp is allowed to connect to web servers running on several standard or semi-standard ports: `80, 81, 443, 488, 8008, 8009, 8443, 9000`.

If any of the remote repos you are trying to connect to are hosted on non-standard
HTTP/HTTPS ports, you can configure Pulp to be able to talk to them like in the following example
for port `10011`.

`sudo semanage port -a -t http_port_t -p tcp 10011`

## Adding support for proxy servers running on custom ports

**Optional** By default, pulp is allowed to connect to web proxy servers on several standard or semi-standard ports: `3128, 3401, 4827, 8080, 8118, 8123, 10001-10010`.

If Pulp is configured to use a proxy server (in order to talk to remote repos), but the proxy
server is on a non-standard port, you can configure Pulp to be able to talk to them like in the
following example for port `10012`.

`sudo semanage port -a -t http_cache_port_t -p tcp 10012`

**NOTE**: Technically Pulp can talk to any remote repo or proxy server running on any SELinux-recognized
ports for web servers or for proxy servers. (They are effectively one cumulative list.)

**NOTE**: To see the complete list of these ports currently recognized on your system, run:
`sudo semanage port -l | grep -E "^http_port_t|^http_cache_port_t|^squid_port_t" | grep tcp`

# Development

## Release Process
Expand Down
4 changes: 3 additions & 1 deletion pulpcore.te
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
policy_module(pulpcore, 1.2.6)
policy_module(pulpcore, 1.2.7)

require {
type httpd_config_t;
Expand Down Expand Up @@ -142,11 +142,13 @@ corecmd_exec_bin(pulpcore_server_t)
corecmd_exec_shell(pulpcore_server_t)

# mongod for pulp-2to3-migration plugin
corenet_tcp_connect_http_cache_port(pulpcore_t)
corenet_tcp_connect_http_port(pulpcore_t)
corenet_tcp_connect_mongod_port(pulpcore_t)
corenet_tcp_connect_postgresql_port(pulpcore_t)
corenet_tcp_connect_pulpcore_port(pulpcore_t)
corenet_tcp_connect_redis_port(pulpcore_t)
corenet_tcp_connect_squid_port(pulpcore_t)
corenet_tcp_bind_pulpcore_port(pulpcore_server_t)
corenet_tcp_connect_http_port(pulpcore_server_t)
corenet_tcp_connect_mongod_port(pulpcore_server_t)
Expand Down
2 changes: 1 addition & 1 deletion pulpcore_port.te
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
policy_module(pulpcore_port, 1.2.6)
policy_module(pulpcore_port, 1.2.7)

gen_require(`
attribute port_type;
Expand Down
2 changes: 1 addition & 1 deletion pulpcore_rhsmcertd.te
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
policy_module(pulpcore_rhsmcertd, 1.2.6)
policy_module(pulpcore_rhsmcertd, 1.2.7)

gen_require(`
type pulpcore_server_t, rhsmcertd_config_t;
Expand Down

0 comments on commit d2a6ef4

Please sign in to comment.