From: Ismaël Bouya Date: Sat, 25 Apr 2020 01:01:39 +0000 (+0200) Subject: Migrate manual scripts from tools.immae.eu X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FConfig%2FNix.git;a=commitdiff_plain;h=251c0a135a4153453030dc0e2c132e57934c0095 Migrate manual scripts from tools.immae.eu Landing page BIP39 ldap/myip scripts webhooks --- diff --git a/modules/private/buildbot/projects/immaeEu/__init__.py b/modules/private/buildbot/projects/immaeEu/__init__.py index ce6cdb1..bb880e5 100644 --- a/modules/private/buildbot/projects/immaeEu/__init__.py +++ b/modules/private/buildbot/projects/immaeEu/__init__.py @@ -15,6 +15,7 @@ class E(): SSH_HOST_KEY = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIFbhFTl2A2RJn5L51yxJM4XfCS2ZaiSX/jo9jFSdghF" XMPP_RECIPIENTS = os.environ["BUILDBOT_XMPP_RECIPIENTS"].split(" ") + BIP39_GIT_URL = "https://git.immae.eu/perso/Immae/Projets/Cryptomonnaies/BIP39.git" IMMAE_EU_GIT_URL = "gitolite@git.immae.eu:perso/Immae/Sites/Blog" RECETTES_GIT_URL = "gitolite@git.immae.eu:perso/Immae/Sites/Recettes" COURS_GIT_URL = "gitolite@git.immae.eu:perso/Immae/Sites/Cours" @@ -23,6 +24,7 @@ class E(): COURS_RELEASE_PATH = "/var/lib/buildbot/outputs/cours" COURS_TARBALL_PATH = "/var/lib/ftp/release.immae.eu/cours" COURS_TARBALL_URL = "https://release.immae.eu/cours" + BIP39_RELEASE_PATH = "/var/lib/buildbot/outputs/bip39" IMMAE_EU_RELEASE_PATH = "/var/lib/buildbot/outputs/immaeEu" RECETTES_RELEASE_PATH = "/var/lib/buildbot/outputs/recettes" NORMALESUP_RELEASE_PATH = "/var/lib/buildbot/outputs/recherche" @@ -66,10 +68,12 @@ def configure(c): c['schedulers'].append(hook_scheduler("Normalesup", timer=1)) c['schedulers'].append(hook_scheduler("Cours", timer=1)) c['schedulers'].append(hook_scheduler("Recettes", timer=1)) + c['schedulers'].append(hook_scheduler("BIP39", timer=1)) c['schedulers'].append(schedulers.Nightly(name="GSMCells-weekly", builderNames=["GSMCells_build"], dayOfWeek=6, hour=3)) c['schedulers'].append(force_scheduler("force_immae_eu", [ - "ImmaeEu_build", "Normalesup_build", "Cours_build", "Recettes_build" + "ImmaeEu_build", "Normalesup_build", "Cours_build", + "Recettes_build", "BIP39_build" ])) c['schedulers'].append(schedulers.ForceScheduler( name="GSMCells-force", label="Force build", @@ -92,19 +96,20 @@ def configure(c): c['builders'].append(cours_factory()) c['builders'].append(gsm_cells_factory()) c['builders'].append(recettes_factory()) + c['builders'].append(bip39_factory()) c['services'].append(SlackStatusPush( name="slack_status_immae_eu_project", builders=[ "ImmaeEu_build", "Normalesup_build", "Cours_build", - "GSMCells_build", "Recettes_build" + "GSMCells_build", "Recettes_build", "BIP39_build" ], serverUrl=open(E.SECRETS_FILE + "/slack_webhook", "r").read().rstrip())) c['services'].append(XMPPStatusPush( name="xmpp_status_immae_eu_project", builders=[ "ImmaeEu_build", "Normalesup_build", "Cours_build", - "GSMCells_build", "Recettes_build" + "GSMCells_build", "Recettes_build", "BIP39_build" ], recipients=E.XMPP_RECIPIENTS, password=open(E.SECRETS_FILE + "/notify_xmpp_password", "r").read().rstrip())) @@ -128,6 +133,23 @@ def recettes_factory(): return util.BuilderConfig(name="Recettes_build", workernames=["generic-worker-immae-eu"], factory=factory) +def bip39_factory(): + path_env = { + "PATH": os.environ["BUILDBOT_PATH_BIP39"] + ":${PATH}" + } + factory = util.BuildFactory() + factory.addStep(steps.Git(logEnviron=False, repourl=E.BIP39_GIT_URL, + submodules=True, mode="full", method="copy")) + factory.addStep(steps.ShellCommand(name="build file", + logEnviron=False, haltOnFailure=True, workdir="source", + env=path_env, command=["python", "compile.py"])) + factory.addStep(steps.FileUpload(name="upload file", workersrc="bip39-standalone.html", + workdir="source", masterdest=E.BIP39_RELEASE_PATH + "/index.html", + url="https://tools.immae.eu/BIP39", mode=0o644)) + factory.addStep(steps.MasterShellCommand(command="chmod -R a+rX {}".format(E.BIP39_RELEASE_PATH))) + + return util.BuilderConfig(name="BIP39_build", workernames=["generic-worker-immae-eu"], factory=factory) + def immae_eu_factory(): path_env = { "PATH": os.environ["BUILDBOT_PATH_ImmaeEu"] + ":${PATH}" diff --git a/modules/private/environment.nix b/modules/private/environment.nix index 01ab967..f7994a1 100644 --- a/modules/private/environment.nix +++ b/modules/private/environment.nix @@ -799,6 +799,7 @@ in description = "Tools configurations"; type = submodule { options = { + contact = mkOption { type = str; description = "Contact e-mail address"; }; davical = mkOption { description = "Davical configuration"; type = submodule { @@ -1012,6 +1013,10 @@ in }; }; }; + webhooks = mkOption { + type = attrsOf str; + description = "Mapping 'name'.php => script for webhooks"; + }; ympd = mkOption { description = "Ympd configuration"; type = submodule { diff --git a/modules/private/websites/tools/tools/default.nix b/modules/private/websites/tools/tools/default.nix index 2fe4775..dbd65e6 100644 --- a/modules/private/websites/tools/tools/default.nix +++ b/modules/private/websites/tools/tools/default.nix @@ -38,6 +38,11 @@ let grocy = pkgs.callPackage ./grocy.nix { inherit (pkgs.webapps) grocy; }; + webhooks = pkgs.callPackage ./webhooks.nix { + env = config.myEnv.tools.webhooks; + }; + + landing = pkgs.callPackage ./landing.nix {}; cfg = config.myServices.websites.tools.tools; pcfg = config.services.phpfpm.pools; @@ -53,7 +58,8 @@ in { ++ shaarli.keys ++ ttrss.keys ++ wallabag.keys - ++ yourls.keys; + ++ yourls.keys + ++ webhooks.keys; services.duplyBackup.profiles = { dokuwiki = dokuwiki.backups; @@ -111,9 +117,16 @@ in { RedirectMatch 301 ^/roundcube(.*)$ https://mail.immae.eu/roundcube$1 RedirectMatch 301 ^/jappix(.*)$ https://im.immae.fr/converse - RewriteEngine On - RewriteCond %{DOCUMENT_ROOT}/homer%{REQUEST_URI} -f - RewriteRule ^(.*)$ /homer$1 [QSA,L] + Alias /landing ${landing} + + DirectoryIndex index.html + AllowOverride None + Require all granted + + + SetHandler "proxy:unix:${pcfg.tools.socket}|fcgi://localhost" + + DirectoryIndex index.php index.htm index.html @@ -122,6 +135,11 @@ in { SetHandler "proxy:unix:${pcfg.tools.socket}|fcgi://localhost" + + RewriteEngine On + RewriteCond ${landing}%{REQUEST_URI} -f + RewriteRule ^(.*)$ /landing/$1 [L] + RewriteRule ^$ /landing/ [L] '' (adminer.apache.vhostConf pcfg.adminer.socket) @@ -143,6 +161,23 @@ in { Require all granted Options -Indexes + + Alias /BIP39 /var/lib/buildbot/outputs/bip39 + + DirectoryIndex index.html + AllowOverride None + Require all granted + + + Alias /webhooks ${config.secrets.location}/webapps/webhooks + + Options -Indexes + Require all granted + AllowOverride None + + SetHandler "proxy:unix:${pcfg.tools.socket}|fcgi://localhost" + + '' ]; }; @@ -253,7 +288,13 @@ in { # Needed to avoid clashes in browser cookies (same domain) "php_value[session.name]" = "ToolsPHPSESSID"; - "php_admin_value[open_basedir]" = "/run/wrappers/bin/sendmail:/var/lib/ftp/tools.immae.eu:/tmp"; + "php_admin_value[open_basedir]" = builtins.concatStringsSep ":" [ + "/run/wrappers/bin/sendmail" "/var/lib/ftp/tools.immae.eu" + landing "/tmp" "${config.secrets.location}/webapps/webhooks" + ]; + }; + phpEnv = { + CONTACT_EMAIL = config.myEnv.tools.contact; }; }; devtools = { diff --git a/modules/private/websites/tools/tools/landing.nix b/modules/private/websites/tools/tools/landing.nix new file mode 100644 index 0000000..ac5c3cf --- /dev/null +++ b/modules/private/websites/tools/tools/landing.nix @@ -0,0 +1,21 @@ +{ stdenv, fetchFromGitHub }: +stdenv.mkDerivation rec { + pname = "homer"; + version = "v1.0"; + src = fetchFromGitHub { + owner = "bastienwirtz"; + repo = "homer"; + rev = version; + sha256 = "0pgpkbqdg4728c8xan5q3lfb8najq118wn2497mc3h0md7l09m63"; + }; + + phases = ["unpackPhase" "installPhase"]; + + installPhase = '' + cp -a . $out + sed -i -e "s/vlayout: true,/vlayout: false,/" $out/app.js + cp ${./landing}/config.yml $out/ + cp ${./landing}/*.php $out/ + cp ${./landing}/icons/* $out/assets/tools/ + ''; +} diff --git a/modules/private/websites/tools/tools/landing/config.yml b/modules/private/websites/tools/tools/landing/config.yml new file mode 100644 index 0000000..42ebcd1 --- /dev/null +++ b/modules/private/websites/tools/tools/landing/config.yml @@ -0,0 +1,210 @@ +--- +# Homepage configuration +# See https://fontawesome.com/icons for icons options + +title: "Websites dashboard" +subtitle: "Immae" +footer: false + +# Optional navbar +# links: [] # Allows for navbar (dark mode, layout, and search) without any links +links: + - name: "status" + icon: "fas fa-desktop" + url: "https://status.immae.eu" + target: '_blank' # optionnal html a tag target attribute + - name: "Change password" + url: "https://tools.immae.eu/ldap_password.php" + target: '_blank' + - name: "Get your IP" + url: "https://tools.immae.eu/myip.php" + target: '_blank' + +# Services +# First level array represent a group. +# Leave only a "items" key if not using group (group name, icon & tagstyle are optional, section separation will not be displayed). +services: + - name: "Tools" + icon: "fas fa-tools" + items: + - name: "Nextcloud" + logo: "assets/tools/nextcloud.png" + url: "https://cloud.immae.eu" + target: '_blank' + - name: "Etherpad" + logo: "assets/tools/etherpad.ico" + url: "https://ether.immae.eu" + target: '_blank' + - name: "Taskweb" + icon: "fas fa-tasks" + url: "https://task.immae.eu/taskweb" + target: '_blank' + - name: "Agenda" + icon: "fas fa-calendar-alt" + url: "https://dav.immae.eu/caldavzap" + target: '_blank' + - name: "Contacts" + icon: "fas fa-address-book" + url: "https://dav.immae.eu/carddavmate" + target: '_blank' + - name: "Kanboard" + logo: "assets/tools/kanboard.png" + url: "https://tools.immae.eu/kanboard" + target: '_blank' + - name: "Dokuwiki" + logo: "assets/tools/dokuwiki.png" + url: "https://tools.immae.eu/dokuwiki" + target: '_blank' + - name: "RompR (MPD)" + logo: "assets/tools/rompr.png" + url: "https://tools.immae.eu/rompr" + target: '_blank' + - name: "Ympd (MPD)" + icon: "far fa-play-circle" + url: "https://tools.immae.eu/mpd" + target: '_blank' + - name: "Shaarli" + logo: "assets/tools/shaarli.png" + url: "https://tools.immae.eu/Shaarli" + target: '_blank' + - name: "TT-RSS" + logo: "assets/tools/ttrss.png" + url: "https://tools.immae.eu/ttrss" + target: '_blank' + - name: "Wallabag" + logo: "assets/tools/wallabag.svg" + url: "https://tools.immae.eu/wallabag" + target: '_blank' + - name: "Grocy" + logo: "assets/tools/grocy.png" + url: "https://tools.immae.eu/grocy" + target: '_blank' + - name: "BIP39" + icon: "fab fa-bitcoin" + url: "https://tools.immae.eu/BIP39" + target: '_blank' + - name: "Social" + icon: "fas fa-users" + items: + - name: "Diaspora" + logo: "assets/tools/diaspora.png" + url: "https://diaspora.immae.eu" + target: '_blank' + - name: "Mastodon" + logo: "assets/tools/mastodon.png" + url: "https://mastodon.immae.eu" + target: '_blank' + - name: "PhpBB" + logo: "assets/tools/phpbb.ico" + url: "https://tools.immae.eu/forum" + target: '_blank' + - name: "Instant messaging (converse)" + icon: "fas fa-comment" + url: "https://im.immae.fr/converse" + target: '_blank' + - name: "Mail (roundcube)" + logo: "assets/tools/roundcube.svg" + url: "https://mail.immae.eu/roundcube" + target: '_blank' + - name: "Mail (rainloop)" + logo: "assets/tools/rainloop.png" + url: "https://mail.immae.eu/rainloop" + target: '_blank' + - name: "Video" + icon: "fas fa-video" + items: + - name: "Peertube" + logo: "assets/tools/peertube.png" + url: "https://peertube.immae.eu" + target: '_blank' + - name: "Mediagoblin" + logo: "assets/tools/mgoblin.ico" + url: "https://mgoblin.immae.eu" + target: '_blank' + - name: "Development" + icon: "fas fa-code-branch" + items: + - name: "Gitweb" + logo: "assets/tools/gitweb.png" + url: "https://git.immae.eu" + target: '_blank' + - name: "Mantisbt" + logo: "assets/tools/mantisbt.png" + url: "https://git.immae.eu/mantisbt" + target: '_blank' + - name: "Buildbot" + logo: "assets/tools/buildbot.svg" + url: "https://git.immae.eu/buildbot/immaeEu/" + target: '_blank' + - name: "Adminer" + logo: "assets/tools/adminer.png" + url: "https://tools.immae.eu/adminer" + target: '_blank' + - name: "Release" + icon: "fas fa-running" + url: "https://release.immae.eu" + target: '_blank' + - name: "Immae" + icon: "fas fa-edit" + items: + - name: "Page principale" + icon: "fas fa-user" + url: "https://www.immae.eu" + target: '_blank' + - name: "Atelier d’écriture" + icon: "fas fa-pen" + url: "https://www.immae.eu/atelier" + target: '_blank' + - name: "Blog" + icon: "fas fa-blog" + url: "https://www.immae.eu/blog" + target: '_blank' + - name: "Recherche" + icon: "fas fa-search" + url: "https://www.immae.eu/recherche" + target: '_blank' + - name: "Cours" + icon: "fas fa-school" + url: "https://www.immae.eu/cours" + target: '_blank' + - name: "Recettes" + icon: "fas fa-utensils" + url: "https://www.immae.eu/recettes" + target: '_blank' + - name: "Chapeaux de Hamming" + icon: "fas fa-hat-cowboy-side" + url: "https://www.immae.eu/chapeaux" + target: '_blank' + - name: "Configuration" + icon: "fas fa-cog" + items: + - name: "Instant messaging" + url: "https://im.immae.fr" + target: '_blank' + - name: "E-mail" + url: "https://mail.immae.eu" + target: '_blank' + - name: "VPN" + url: "https://vpn.immae.eu" + target: '_blank' + - name: "Taskwarrior" + url: "https://task.immae.eu" + target: '_blank' + - name: "Dav" + url: "https://dav.immae.eu" + target: '_blank' + - name: "Dav acount" + url: "https://dav.immae.eu/davical" + target: '_blank' + - name: "Paste" + url: "https://tools.immae.eu/paste" + target: '_blank' + - name: "LDAP" + url: "https://tools.immae.eu/ldap" + target: '_blank' + - name: "Yourls" + url: "https://tools.immae.eu/url/admin/" + target: '_blank' + - name: "Change password" + url: "https://tools.immae.eu/ldap_password.php" + target: '_blank' diff --git a/modules/private/websites/tools/tools/landing/icons/adminer.png b/modules/private/websites/tools/tools/landing/icons/adminer.png new file mode 100644 index 0000000..f5923d8 Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/adminer.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/buildbot.png b/modules/private/websites/tools/tools/landing/icons/buildbot.png new file mode 100644 index 0000000..e69de29 diff --git a/modules/private/websites/tools/tools/landing/icons/buildbot.svg b/modules/private/websites/tools/tools/landing/icons/buildbot.svg new file mode 100644 index 0000000..4972a11 --- /dev/null +++ b/modules/private/websites/tools/tools/landing/icons/buildbot.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/private/websites/tools/tools/landing/icons/diaspora.png b/modules/private/websites/tools/tools/landing/icons/diaspora.png new file mode 100644 index 0000000..7b23d5d Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/diaspora.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/dokuwiki.png b/modules/private/websites/tools/tools/landing/icons/dokuwiki.png new file mode 100644 index 0000000..a1f4995 Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/dokuwiki.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/etherpad.ico b/modules/private/websites/tools/tools/landing/icons/etherpad.ico new file mode 100644 index 0000000..938e955 Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/etherpad.ico differ diff --git a/modules/private/websites/tools/tools/landing/icons/gitweb.png b/modules/private/websites/tools/tools/landing/icons/gitweb.png new file mode 100644 index 0000000..4fa44bb Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/gitweb.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/grocy.png b/modules/private/websites/tools/tools/landing/icons/grocy.png new file mode 100644 index 0000000..40be557 Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/grocy.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/kanboard.png b/modules/private/websites/tools/tools/landing/icons/kanboard.png new file mode 100644 index 0000000..51702e7 Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/kanboard.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/mantisbt.png b/modules/private/websites/tools/tools/landing/icons/mantisbt.png new file mode 100644 index 0000000..729e3ea Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/mantisbt.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/mastodon.png b/modules/private/websites/tools/tools/landing/icons/mastodon.png new file mode 100644 index 0000000..b12aa55 Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/mastodon.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/mgoblin.ico b/modules/private/websites/tools/tools/landing/icons/mgoblin.ico new file mode 100644 index 0000000..ae5a1b1 Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/mgoblin.ico differ diff --git a/modules/private/websites/tools/tools/landing/icons/nextcloud.png b/modules/private/websites/tools/tools/landing/icons/nextcloud.png new file mode 100644 index 0000000..6358068 Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/nextcloud.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/peertube.png b/modules/private/websites/tools/tools/landing/icons/peertube.png new file mode 100644 index 0000000..a42fce3 Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/peertube.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/phpbb.ico b/modules/private/websites/tools/tools/landing/icons/phpbb.ico new file mode 100644 index 0000000..bb61b89 Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/phpbb.ico differ diff --git a/modules/private/websites/tools/tools/landing/icons/rainloop.png b/modules/private/websites/tools/tools/landing/icons/rainloop.png new file mode 100644 index 0000000..ce1dd1a Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/rainloop.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/rompr.png b/modules/private/websites/tools/tools/landing/icons/rompr.png new file mode 100644 index 0000000..d7b63b1 Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/rompr.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/roundcube.svg b/modules/private/websites/tools/tools/landing/icons/roundcube.svg new file mode 100644 index 0000000..1f50dd8 --- /dev/null +++ b/modules/private/websites/tools/tools/landing/icons/roundcube.svg @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/modules/private/websites/tools/tools/landing/icons/shaarli.png b/modules/private/websites/tools/tools/landing/icons/shaarli.png new file mode 100644 index 0000000..f29210c Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/shaarli.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/ttrss.png b/modules/private/websites/tools/tools/landing/icons/ttrss.png new file mode 100644 index 0000000..97437d2 Binary files /dev/null and b/modules/private/websites/tools/tools/landing/icons/ttrss.png differ diff --git a/modules/private/websites/tools/tools/landing/icons/wallabag.svg b/modules/private/websites/tools/tools/landing/icons/wallabag.svg new file mode 100644 index 0000000..7b87fed --- /dev/null +++ b/modules/private/websites/tools/tools/landing/icons/wallabag.svg @@ -0,0 +1 @@ + diff --git a/modules/private/websites/tools/tools/landing/ldap_password.php b/modules/private/websites/tools/tools/landing/ldap_password.php new file mode 100644 index 0000000..54448a4 --- /dev/null +++ b/modules/private/websites/tools/tools/landing/ldap_password.php @@ -0,0 +1,137 @@ + + * @website: http://technology.mattrude.com/2010/11/ldap-php-change-password-webpage/ + * + * + * GNU GENERAL PUBLIC LICENSE + * Version 2, June 1991 + * + * Copyright (C) 1989, 1991 Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Everyone is permitted to copy and distribute verbatim copies + * of this license document, but changing it is not allowed. + */ + +$message = array(); +$message_css = ""; + +function changePassword($user,$oldPassword,$newPassword,$newPasswordCnf){ + global $message; + global $message_css; + + $server = "ldaps://ldap.immae.eu"; + + error_reporting(0); + $con = ldap_connect($server); + ldap_set_option($con, LDAP_OPT_PROTOCOL_VERSION, 3); + + $user_dn = "uid=$user,ou=users,dc=immae,dc=eu"; + + if (ldap_bind($con, $user_dn, $oldPassword) === false) { + $message[] = "Error E101 - Current Username or Password is wrong."; + return false; + } + if ($newPassword != $newPasswordCnf ) { + $message[] = "Error E102 - Your New passwords do not match!"; + return false; + } + if (strlen($newPassword) < 6 ) { + $message[] = "Error E103 - Your new password is too short.
Your password must be at least 6 characters long."; + return false; + } + + $salt = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',4)),0,4); + $encoded_newPassword = "{SSHA}" . base64_encode(pack("H*", sha1($newPassword.$salt)).$salt); + + $user_search = ldap_search($con,"dc=immae,dc=eu","(uid=$user)"); + $auth_entry = ldap_first_entry($con, $user_search); + + $mail_addresses = ldap_get_values($con, $auth_entry, "mail"); + $given_names = ldap_get_values($con, $auth_entry, "givenName"); + $mail_address = $mail_addresses[0]; + $first_name = $given_names[0]; + + /* And Finally, Change the password */ + $entry = array(); + $entry["userPassword"] = "$encoded_newPassword"; + + if (ldap_modify($con,$user_dn,$entry) === false){ + $error = ldap_error($con); + $errno = ldap_errno($con); + $message[] = "E201 - Your password cannot be changed, please contact the administrator."; + $message[] = "$errno - $error"; + } else { + $message_css = "yes"; + mail($mail_address,"Password change notice","Dear $first_name, +Your password on https://tools.immae.eu/ldap_password.php for account $user was just changed. +If you did not make this change, please contact me. +If you were the one who changed your password, you may disregard this message. + +Thanks +-- +Immae / Ismaël", "From: " . getenv("CONTACT_EMAIL")); + $message[] = "The password for $user has been changed.
An informational email has been sent to $mail_address.
Your new password is now fully active."; + } +} + +?> + + + +Password Change Page + + + + + + +
+
+

Password Change Page

+'; + changePassword($_POST['username'],$_POST['oldPassword'],$_POST['newPassword1'],$_POST['newPassword2']); + global $message_css; + if ($message_css == "yes") { + echo '
'; + } else { + echo '
'; + $message[] = "Your password was not changed."; + } + foreach ( $message as $one ) { echo "

$one

"; } + ?>
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ + diff --git a/modules/private/websites/tools/tools/landing/myip.php b/modules/private/websites/tools/tools/landing/myip.php new file mode 100644 index 0000000..9ec1c6c --- /dev/null +++ b/modules/private/websites/tools/tools/landing/myip.php @@ -0,0 +1 @@ + diff --git a/modules/private/websites/tools/tools/webhooks.nix b/modules/private/websites/tools/tools/webhooks.nix new file mode 100644 index 0000000..885b68b --- /dev/null +++ b/modules/private/websites/tools/tools/webhooks.nix @@ -0,0 +1,10 @@ +{ lib, env }: +{ + keys = lib.attrsets.mapAttrsToList (k: v: { + dest = "webapps/webhooks/${k}.php"; + user = "wwwrun"; + group = "wwwrun"; + permissions = "0400"; + text = v; + }) env; +}