add ipam to repo

This commit is contained in:
mt 2025-02-18 15:47:06 +03:00
commit 7bb8aebb82
6 changed files with 432 additions and 0 deletions

31
000-default.conf Normal file
View File

@ -0,0 +1,31 @@
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RequestHeader set x-forwarded-proto "http"
RequestHeader set x-forwarded-ssl "off"
RequestHeader set Adrian-standard "off"
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM pierrecdn/phpipam:1.5.2
RUN apt-get update && apt-get install php-mysql -y
#COPY --chown=root:root input-files/php.ini /usr/local/etc/php/php.ini
COPY --chown=root:root 000-default.conf /etc/apache2/sites-enabled/000-default.conf
RUN a2enmod headers

92
README.md Normal file
View File

@ -0,0 +1,92 @@
# ipam
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlablex.ibasis.net/simfony/adrian_transition/qa-ops/ipam.git
git branch -M production
git push -uf origin production
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlablex.ibasis.net/simfony/adrian_transition/qa-ops/ipam/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.

197
config.php Normal file
View File

@ -0,0 +1,197 @@
<?php
/**
* database connection details
******************************/
$db['host'] = getenv("MYSQL_ENV_MYSQL_HOST") ?: "mysql";
$db['user'] = getenv("MYSQL_ENV_MYSQL_USER") ?: "root";
$db['pass'] = getenv("MYSQL_ENV_MYSQL_ROOT_PASSWORD");
$db['name'] = getenv("MYSQL_ENV_MYSQL_DB") ?: "phpipam";
$db['port'] = 3306;
$password_file = getenv("MYSQL_ENV_MYSQL_PASSWORD_FILE");
if(file_exists($password_file))
$db['pass'] = preg_replace("/\s+/", "", file_get_contents($password_file));
/**
* Database webhost settings
*
* Change this setting if your MySQL database does not run on localhost
* and you want to use the automatic database installation method to
* create a database user for you (which by default is created @localhost)
*
* Set to the hostname or IP address of the webserver, or % to allow all
******************************/
$db['webhost'] = '';
/**
* SSL options for MySQL
*
See http://php.net/manual/en/ref.pdo-mysql.php
https://dev.mysql.com/doc/refman/5.7/en/ssl-options.html
Please update these settings before setting 'ssl' to true.
All settings can be commented out or set to NULL if not needed
php 5.3.7 required
******************************/
$db['ssl'] = false; // true/false, enable or disable SSL as a whole
$db['ssl_key'] = '/path/to/cert.key'; // path to an SSL key file. Only makes sense combined with ssl_cert
$db['ssl_cert'] = '/path/to/cert.crt'; // path to an SSL certificate file. Only makes sense combined with ssl_key
$db['ssl_ca'] = '/path/to/ca.crt'; // path to a file containing SSL CA certs
$db['ssl_capath'] = '/path/to/ca_certs'; // path to a directory containing CA certs
$db['ssl_cipher'] = 'DHE-RSA-AES256-SHA:AES128-SHA'; // one or more SSL Ciphers
$db['ssl_verify'] = 'true'; // Verify Common Name (CN) of server certificate?
/**
* temporary table type to create slave subnets table
* (MEMORY, InnoDB)
******************************/
$db['tmptable_engine_type'] = "MEMORY";
/**
* Mail sending and other parameters for pingCheck and DiscoveryCheck scripts
******************************/
# pingCheck.php script parameters
$config['ping_check_send_mail'] = true; // true/false, send or not mail on ping check
$config['ping_check_method'] = false; // false/ping/pear/fping, reset scan method
# discoveryCheck.php script parameters
$config['discovery_check_send_mail'] = true; // true/false, send or not mail on discovery check
$config['discovery_check_method'] = false; // false/ping/pear/fping, reset scan method
# remove_offline_addresses.php script parameters
$config['removed_addresses_send_mail'] = true; // true/false, send or not mail on pomoving inactive addresses
$config['removed_addresses_timelimit'] = 86400 * 7; // int, after how many seconds of inactivity address will be deleted (7 days)
# resolveIPaddresses.php script parameters
$config['resolve_emptyonly'] = true; // if true it will only update the ones without DNS entry!
$config['resolve_verbose'] = true; // verbose response - prints results, cron will email it to you!
/**
* php debugging on/off
*
* true = SHOW all php errors
* false = HIDE all php errors
******************************/
$debugging = false;
/*
* API Crypt security provider. "mcrypt" or "openssl"
*
* default as of 1.3.2 "openssl"
******************************/
// $api_crypt_encryption_library = "mcrypt";
/**
* Allow API calls over HTTP (security = none)
*
* @var bool
*/
$api_allow_unsafe = true;
/**
* manual set session name for auth
* increases security
* optional
******************************/
$phpsessname = "phpipam";
/**
* Cookie SameSite settings ("None", "Lax"=Default, "Strict")
* - "Strict" increases security
* - "Lax" required for SAML2
* - "None" requires HTTPS
*/
$cookie_samesite = "Lax";
/**
* Session storage - files or database
*
* @var string
*/
$session_storage = "files";
/**
* Path to access phpipam in site URL, http:/url/BASE/
*
* BASE definition should end with a trailing slash "/"
* BASE will be set automatically if not defined. Examples...
*
* If you access the login page at http://phpipam.local/ = define('BASE', getenv("PHPIPAM_BASE"));
* If you access the login page at http://company.website/phpipam/ = define('BASE', "/phpipam/");
* If you access the login page at http://company.website/ipam/ = define('BASE', "/ipam/");
*
******************************/
if(!defined('BASE'))
define('BASE', getenv("PHPIPAM_BASE"));
/**
* Multicast unique mac requirement - section or vlan
******************************/
if(!defined('MCUNIQUE'))
define('MCUNIQUE', "section");
/**
* SAML mappings
******************************/
if(!defined('MAP_SAML_USER'))
define('MAP_SAML_USER', true); // Enable SAML username mapping
if(!defined('SAML_USERNAME'))
define('SAML_USERNAME', 'admin'); // Map SAML to explicit user
/**
* Permit private subpages - private apps under /app/tools/custom/<custom_app_name>/index.php
******************************/
$private_subpages = array();
/**
* Google MAPs API key for locations to display map
*
* Obtain key: Go to your Google Console (https://console.developers.google.com) and enable "Google Maps JavaScript API"
* from overview tab, so go to Credentials tab and make an API key for your project.
******************************/
$gmaps_api_key = getenv("GMAPS_API_KEY") ?: "";
$gmaps_api_geocode_key = getenv("GMAPS_API_GEOCODE_KEY") ?: "";
/**
* proxy connection details
******************************/
$proxy_enabled = false; // Enable/Disable usage of the Proxy server
$proxy_server = 'myproxy.something.com'; // Proxy server FQDN or IP
$proxy_port = '8080'; // Proxy server port
$proxy_user = 'USERNAME'; // Proxy Username
$proxy_pass = 'PASSWORD'; // Proxy Password
$proxy_use_auth = false; // Enable/Disable Proxy authentication
/**
* General tweaks
******************************/
$config['logo_width'] = 220; // logo width
$config['requests_public'] = true; // Show IP request module on login page
$config['split_ip_custom_fields'] = false; // Show custom fields in separate table when editing IP address
/**
* PHP CLI binary for scanning and network discovery.
*
* The default behaviour is to use the system wide default php version symlinked to php in PHP_BINDIR (/usr/bin/php).
* If multiple php versions are present; overide selection with $php_cli_binary.
*/
// $php_cli_binary = '/usr/bin/php7.1';
/**
* Path to mysqldump binary
*
* default: '/usr/bin/mysqldump'
*/
// $mysqldump_cli_binary = '/usr/bin/mysqldump';
$db['webhost'] = '%';

33
docker-compose.yml Normal file
View File

@ -0,0 +1,33 @@
version: '2'
services:
ipam:
image: pierrecdn/phpipam:1.5.2
container_name: ipam
restart: always
environment:
MYSQL_ENV_MYSQL_USER: root
MYSQL_ENV_MYSQL_ROOT_PASSWORD: 'xM9A4!exJbQNhqJ'
MYSQL_ENV_MYSQL_HOST: 172.20.64.140
MYSQL_ENV_MYSQL_DB: 'ipam'
SSL_ENABLED: false
TRUST_X_FORWARDED_HEADERS: true
ports:
- "172.20.64.140:11080:80"
networks:
- portal_qa
volumes:
- ./config.php:/var/www/html/config.php
- ipam_config:/var/www/html
- ./php.ini:/usr/local/etc/php/php.ini
build: /app/deployments/ipam
volumes:
ipam_config:
driver: local
driver_opts:
type: none
device: /data/container_volumes/ipam_config
o: bind
networks:
portal_qa:
external: true

72
php.ini Normal file
View File

@ -0,0 +1,72 @@
[PHP]
engine = On
short_open_tag = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
serialize_precision = 17
zend.enable_gc = On
expose_php = Off
max_execution_time = 600
max_input_time = 60
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
log_errors = On
log_errors_max_len = 1024
default_mimetype = "text/html"
default_charset = "UTF-8"
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
memory_limit = 2048M
[Date]
date.timezone = "UTC"
[mail function]
smtp_port = 25
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[Session]
session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[ldap]
ldap.max_links = -1