<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Change Expiration Date Users in General Topics</title>
    <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168143#M27963</link>
    <description>&lt;P&gt;If you've changed the default port, yes, you will have to modify the script accordingly as mgmt_cli assumes port 443 otherwise.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2023 00:47:21 GMT</pubDate>
    <dc:creator>PhoneBoy</dc:creator>
    <dc:date>2023-01-18T00:47:21Z</dc:date>
    <item>
      <title>Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/167940#M27896</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to know how we can adjust the expiration date without going through all users one by one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 16:24:03 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/167940#M27896</guid>
      <dc:creator>Tho</dc:creator>
      <dc:date>2023-01-16T16:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/167992#M27910</link>
      <description>&lt;P&gt;Use a script to do it.&lt;BR /&gt;See:&amp;nbsp;&lt;A href="https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/106575#M736" target="_blank"&gt;https://community.checkpoint.com/t5/Scripts/Extend-local-users-expiration-local-API-bash-scripts/m-p/106575#M736&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 00:01:31 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/167992#M27910</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2023-01-17T00:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168066#M27940</link>
      <description>&lt;P&gt;We will test it, thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 13:40:57 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168066#M27940</guid>
      <dc:creator>Tho</dc:creator>
      <dc:date>2023-01-17T13:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168071#M27941</link>
      <description>&lt;P&gt;Hello PhoneBoy,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I get back when we are running the script:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;jq: error: Cannot iterate over null&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Logout failed&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Checking expiration time of all users...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 00:06:38 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168071#M27941</guid>
      <dc:creator>Tho</dc:creator>
      <dc:date>2023-01-18T00:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168126#M27952</link>
      <description>&lt;P&gt;What version/JHF of management are you running?&lt;BR /&gt;I believe the script requires R80.40 with the latest recommended JHF or above.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 21:25:56 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168126#M27952</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2023-01-17T21:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168127#M27953</link>
      <description>&lt;P&gt;We are running R81.10 take 335.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 21:47:12 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168127#M27953</guid>
      <dc:creator>Tho</dc:creator>
      <dc:date>2023-01-17T21:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168129#M27955</link>
      <description>&lt;P&gt;This is the script we are using:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#!/bin/bash&lt;BR /&gt;# Created by tvobruba&lt;BR /&gt;# version 001&lt;BR /&gt;# script is checking and changing expiration date for all internal users in CP MGMT database&lt;BR /&gt;# usage: chmod 700 &amp;amp;&amp;amp; ./script.sh&lt;/P&gt;&lt;P&gt;date=1609459162000 #setup checked date in ms epoch time - 2020-12-31 16:45&lt;BR /&gt;new_date="2036-01-31" #setup new desired date in ISO format&lt;/P&gt;&lt;P&gt;# export list of users to file&lt;BR /&gt;mgmt_cli -r true show users --format json |jq '.objects[].name' &amp;gt; list.txt&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;echo "Checking expiration time of all users..."&lt;BR /&gt;echo -e "";&lt;BR /&gt;for user in `cat ./list.txt`; do&lt;/P&gt;&lt;P&gt;expiration=`mgmt_cli -r true show user name $user --format json |jq '."expiration-date".posix'`&lt;BR /&gt;echo User: $user, $expiration&lt;BR /&gt;echo ""&lt;/P&gt;&lt;P&gt;if [ $date \&amp;gt; $expiration ];&lt;BR /&gt;then&lt;BR /&gt;echo "$user will expire before 31.12.2020 23:55";&lt;BR /&gt;echo "Setting new expiration..."&lt;BR /&gt;echo ""&lt;BR /&gt;mgmt_cli -r true set user name $user expiration-date "$new_date" --format json&lt;BR /&gt;else&lt;BR /&gt;echo "$user will expire not before: `date -d @$( echo "($expiration + 500) / 1000" | bc)`";&lt;BR /&gt;fi;&lt;/P&gt;&lt;P&gt;done&lt;/P&gt;&lt;P&gt;rm -f ./list.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 00:07:14 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168129#M27955</guid>
      <dc:creator>Tho</dc:creator>
      <dc:date>2023-01-18T00:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168136#M27958</link>
      <description>&lt;P&gt;What does the following command show?&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;mgmt_cli -r true show users --format json&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Note this script may not work as-is (especially if you have more than 500 users) and will require modifications to get you the desired result.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 22:20:46 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168136#M27958</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2023-01-17T22:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168140#M27960</link>
      <description>&lt;P&gt;This is what the command shows:&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"code" : "generic_error",&lt;BR /&gt;"message" : "Error 404. The Management API service is not available. Please check that the Management API server is up and running."&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Logout failed&lt;/P&gt;&lt;P&gt;I already checked the API service is up and running.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the command 'api status' it shows me this info:&lt;/P&gt;&lt;P&gt;When running mgmt_cli commands add '--port 44 34'&lt;/P&gt;&lt;P&gt;We have close to 400 users at the moment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 00:15:05 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168140#M27960</guid>
      <dc:creator>Tho</dc:creator>
      <dc:date>2023-01-18T00:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168141#M27961</link>
      <description>&lt;P&gt;When I run the same command and I add --port 4434&amp;nbsp; at the end&amp;nbsp;(mgmt_cli -r true show users --format json --port 4434) it shows me a bunch of users, so that works now.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 00:21:26 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168141#M27961</guid>
      <dc:creator>Tho</dc:creator>
      <dc:date>2023-01-18T00:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168143#M27963</link>
      <description>&lt;P&gt;If you've changed the default port, yes, you will have to modify the script accordingly as mgmt_cli assumes port 443 otherwise.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 00:47:21 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168143#M27963</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2023-01-18T00:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168144#M27964</link>
      <description>&lt;P&gt;Ok, I modified the script a tiny bit:&lt;/P&gt;&lt;P&gt;#!/bin/bash&lt;BR /&gt;# Created by tvobruba&lt;BR /&gt;# version 001&lt;BR /&gt;# script is checking and changing expiration date for all internal users in CP MGMT database&lt;BR /&gt;# usage: chmod 700 &amp;amp;&amp;amp; ./script.sh&lt;/P&gt;&lt;P&gt;date=1609459162000 #setup checked date in ms epoch time - 2020-12-31 16:45&lt;BR /&gt;new_date="2036-01-31" #setup new desired date in ISO format&lt;/P&gt;&lt;P&gt;# export list of users to file&lt;BR /&gt;mgmt_cli -r true show users --format json --port 4434 |jq '.objects[].name' &amp;gt; list.txt&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;echo "Checking expiration time of all users..."&lt;BR /&gt;echo -e "";&lt;BR /&gt;for user in `cat ./list.txt`; do&lt;/P&gt;&lt;P&gt;expiration=`mgmt_cli -r true show user name $user --format json --port 4434 |jq '."expiration-date".posix'`&lt;BR /&gt;echo User: $user, $expiration&lt;BR /&gt;echo ""&lt;/P&gt;&lt;P&gt;if [ $date \&amp;gt; $expiration ];&lt;BR /&gt;then&lt;BR /&gt;echo "$user will expire before 31.12.2020 23:55";&lt;BR /&gt;echo "Setting new expiration..."&lt;BR /&gt;echo ""&lt;BR /&gt;mgmt_cli -r true set user name $user expiration-date "$new_date" --format json&lt;BR /&gt;else&lt;BR /&gt;echo "$user will expire not before: `date -d @$( echo "($expiration + 500) / 1000" | bc)`";&lt;BR /&gt;fi;&lt;/P&gt;&lt;P&gt;done&lt;/P&gt;&lt;P&gt;rm -f ./list.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script is now running and it's checking the expiration date of the users that start with letter a, b and c and then it stops.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;"x" will expire not before: Sat Jan 31 00:00:00 CET 2026&lt;BR /&gt;User: "x", 1769814000000&lt;/P&gt;&lt;P&gt;"x" will expire not before: Sat Jan 31 00:00:00 CET 2026&lt;BR /&gt;User: "x", 1769814000000&lt;/P&gt;&lt;P&gt;"x" will expire not before: Sat Jan 31 00:00:00 CET 2026&lt;BR /&gt;User: "x", 1769814000000&lt;/P&gt;&lt;P&gt;"x" will expire not before: Sat Jan 31 00:00:00 CET 2026&lt;BR /&gt;User: "x", 1769814000000&lt;/P&gt;&lt;P&gt;"x" will expire not before: Sat Jan 31 00:00:00 CET 2026&lt;/P&gt;&lt;P&gt;We already changed the expiration date of some users to 31-1-2026 (manually).&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to go from here?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 00:56:41 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168144#M27964</guid>
      <dc:creator>Tho</dc:creator>
      <dc:date>2023-01-18T00:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168145#M27965</link>
      <description>&lt;P&gt;I suspect you have more users than the result of "show users" will return on its own.&lt;BR /&gt;Which means you will need to make multiple calls to show users with the "offset" parameter to get all the users.&lt;BR /&gt;This exact issue was discussed here:&amp;nbsp;&lt;A href="https://community.checkpoint.com/t5/API-CLI-Discussion/Export-Users-with-Specific-Expiry-amp-and-Valid-Certificate/m-p/166616/highlight/true#M7390" target="_blank"&gt;https://community.checkpoint.com/t5/API-CLI-Discussion/Export-Users-with-Specific-Expiry-amp-and-Valid-Certificate/m-p/166616/highlight/true#M7390&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 01:15:30 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168145#M27965</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2023-01-18T01:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168162#M27974</link>
      <description>&lt;P&gt;This is how I took care of it automatically:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;# Validate API status, exit 101 if not running&lt;BR /&gt;APISTATUS=`api status|grep 'API Status'|awk '{print $4}'`&lt;BR /&gt;if [ "$APISTATUS" != "Started" ]; then&lt;BR /&gt;echo "API Server is not available but $APISTATUS"&lt;BR /&gt;exit 101&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;# Get API port, set MMGMT CLI accordingly&lt;BR /&gt;APIPORT=`api status|grep "Gaia Port"|awk '{print $4}'`&lt;BR /&gt;MGMTCLI="mgmt_cli --port $APIPORT"&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you can use the SMGMT_CLI command on every SmartCenter.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 06:39:46 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168162#M27974</guid>
      <dc:creator>Hugo_vd_Kooij</dc:creator>
      <dc:date>2023-01-18T06:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168195#M27978</link>
      <description>&lt;P&gt;Script is working now, this got the job done:&amp;nbsp;&lt;/P&gt;&lt;P&gt;#!/bin/bash&lt;BR /&gt;# script is checking and changing expiration date for all internal users in CP MGMT database&lt;BR /&gt;# usage: chmod 700 &amp;amp;&amp;amp; ./script.sh&lt;/P&gt;&lt;P&gt;date=1704037500139 #setup checked date in ms epoch time - 2023-12-31 16:45&lt;BR /&gt;new_date="2026-01-31" #setup new desired date in ISO format&lt;/P&gt;&lt;P&gt;offset=0&lt;BR /&gt;echo "Checking expiration time of all users..."&lt;BR /&gt;echo -e "";&lt;BR /&gt;while true; do&lt;BR /&gt;users_list=$(mgmt_cli -r true show users offset $offset limit 50 --format json --port 4434 |jq '.objects[].name')&lt;BR /&gt;if [ "$users_list" = "[]" ]; then&lt;BR /&gt;break&lt;BR /&gt;fi&lt;BR /&gt;for user in $users_list; do&lt;BR /&gt;expiration=`mgmt_cli -r true show user name $user --format json --port 4434 |jq '."expiration-date".posix'`&lt;BR /&gt;echo User: $user, $expiration&lt;BR /&gt;echo ""&lt;/P&gt;&lt;P&gt;if [ $date \&amp;gt; $expiration ];&lt;BR /&gt;then&lt;BR /&gt;echo "$user will expire before 31.12.2023 23:55";&lt;BR /&gt;echo "Setting new expiration..."&lt;BR /&gt;echo ""&lt;BR /&gt;mgmt_cli -r true set user name $user expiration-date "$new_date" --format json --port 4434 &amp;gt; /dev/null&lt;BR /&gt;else&lt;BR /&gt;echo "$user will expire not before: `date -d @$( echo "($expiration + 500) / 1000" | bc)`";&lt;BR /&gt;fi;&lt;BR /&gt;done&lt;BR /&gt;offset=$((offset+50))&lt;BR /&gt;done&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/7"&gt;@PhoneBoy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 12:51:21 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168195#M27978</guid>
      <dc:creator>Tho</dc:creator>
      <dc:date>2023-01-18T12:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168196#M27979</link>
      <description>&lt;P&gt;Thanks Hugo, will try this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 12:52:15 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168196#M27979</guid>
      <dc:creator>Tho</dc:creator>
      <dc:date>2023-01-18T12:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Change Expiration Date Users</title>
      <link>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168256#M27987</link>
      <description>&lt;P&gt;Clever!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 17:08:26 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/General-Topics/Change-Expiration-Date-Users/m-p/168256#M27987</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2023-01-18T17:08:26Z</dc:date>
    </item>
  </channel>
</rss>

